projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
constants: add as_public constant and use it everywhere
[akkoma]
/
test
/
web
/
federator_test.exs
diff --git
a/test/web/federator_test.exs
b/test/web/federator_test.exs
index 52729eb507627db0255f96266439539664244c93..6e143eee48f03d467e4865fd18af8b01c204db67 100644
(file)
--- a/
test/web/federator_test.exs
+++ b/
test/web/federator_test.exs
@@
-12,9
+12,25
@@
defmodule Pleroma.Web.FederatorTest do
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
+
+ config_path = [:instance, :federating]
+ initial_setting = Pleroma.Config.get(config_path)
+
+ Pleroma.Config.put(config_path, true)
+ on_exit(fn -> Pleroma.Config.put(config_path, initial_setting) end)
+
:ok
end
:ok
end
+ describe "Publisher.perform" do
+ test "call `perform` with unknown task" do
+ assert {
+ :error,
+ "Don't know what to do with this"
+ } = Pleroma.Web.Federator.Publisher.perform("test", :ok, :ok)
+ end
+ end
+
describe "Publish an activity" do
setup do
user = insert(:user)
describe "Publish an activity" do
setup do
user = insert(:user)
@@
-58,7
+74,7
@@
defmodule Pleroma.Web.FederatorTest do
describe "Targets reachability filtering in `publish`" do
test_with_mock "it federates only to reachable instances via AP",
describe "Targets reachability filtering in `publish`" do
test_with_mock "it federates only to reachable instances via AP",
-
Federato
r,
+
Pleroma.Web.ActivityPub.Publishe
r,
[:passthrough],
[] do
user = insert(:user)
[:passthrough],
[] do
user = insert(:user)
@@
-88,13
+104,18
@@
defmodule Pleroma.Web.FederatorTest do
{:ok, _activity} =
CommonAPI.post(user, %{"status" => "HI @nick1@domain.com, @nick2@domain2.com!"})
{:ok, _activity} =
CommonAPI.post(user, %{"status" => "HI @nick1@domain.com, @nick2@domain2.com!"})
- assert called(Federator.publish_single_ap(%{inbox: inbox1, unreachable_since: dt}))
+ assert called(
+ Pleroma.Web.ActivityPub.Publisher.publish_one(%{
+ inbox: inbox1,
+ unreachable_since: dt
+ })
+ )
- refute called(
Federator.publish_single_ap
(%{inbox: inbox2}))
+ refute called(
Pleroma.Web.ActivityPub.Publisher.publish_one
(%{inbox: inbox2}))
end
test_with_mock "it federates only to reachable instances via Websub",
end
test_with_mock "it federates only to reachable instances via Websub",
-
Federator
,
+
Pleroma.Web.Websub
,
[:passthrough],
[] do
user = insert(:user)
[:passthrough],
[] do
user = insert(:user)
@@
-122,17
+143,17
@@
defmodule Pleroma.Web.FederatorTest do
{:ok, _activity} = CommonAPI.post(user, %{"status" => "HI"})
assert called(
{:ok, _activity} = CommonAPI.post(user, %{"status" => "HI"})
assert called(
-
Federator.publish_single_websub
(%{
+
Pleroma.Web.Websub.publish_one
(%{
callback: sub2.callback,
unreachable_since: dt
})
)
callback: sub2.callback,
unreachable_since: dt
})
)
- refute called(
Federator.publish_single_websub
(%{callback: sub1.callback}))
+ refute called(
Pleroma.Web.Websub.publish_one
(%{callback: sub1.callback}))
end
test_with_mock "it federates only to reachable instances via Salmon",
end
test_with_mock "it federates only to reachable instances via Salmon",
-
Federator
,
+
Pleroma.Web.Salmon
,
[:passthrough],
[] do
user = insert(:user)
[:passthrough],
[] do
user = insert(:user)
@@
-162,13
+183,13
@@
defmodule Pleroma.Web.FederatorTest do
CommonAPI.post(user, %{"status" => "HI @nick1@domain.com, @nick2@domain2.com!"})
assert called(
CommonAPI.post(user, %{"status" => "HI @nick1@domain.com, @nick2@domain2.com!"})
assert called(
-
Federator.publish_single_salmon
(%{
+
Pleroma.Web.Salmon.publish_one
(%{
recipient: remote_user2,
unreachable_since: dt
})
)
recipient: remote_user2,
unreachable_since: dt
})
)
- refute called(
Federator.publish_single_websub
(%{recipient: remote_user1}))
+ refute called(
Pleroma.Web.Salmon.publish_one
(%{recipient: remote_user1}))
end
end
end
end