Use the normal Oban test assertions

This commit is contained in:
Mark Felder 2024-08-06 09:55:09 -04:00
parent 9cf684d661
commit 16ba2742b7

View file

@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.PublisherTest do defmodule Pleroma.Web.ActivityPub.PublisherTest do
use Oban.Testing, repo: Pleroma.Repo
use Pleroma.Web.ConnCase use Pleroma.Web.ConnCase
import ExUnit.CaptureLog import ExUnit.CaptureLog
@ -310,12 +311,15 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok assert res == :ok
assert not called( refute_enqueued(
Publisher.enqueue_one(%{ worker: "Pleroma.Workers.PublisherWorker",
inbox: "https://domain.com/users/nick1/inbox", args: %{
activity_id: note_activity.id "params" => %{
}) inbox: "https://domain.com/users/nick1/inbox",
) activity_id: note_activity.id
}
}
)
end end
test_with_mock "Publishes a non-public activity to non-quarantined instances.", test_with_mock "Publishes a non-public activity to non-quarantined instances.",
@ -345,15 +349,16 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok assert res == :ok
assert called( assert_enqueued(
Publisher.enqueue_one( worker: "Pleroma.Workers.PublisherWorker",
%{ args: %{
inbox: "https://domain.com/users/nick1/inbox", "params" => %{
activity_id: note_activity.id inbox: "https://domain.com/users/nick1/inbox",
}, activity_id: note_activity.id
priority: 1 }
) },
) priority: 1
)
end end
test_with_mock "Publishes to directly addressed actors with higher priority.", test_with_mock "Publishes to directly addressed actors with higher priority.",
@ -403,12 +408,15 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
res = Publisher.publish(actor, note_activity) res = Publisher.publish(actor, note_activity)
assert res == :ok assert res == :ok
assert called( assert_enqueued(
Publisher.enqueue_one(%{ worker: "Pleroma.Workers.PublisherWorker",
inbox: "https://domain.com/users/nick1/inbox", args: %{
activity_id: note_activity.id "params" => %{
}) inbox: "https://domain.com/users/nick1/inbox",
) activity_id: note_activity.id
}
}
)
end end
test_with_mock "publishes a delete activity to peers who signed fetch requests to the create acitvity/object.", test_with_mock "publishes a delete activity to peers who signed fetch requests to the create acitvity/object.",
@ -452,25 +460,27 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
res = Publisher.publish(actor, delete) res = Publisher.publish(actor, delete)
assert res == :ok assert res == :ok
assert called( assert_enqueued(
Publisher.enqueue_one( worker: "Pleroma.Workers.PublisherWorker",
%{ args: %{
inbox: "https://domain.com/users/nick1/inbox", "params" => %{
activity_id: delete.id inbox: "https://domain.com/users/nick1/inbox",
}, activity_id: delete.id
priority: 1 }
) },
) priority: 1
)
assert called( assert_enqueued(
Publisher.enqueue_one( worker: "Pleroma.Workers.PublisherWorker",
%{ args: %{
inbox: "https://domain2.com/users/nick1/inbox", "params" => %{
activity_id: delete.id inbox: "https://domain2.com/users/nick1/inbox",
}, activity_id: delete.id
priority: 1 }
) },
) priority: 1
)
end end
end end
end end