schedule activity expiration in Oban
This commit is contained in:
parent
0254696e30
commit
9bf1065a06
23 changed files with 229 additions and 386 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
defmodule Pleroma.Web.CommonAPITest do
|
||||
use Pleroma.DataCase
|
||||
use Oban.Testing, repo: Pleroma.Repo
|
||||
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.Chat
|
||||
alias Pleroma.Conversation.Participation
|
||||
|
|
@ -598,15 +600,15 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
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 = DateTime.add(DateTime.utc_now(), 1_000_000)
|
||||
|
||||
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
|
||||
assert_enqueued(
|
||||
worker: Pleroma.Workers.PurgeExpiredActivity,
|
||||
args: %{activity_id: activity.id},
|
||||
scheduled_at: expires_at
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue