remove validate_expires_at from enqueue method
This commit is contained in:
parent
a098e10fd6
commit
15aece7238
4 changed files with 30 additions and 31 deletions
|
|
@ -10,21 +10,6 @@ defmodule Pleroma.Workers.PurgeExpiredActivityTest do
|
|||
|
||||
alias Pleroma.Workers.PurgeExpiredActivity
|
||||
|
||||
test "denies expirations that don't live long enough" do
|
||||
activity = insert(:note_activity)
|
||||
|
||||
assert {:error, :expiration_too_close} =
|
||||
PurgeExpiredActivity.enqueue(%{
|
||||
activity_id: activity.id,
|
||||
expires_at: DateTime.utc_now()
|
||||
})
|
||||
|
||||
refute_enqueued(
|
||||
worker: Pleroma.Workers.PurgeExpiredActivity,
|
||||
args: %{activity_id: activity.id}
|
||||
)
|
||||
end
|
||||
|
||||
test "enqueue job" do
|
||||
activity = insert(:note_activity)
|
||||
|
||||
|
|
@ -44,4 +29,31 @@ defmodule Pleroma.Workers.PurgeExpiredActivityTest do
|
|||
|
||||
assert %Oban.Job{} = Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id)
|
||||
end
|
||||
|
||||
test "error if user was not found" do
|
||||
activity = insert(:note_activity)
|
||||
|
||||
assert {:ok, _} =
|
||||
PurgeExpiredActivity.enqueue(%{
|
||||
activity_id: activity.id,
|
||||
expires_at: DateTime.add(DateTime.utc_now(), 3601)
|
||||
})
|
||||
|
||||
user = Pleroma.User.get_by_ap_id(activity.actor)
|
||||
Pleroma.Repo.delete(user)
|
||||
|
||||
assert {:error, :user_not_found} =
|
||||
perform_job(Pleroma.Workers.PurgeExpiredActivity, %{activity_id: activity.id})
|
||||
end
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue