summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-08-31 14:25:43 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-08-31 14:25:43 +0300
commite890ea7e821d61fca75084d46f70ed125acf1fc8 (patch)
tree7994c0be9f90b39a9ed46bbfd9f04fce70a14671 /test/web/common_api/common_api_test.exs
parentcd78e63a2528ab813088d5e44a026f6bb05b344b (diff)
parent6d33c89c4d27a1b52e69e1c14b408726410a6326 (diff)
downloadpleroma-e890ea7e821d61fca75084d46f70ed125acf1fc8.tar.gz
pleroma-e890ea7e821d61fca75084d46f70ed125acf1fc8.zip
[#1149] Added Oban job for "activity_expiration". Merged remote-tracking branch 'remotes/upstream/develop' into 1149-oban-job-queue
# Conflicts: # config/config.exs
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r--test/web/common_api/common_api_test.exs15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index bcbaad665..f28a66090 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -204,6 +204,21 @@ defmodule Pleroma.Web.CommonAPITest do
assert {:error, "The status is over the character limit"} =
CommonAPI.post(user, %{"status" => "foobar"})
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)
+
+ assert {:ok, activity} =
+ CommonAPI.post(user, %{"status" => "chai", "expires_in" => 1_000_000})
+
+ assert expiration = Pleroma.ActivityExpiration.get_by_activity_id(activity.id)
+ assert expiration.scheduled_at == expires_at
+ end
end
describe "reactions" do