forked from AkkomaGang/akkoma
Merge branch '1020-honk-announces' into 'develop'
Transmogrifier: Add tests for certain announces Closes #1020 See merge request pleroma/pleroma!2516
This commit is contained in:
commit
be5d0a9bde
2 changed files with 45 additions and 0 deletions
|
@ -260,6 +260,24 @@ test "it works for incoming notices with to/cc not being an array (kroeg)" do
|
||||||
"<p>henlo from my Psion netBook</p><p>message sent from my Psion netBook</p>"
|
"<p>henlo from my Psion netBook</p><p>message sent from my Psion netBook</p>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it works for incoming honk announces" do
|
||||||
|
_user = insert(:user, ap_id: "https://honktest/u/test", local: false)
|
||||||
|
other_user = insert(:user)
|
||||||
|
{:ok, post} = CommonAPI.post(other_user, %{"status" => "bonkeronk"})
|
||||||
|
|
||||||
|
announce = %{
|
||||||
|
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||||
|
"actor" => "https://honktest/u/test",
|
||||||
|
"id" => "https://honktest/u/test/bonk/1793M7B9MQ48847vdx",
|
||||||
|
"object" => post.data["object"],
|
||||||
|
"published" => "2019-06-25T19:33:58Z",
|
||||||
|
"to" => "https://www.w3.org/ns/activitystreams#Public",
|
||||||
|
"type" => "Announce"
|
||||||
|
}
|
||||||
|
|
||||||
|
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(announce)
|
||||||
|
end
|
||||||
|
|
||||||
test "it works for incoming announces with actor being inlined (kroeg)" do
|
test "it works for incoming announces with actor being inlined (kroeg)" do
|
||||||
data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Poison.decode!()
|
data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Poison.decode!()
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,33 @@ test "if user is authenticated", %{local: local, remote: remote} do
|
||||||
describe "user timelines" do
|
describe "user timelines" do
|
||||||
setup do: oauth_access(["read:statuses"])
|
setup do: oauth_access(["read:statuses"])
|
||||||
|
|
||||||
|
test "works with announces that are just addressed to public", %{conn: conn} do
|
||||||
|
user = insert(:user, ap_id: "https://honktest/u/test", local: false)
|
||||||
|
other_user = insert(:user)
|
||||||
|
|
||||||
|
{:ok, post} = CommonAPI.post(other_user, %{"status" => "bonkeronk"})
|
||||||
|
|
||||||
|
{:ok, announce, _} =
|
||||||
|
%{
|
||||||
|
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||||
|
"actor" => "https://honktest/u/test",
|
||||||
|
"id" => "https://honktest/u/test/bonk/1793M7B9MQ48847vdx",
|
||||||
|
"object" => post.data["object"],
|
||||||
|
"published" => "2019-06-25T19:33:58Z",
|
||||||
|
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
|
"type" => "Announce"
|
||||||
|
}
|
||||||
|
|> ActivityPub.persist(local: false)
|
||||||
|
|
||||||
|
assert resp =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/accounts/#{user.id}/statuses")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert [%{"id" => id}] = resp
|
||||||
|
assert id == announce.id
|
||||||
|
end
|
||||||
|
|
||||||
test "respects blocks", %{user: user_one, conn: conn} do
|
test "respects blocks", %{user: user_one, conn: conn} do
|
||||||
user_two = insert(:user)
|
user_two = insert(:user)
|
||||||
user_three = insert(:user)
|
user_three = insert(:user)
|
||||||
|
|
Loading…
Reference in a new issue