Fix tests
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
d1472d94de
commit
273c98cfdf
@ -111,7 +111,6 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do
|
||||
|
||||
describe "handle incoming updates activities for group posts" do
|
||||
test "it works for incoming update activities on group posts when remote actor is a moderator" do
|
||||
use_cassette "activity_pub/group_post_update_activities" do
|
||||
%Actor{url: remote_actor_url} =
|
||||
remote_actor =
|
||||
insert(:actor,
|
||||
@ -139,8 +138,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do
|
||||
|> Map.put("actor", remote_actor_url)
|
||||
|> Map.put("object", object)
|
||||
|
||||
{:ok, %Activity{data: data, local: false}, _} =
|
||||
Transmogrifier.handle_incoming(update_data)
|
||||
{:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(update_data)
|
||||
|
||||
%Post{id: updated_post_id, title: updated_post_title} =
|
||||
Posts.get_post_by_url(data["object"]["id"])
|
||||
@ -148,10 +146,8 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do
|
||||
assert updated_post_id == post.id
|
||||
assert updated_post_title == "My updated post"
|
||||
end
|
||||
end
|
||||
|
||||
test "it works for incoming update activities on group posts" do
|
||||
use_cassette "activity_pub/group_post_update_activities" do
|
||||
%Actor{url: remote_actor_url} =
|
||||
remote_actor =
|
||||
insert(:actor,
|
||||
@ -186,10 +182,8 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do
|
||||
assert updated_post_id == post.id
|
||||
refute updated_post_title == "My updated post"
|
||||
end
|
||||
end
|
||||
|
||||
test "it fails for incoming update activities on group posts when the actor is not a member from the group" do
|
||||
use_cassette "activity_pub/group_post_update_activities" do
|
||||
%Actor{url: remote_actor_url} =
|
||||
insert(:actor,
|
||||
domain: "remote.domain",
|
||||
@ -223,5 +217,4 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do
|
||||
refute updated_post_title == "My updated post"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,24 +0,0 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.social/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"PostalAddress\":\"sc:PostalAddress\",\"address\":{\"@id\":\"sc:address\",\"@type\":\"sc:PostalAddress\"},\"addressCountry\":\"sc:addressCountry\",\"addressLocality\":\"sc:addressLocality\",\"addressRegion\":\"sc:addressRegion\",\"anonymousParticipationEnabled\":{\"@id\":\"mz:anonymousParticipationEnabled\",\"@type\":\"sc:Boolean\"},\"category\":\"sc:category\",\"commentsEnabled\":{\"@id\":\"pt:commentsEnabled\",\"@type\":\"sc:Boolean\"},\"discoverable\":\"toot:discoverable\",\"ical\":\"http://www.w3.org/2002/12/cal/ical#\",\"joinMode\":{\"@id\":\"mz:joinMode\",\"@type\":\"mz:joinModeType\"},\"joinModeType\":{\"@id\":\"mz:joinModeType\",\"@type\":\"rdfs:Class\"},\"location\":{\"@id\":\"sc:location\",\"@type\":\"sc:Place\"},\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"maximumAttendeeCapacity\":\"sc:maximumAttendeeCapacity\",\"mz\":\"https://joinmobilizon.org/ns#\",\"participationMessage\":{\"@id\":\"mz:participationMessage\",\"@type\":\"sc:Text\"},\"postalCode\":\"sc:postalCode\",\"pt\":\"https://joinpeertube.org/ns#\",\"repliesModerationOption\":{\"@id\":\"mz:repliesModerationOption\",\"@type\":\"mz:repliesModerationOptionType\"},\"repliesModerationOptionType\":{\"@id\":\"mz:repliesModerationOptionType\",\"@type\":\"rdfs:Class\"},\"sc\":\"http://schema.org#\",\"streetAddress\":\"sc:streetAddress\",\"toot\":\"http://joinmastodon.org/ns#\",\"uuid\":\"sc:identifier\"}],\"actor\":\"http://mobilizon.test/@myGroup0\",\"cc\":[],\"id\":\"http://mobilizon.test/announces/839e0ffc-f437-48db-afba-9ce1e971e938\",\"object\":{\"actor\":\"http://mobilizon.test/@thomas0\",\"attributedTo\":\"http://mobilizon.test/@myGroup0\",\"content\":\"The <b>HTML</b>body for my Article\",\"id\":\"http://mobilizon.test/p/6a482d5f-94fc-446b-84bb-d4d386d5dd45\",\"name\":\"My updated post\",\"published\":\"2020-10-19T08:37:52Z\",\"type\":\"Article\"},\"to\":[\"http://mobilizon.test/@myGroup0/members\"],\"type\":\"Announce\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/activity+json",
|
||||
"signature": "keyId=\"http://mobilizon.test/@myGroup0#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"P+7rSSUeUBdX74wbvSEe4roG7yh7MfpF6s4tjv5q1kbeVKtXZRyfC1LqgVNCADZYXFqYlMvfF7DiaRQRiMznGWawM/QXK08eXiAVihYK28Pa56BfI68OUakd+FptlwfB4WJ4Jc7xi1z+iarv+EvlFxjkG5pgwL4mW49rvNnigELzypGtp2bj/2BhiBItHutvOju1MwLR1EBQFJBSZDVZZKbHTcV4KbGtbYvkWUbH8fZbe3fgctKlvO/z9kw+yBTTIEE1O18F4HiJ17nYtaaxv3/vl5RxcjYLpf+QQzkaPOsSLZs8zpIZZp3BbLtPh+OGwkyK9PBQsaI0N1ZSLQ5gaQ==\"",
|
||||
"digest": "SHA-256=EyZ+uZ/Vv2lUK8ozgOHBpnoUWUM5WQHATQb1tEMldNU=",
|
||||
"date": "Mon, 19 Oct 2020 08:37:52 GMT"
|
||||
},
|
||||
"method": "post",
|
||||
"options": [],
|
||||
"request_body": "",
|
||||
"url": "http://mobilizon.test/inbox"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "nxdomain",
|
||||
"headers": [],
|
||||
"status_code": null,
|
||||
"type": "error"
|
||||
}
|
||||
}
|
||||
]
|
@ -374,6 +374,7 @@ defmodule Mobilizon.Factory do
|
||||
tags: build_list(3, :tag),
|
||||
visibility: :public,
|
||||
publish_at: DateTime.utc_now(),
|
||||
picture: insert(:media),
|
||||
media: [],
|
||||
url: Routes.page_url(Endpoint, :post, uuid)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user