summaryrefslogtreecommitdiff
path: root/test/web/activity_pub/activity_pub_controller_test.exs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-09-15 20:22:17 +0000
committerrinpatch <rinpatch@sdf.org>2019-09-15 20:22:17 +0000
commit2990c0a53b14646eab19b57d068ac8aa7e17ea4e (patch)
tree7681ac3405657948a062c396b70bb2f275e91238 /test/web/activity_pub/activity_pub_controller_test.exs
parent9c64a25713790fefa8b5c419aeadf55113c17073 (diff)
parent3b8ec98b0e3b3fb2bd333f3be724676c4821366f (diff)
downloadpleroma-2990c0a53b14646eab19b57d068ac8aa7e17ea4e.tar.gz
pleroma-2990c0a53b14646eab19b57d068ac8aa7e17ea4e.zip
Merge branch '1149-oban-job-queue' into 'develop'
[#1149] `oban`-based job & retry queues Closes #1149 See merge request pleroma/pleroma!1518
Diffstat (limited to 'test/web/activity_pub/activity_pub_controller_test.exs')
-rw-r--r--test/web/activity_pub/activity_pub_controller_test.exs14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs
index 9698c7099..9b78fb72d 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/web/activity_pub/activity_pub_controller_test.exs
@@ -4,16 +4,20 @@
defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
use Pleroma.Web.ConnCase
+ use Oban.Testing, repo: Pleroma.Repo
+
import Pleroma.Factory
alias Pleroma.Activity
alias Pleroma.Instances
alias Pleroma.Object
+ alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ObjectView
alias Pleroma.Web.ActivityPub.Relay
alias Pleroma.Web.ActivityPub.UserView
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Workers.ReceiverWorker
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
@@ -365,7 +369,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|> post("/inbox", data)
assert "ok" == json_response(conn, 200)
- :timer.sleep(500)
+
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
assert Activity.get_by_ap_id(data["id"])
end
@@ -407,7 +412,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|> post("/users/#{user.nickname}/inbox", data)
assert "ok" == json_response(conn, 200)
- :timer.sleep(500)
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
assert Activity.get_by_ap_id(data["id"])
end
@@ -436,7 +441,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|> post("/users/#{recipient.nickname}/inbox", data)
assert "ok" == json_response(conn, 200)
- :timer.sleep(500)
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
assert Activity.get_by_ap_id(data["id"])
end
@@ -526,6 +531,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|> post("/users/#{recipient.nickname}/inbox", data)
|> json_response(200)
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
+
activity = Activity.get_by_ap_id(data["id"])
assert activity.id
@@ -601,6 +608,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|> post("/users/#{user.nickname}/outbox", data)
result = json_response(conn, 201)
+
assert Activity.get_by_ap_id(result["id"])
end