diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-09-08 15:11:18 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-09-10 21:52:31 +0300 |
commit | 15aece72382fe1862a58728b9d02990147f91365 (patch) | |
tree | bdff49a3076c4f4f2c53aba20e038c792f65f0a7 /test | |
parent | a098e10fd6d9f3b6573e2fb6333335d40a9bf330 (diff) | |
download | pleroma-15aece72382fe1862a58728b9d02990147f91365.tar.gz |
remove validate_expires_at from enqueue method
Diffstat (limited to 'test')
-rw-r--r-- | test/workers/purge_expired_activity_test.exs | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/test/workers/purge_expired_activity_test.exs b/test/workers/purge_expired_activity_test.exs index 8b5dc9fd2..b5938776d 100644 --- a/test/workers/purge_expired_activity_test.exs +++ b/test/workers/purge_expired_activity_test.exs @@ -10,22 +10,27 @@ defmodule Pleroma.Workers.PurgeExpiredActivityTest do alias Pleroma.Workers.PurgeExpiredActivity - test "denies expirations that don't live long enough" do + test "enqueue job" do activity = insert(:note_activity) - assert {:error, :expiration_too_close} = + assert {:ok, _} = PurgeExpiredActivity.enqueue(%{ activity_id: activity.id, - expires_at: DateTime.utc_now() + expires_at: DateTime.add(DateTime.utc_now(), 3601) }) - refute_enqueued( + assert_enqueued( worker: Pleroma.Workers.PurgeExpiredActivity, args: %{activity_id: activity.id} ) + + assert {:ok, _} = + perform_job(Pleroma.Workers.PurgeExpiredActivity, %{activity_id: activity.id}) + + assert %Oban.Job{} = Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id) end - test "enqueue job" do + test "error if user was not found" do activity = insert(:note_activity) assert {:ok, _} = @@ -34,14 +39,21 @@ defmodule Pleroma.Workers.PurgeExpiredActivityTest do expires_at: DateTime.add(DateTime.utc_now(), 3601) }) - assert_enqueued( - worker: Pleroma.Workers.PurgeExpiredActivity, - args: %{activity_id: activity.id} - ) + user = Pleroma.User.get_by_ap_id(activity.actor) + Pleroma.Repo.delete(user) - assert {:ok, _} = + assert {:error, :user_not_found} = perform_job(Pleroma.Workers.PurgeExpiredActivity, %{activity_id: activity.id}) + end - assert %Oban.Job{} = Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id) + test "error if actiivity was not found" do + assert {:ok, _} = + PurgeExpiredActivity.enqueue(%{ + activity_id: "some_id", + expires_at: DateTime.add(DateTime.utc_now(), 3601) + }) + + assert {:error, :activity_not_found} = + perform_job(Pleroma.Workers.PurgeExpiredActivity, %{activity_id: "some_if"}) end end |