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
defmodule Pleroma.Web.ActivityPub.PublisherTest do
use Oban.Testing, repo: Pleroma.Repo
use Pleroma.Web.ConnCase
import ExUnit.CaptureLog
@ -310,11 +311,14 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert not called(
Publisher.enqueue_one(%{
refute_enqueued(
worker: "Pleroma.Workers.PublisherWorker",
args: %{
"params" => %{
inbox: "https://domain.com/users/nick1/inbox",
activity_id: note_activity.id
})
}
}
)
end
@ -345,15 +349,16 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert res == :ok
assert called(
Publisher.enqueue_one(
%{
assert_enqueued(
worker: "Pleroma.Workers.PublisherWorker",
args: %{
"params" => %{
inbox: "https://domain.com/users/nick1/inbox",
activity_id: note_activity.id
}
},
priority: 1
)
)
end
test_with_mock "Publishes to directly addressed actors with higher priority.",
@ -403,11 +408,14 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
res = Publisher.publish(actor, note_activity)
assert res == :ok
assert called(
Publisher.enqueue_one(%{
assert_enqueued(
worker: "Pleroma.Workers.PublisherWorker",
args: %{
"params" => %{
inbox: "https://domain.com/users/nick1/inbox",
activity_id: note_activity.id
})
}
}
)
end
@ -452,25 +460,27 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
res = Publisher.publish(actor, delete)
assert res == :ok
assert called(
Publisher.enqueue_one(
%{
assert_enqueued(
worker: "Pleroma.Workers.PublisherWorker",
args: %{
"params" => %{
inbox: "https://domain.com/users/nick1/inbox",
activity_id: delete.id
}
},
priority: 1
)
)
assert called(
Publisher.enqueue_one(
%{
assert_enqueued(
worker: "Pleroma.Workers.PublisherWorker",
args: %{
"params" => %{
inbox: "https://domain2.com/users/nick1/inbox",
activity_id: delete.id
}
},
priority: 1
)
)
end
end
end