projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'refactor/db-not-null-constraints-for-registrations' into 'develop'
[akkoma]
/
test
/
web
/
activity_pub
/
publisher_test.exs
diff --git
a/test/web/activity_pub/publisher_test.exs
b/test/web/activity_pub/publisher_test.exs
index 32b7a242c7470472ad579cadd500ccf0a841fca2..e885e5a5abb87bde31302f93562e97e6555d4cb7 100644
(file)
--- a/
test/web/activity_pub/publisher_test.exs
+++ b/
test/web/activity_pub/publisher_test.exs
@@
-5,13
+5,14
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
use Pleroma.Web.ConnCase
defmodule Pleroma.Web.ActivityPub.PublisherTest do
use Pleroma.Web.ConnCase
+ import ExUnit.CaptureLog
import Pleroma.Factory
import Tesla.Mock
import Mock
alias Pleroma.Activity
import Pleroma.Factory
import Tesla.Mock
import Mock
alias Pleroma.Activity
- alias Pleroma.Object
alias Pleroma.Instances
alias Pleroma.Instances
+ alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Publisher
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.ActivityPub.Publisher
alias Pleroma.Web.CommonAPI
@@
-26,7
+27,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
test "it returns sharedInbox for messages involving as:Public in to" do
user =
insert(:user, %{
test "it returns sharedInbox for messages involving as:Public in to" do
user =
insert(:user, %{
-
info: %{source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
}}
+
source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"
}}
})
activity = %Activity{
})
activity = %Activity{
@@
-39,7
+40,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
test "it returns sharedInbox for messages involving as:Public in cc" do
user =
insert(:user, %{
test "it returns sharedInbox for messages involving as:Public in cc" do
user =
insert(:user, %{
-
info: %{source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
}}
+
source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"
}}
})
activity = %Activity{
})
activity = %Activity{
@@
-52,7
+53,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
test "it returns sharedInbox for messages involving multiple recipients in to" do
user =
insert(:user, %{
test "it returns sharedInbox for messages involving multiple recipients in to" do
user =
insert(:user, %{
-
info: %{source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
}}
+
source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"
}}
})
user_two = insert(:user)
})
user_two = insert(:user)
@@
-68,7
+69,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
test "it returns sharedInbox for messages involving multiple recipients in cc" do
user =
insert(:user, %{
test "it returns sharedInbox for messages involving multiple recipients in cc" do
user =
insert(:user, %{
-
info: %{source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
}}
+
source_data: %{"endpoints" => %{"sharedInbox" => "http://example.com/inbox"
}}
})
user_two = insert(:user)
})
user_two = insert(:user)
@@
-83,14
+84,12
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
test "it returns sharedInbox for messages involving multiple recipients in total" do
user =
test "it returns sharedInbox for messages involving multiple recipients in total" do
user =
- insert(:user, %{
- info: %{
- source_data: %{
- "inbox" => "http://example.com/personal-inbox",
- "endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
- }
+ insert(:user,
+ source_data: %{
+ "inbox" => "http://example.com/personal-inbox",
+ "endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
}
}
-
}
)
+ )
user_two = insert(:user)
user_two = insert(:user)
@@
-103,14
+102,12
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
test "it returns inbox for messages involving single recipients in total" do
user =
test "it returns inbox for messages involving single recipients in total" do
user =
- insert(:user, %{
- info: %{
- source_data: %{
- "inbox" => "http://example.com/personal-inbox",
- "endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
- }
+ insert(:user,
+ source_data: %{
+ "inbox" => "http://example.com/personal-inbox",
+ "endpoints" => %{"sharedInbox" => "http://example.com/inbox"}
}
}
-
}
)
+ )
activity = %Activity{
data: %{"to" => [user.ap_id], "cc" => []}
activity = %Activity{
data: %{"to" => [user.ap_id], "cc" => []}
@@
-190,7
+187,10
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
actor = insert(:user)
inbox = "http://connrefused.site/users/nick1/inbox"
actor = insert(:user)
inbox = "http://connrefused.site/users/nick1/inbox"
- assert {:error, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
+ assert capture_log(fn ->
+ assert {:error, _} =
+ Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
+ end) =~ "connrefused"
assert called(Instances.set_unreachable(inbox))
end
assert called(Instances.set_unreachable(inbox))
end
@@
-214,14
+214,16
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
actor = insert(:user)
inbox = "http://connrefused.site/users/nick1/inbox"
actor = insert(:user)
inbox = "http://connrefused.site/users/nick1/inbox"
- assert {:error, _} =
- Publisher.publish_one(%{
- inbox: inbox,
- json: "{}",
- actor: actor,
- id: 1,
- unreachable_since: NaiveDateTime.utc_now()
- })
+ assert capture_log(fn ->
+ assert {:error, _} =
+ Publisher.publish_one(%{
+ inbox: inbox,
+ json: "{}",
+ actor: actor,
+ id: 1,
+ unreachable_since: NaiveDateTime.utc_now()
+ })
+ end) =~ "connrefused"
refute called(Instances.set_unreachable(inbox))
end
refute called(Instances.set_unreachable(inbox))
end
@@
-235,10
+237,8
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
follower =
insert(:user,
local: false,
follower =
insert(:user,
local: false,
- info: %{
- ap_enabled: true,
- source_data: %{"inbox" => "https://domain.com/users/nick1/inbox"}
- }
+ source_data: %{"inbox" => "https://domain.com/users/nick1/inbox"},
+ ap_enabled: true
)
actor = insert(:user, follower_address: follower.ap_id)
)
actor = insert(:user, follower_address: follower.ap_id)
@@
-259,7
+259,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
- actor
: actor
,
+ actor
_id: actor.id
,
id: note_activity.data["id"]
})
)
id: note_activity.data["id"]
})
)
@@
-272,19
+272,15
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
fetcher =
insert(:user,
local: false,
fetcher =
insert(:user,
local: false,
- info: %{
- ap_enabled: true,
- source_data: %{"inbox" => "https://domain.com/users/nick1/inbox"}
- }
+ source_data: %{"inbox" => "https://domain.com/users/nick1/inbox"},
+ ap_enabled: true
)
another_fetcher =
insert(:user,
local: false,
)
another_fetcher =
insert(:user,
local: false,
- info: %{
- ap_enabled: true,
- source_data: %{"inbox" => "https://domain2.com/users/nick1/inbox"}
- }
+ source_data: %{"inbox" => "https://domain2.com/users/nick1/inbox"},
+ ap_enabled: true
)
actor = insert(:user)
)
actor = insert(:user)
@@
-315,7
+311,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
- actor
: actor
,
+ actor
_id: actor.id
,
id: delete.data["id"]
})
)
id: delete.data["id"]
})
)
@@
-323,7
+319,7
@@
defmodule Pleroma.Web.ActivityPub.PublisherTest do
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain2.com/users/nick1/inbox",
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain2.com/users/nick1/inbox",
- actor
: actor
,
+ actor
_id: actor.id
,
id: delete.data["id"]
})
)
id: delete.data["id"]
})
)