aboutsummaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_test.exs
diff options
context:
space:
mode:
authorMike Verdone <spiral@arcseconds.net>2019-07-22 16:46:20 +0200
committerMike Verdone <spiral@arcseconds.net>2019-07-24 14:45:14 +0200
commit704960b3c135d2e050308c68f5ccf5d7b7df40f8 (patch)
tree85c5e602683014b42147dd582113fafff578c4eb /test/web/common_api/common_api_test.exs
parent378f5f0fbe21c2533719fed9afe8313586fda5d5 (diff)
downloadpleroma-704960b3c135d2e050308c68f5ccf5d7b7df40f8.tar.gz
Add support for activity expiration to common and Masto API
The "expires_at" parameter accepts an ISO8601-formatted date which defines when the activity will expire. At this point the API will not give you any feedback about if your post will expire or not.
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r--test/web/common_api/common_api_test.exs17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 16b3f121d..210314a4a 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -160,6 +160,23 @@ defmodule Pleroma.Web.CommonAPITest do
Pleroma.Config.put([:instance, :limit], limit)
end
+
+ test "it can handle activities that expire" do
+ user = insert(:user)
+
+ expires_at =
+ NaiveDateTime.utc_now()
+ |> NaiveDateTime.truncate(:second)
+ |> NaiveDateTime.add(1_000_000, :second)
+
+ expires_at_iso8601 = expires_at |> NaiveDateTime.to_iso8601()
+
+ assert {:ok, activity} =
+ CommonAPI.post(user, %{"status" => "chai", "expires_at" => expires_at_iso8601})
+
+ assert expiration = Pleroma.ActivityExpiration.get_by_activity_id(activity.id)
+ assert expiration.scheduled_at == expires_at
+ end
end
describe "reactions" do