diff --git a/test/fixtures/mobilizon-post-activity.json b/test/fixtures/mobilizon-post-activity.json index bbd990b70..21a9ef442 100644 --- a/test/fixtures/mobilizon-post-activity.json +++ b/test/fixtures/mobilizon-post-activity.json @@ -11,15 +11,15 @@ "uuid": "sc:identifier" } ], - "actor": "https://event1.tcit.fr/@tcit", + "actor": "https://test.mobilizon.org/@Alicia", "cc": [ "https://framapiaf.org/users/admin/followers", "https://framapiaf.org/users/tcit" ], - "id": "https://event1.tcit.fr/@tcit/events/109ccdfd-ee3e-46e1-a877-6c228763df0c/activity", + "id": "https://test.mobilizon.org/events/39026210-0c69-4238-b3cc-986f33f98ed0/activity", "object": { "attachment": [], - "attributedTo": "https://event1.tcit.fr/@tcit", + "attributedTo": "https://test.mobilizon.org/@Alicia", "startTime": "2018-02-12T14:08:20Z", "cc": [ "https://framapiaf.org/users/admin/followers", @@ -27,7 +27,7 @@ ], "content": "

@tcit

", "category": "TODO remove me", - "id": "https://event1.tcit.fr/@tcit/events/109ccdfd-ee3e-46e1-a877-6c228763df0c", + "id": "https://test.mobilizon.org/events/39026210-0c69-4238-b3cc-986f33f98ed0", "inReplyTo": null, "location": { "type": "Place", @@ -55,7 +55,7 @@ "https://www.w3.org/ns/activitystreams#Public" ], "type": "Event", - "url": "https://event1.tcit.fr/@tcit/events/109ccdfd-ee3e-46e1-a877-6c228763df0c", + "url": "https://test.mobilizon.org/events/39026210-0c69-4238-b3cc-986f33f98ed0", "uuid": "109ccdfd-ee3e-46e1-a877-6c228763df0c" }, "published": "2018-02-12T14:08:20Z", diff --git a/test/fixtures/vcr_cassettes/activity_pub/event_update_activities.json b/test/fixtures/vcr_cassettes/activity_pub/event_update_activities.json new file mode 100644 index 000000000..20fbdb575 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/event_update_activities.json @@ -0,0 +1,36 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://test.mobilizon.org/@Alicia" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.github.io/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"endpoints\":{\"sharedInbox\":\"https://test.mobilizon.org/inbox\"},\"followers\":\"https://test.mobilizon.org/@Alicia/followers\",\"following\":\"https://test.mobilizon.org/@Alicia/following\",\"id\":\"https://test.mobilizon.org/@Alicia\",\"inbox\":\"https://test.mobilizon.org/@Alicia/inbox\",\"manuallyApprovesFollowers\":false,\"name\":\"Alicia\",\"outbox\":\"https://test.mobilizon.org/@Alicia/outbox\",\"preferredUsername\":\"Alicia\",\"publicKey\":{\"id\":\"https://test.mobilizon.org/@Alicia#main-key\",\"owner\":\"https://test.mobilizon.org/@Alicia\",\"publicKeyPem\":\"-----BEGIN RSA PUBLIC KEY-----\\nMIIBCgKCAQEAvb+emDoC6FCVpfo9Bh608sVsOK+8fun3UIqaR+jr+DZCAjp8ihwa\\nFkXaeOQ744MVS2YdzBEyIlk3sSYD9GezF+zoMbbA8FcnJ5jZhnneRR7ZrEg/cpNx\\nKFVA2ZoQrAABwpnA1iv7ciLoYZKPTDpIZ7Ue5l/k1bYcfTy0d4F3c8YAayWftSWj\\nHy3FK2kZDLdKfpRyfn5a4UI6sao4uD/rHno47g8tPPVA74BBpaTntJfbTWqiR8Vn\\nmNGAzy3+47pVeeg6Rd+AALohzBpHPW3TlJ75mqxPDXk7aDRYXihHrswf4MmKuaXc\\nXdoCu6uxQp41Xf3jVYD+AWw60tv2Oj/d4wIDAQAB\\n-----END RSA PUBLIC KEY-----\\n\\n\"},\"summary\":\"J'aime le karaté, les mangas, coder en python.\",\"type\":\"Person\",\"url\":\"https://test.mobilizon.org/@Alicia\"}", + "headers": { + "Server": "nginx/1.14.2", + "Date": "Sun, 17 Nov 2019 18:12:35 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Content-Length": "1293", + "Connection": "keep-alive", + "access-control-allow-credentials": "true", + "access-control-allow-origin": "*", + "access-control-expose-headers": "", + "cache-control": "max-age=0, private, must-revalidate", + "x-request-id": "FdgFt2eS9ln4-7YACVtC", + "Strict-Transport-Security": "max-age=63072000; includeSubDomains", + "X-Content-Type-Options": "nosniff" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/fetch_mobilizon_post_activity.json b/test/fixtures/vcr_cassettes/activity_pub/fetch_mobilizon_post_activity.json new file mode 100644 index 000000000..051ac17b6 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/fetch_mobilizon_post_activity.json @@ -0,0 +1,36 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://test.mobilizon.org/@Alicia" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.github.io/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"endpoints\":{\"sharedInbox\":\"https://test.mobilizon.org/inbox\"},\"followers\":\"https://test.mobilizon.org/@Alicia/followers\",\"following\":\"https://test.mobilizon.org/@Alicia/following\",\"id\":\"https://test.mobilizon.org/@Alicia\",\"inbox\":\"https://test.mobilizon.org/@Alicia/inbox\",\"manuallyApprovesFollowers\":false,\"name\":\"Alicia\",\"outbox\":\"https://test.mobilizon.org/@Alicia/outbox\",\"preferredUsername\":\"Alicia\",\"publicKey\":{\"id\":\"https://test.mobilizon.org/@Alicia#main-key\",\"owner\":\"https://test.mobilizon.org/@Alicia\",\"publicKeyPem\":\"-----BEGIN RSA PUBLIC KEY-----\\nMIIBCgKCAQEAvb+emDoC6FCVpfo9Bh608sVsOK+8fun3UIqaR+jr+DZCAjp8ihwa\\nFkXaeOQ744MVS2YdzBEyIlk3sSYD9GezF+zoMbbA8FcnJ5jZhnneRR7ZrEg/cpNx\\nKFVA2ZoQrAABwpnA1iv7ciLoYZKPTDpIZ7Ue5l/k1bYcfTy0d4F3c8YAayWftSWj\\nHy3FK2kZDLdKfpRyfn5a4UI6sao4uD/rHno47g8tPPVA74BBpaTntJfbTWqiR8Vn\\nmNGAzy3+47pVeeg6Rd+AALohzBpHPW3TlJ75mqxPDXk7aDRYXihHrswf4MmKuaXc\\nXdoCu6uxQp41Xf3jVYD+AWw60tv2Oj/d4wIDAQAB\\n-----END RSA PUBLIC KEY-----\\n\\n\"},\"summary\":\"J'aime le karaté, les mangas, coder en python.\",\"type\":\"Person\",\"url\":\"https://test.mobilizon.org/@Alicia\"}", + "headers": { + "Server": "nginx/1.14.2", + "Date": "Sun, 17 Nov 2019 18:00:51 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Content-Length": "1293", + "Connection": "keep-alive", + "access-control-allow-credentials": "true", + "access-control-allow-origin": "*", + "access-control-expose-headers": "", + "cache-control": "max-age=0, private, must-revalidate", + "x-request-id": "FdgFE5DoOmZXNz8ACVni", + "Strict-Transport-Security": "max-age=63072000; includeSubDomains", + "X-Content-Type-Options": "nosniff" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/mastodon_activity_hashtag.json b/test/fixtures/vcr_cassettes/activity_pub/mastodon_activity_hashtag.json new file mode 100644 index 000000000..4f8f69059 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/mastodon_activity_hashtag.json @@ -0,0 +1,78 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/admin" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Service\",\"following\":\"https://framapiaf.org/users/admin/following\",\"followers\":\"https://framapiaf.org/users/admin/followers\",\"inbox\":\"https://framapiaf.org/users/admin/inbox\",\"outbox\":\"https://framapiaf.org/users/admin/outbox\",\"featured\":\"https://framapiaf.org/users/admin/collections/featured\",\"preferredUsername\":\"admin\",\"name\":\"Administrateur\",\"summary\":\"\\u003cp\\u003eJe ne suis qu\\u0026apos;un compte inutile. Merci nous de contacter via \\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"discoverable\":null,\"publicKey\":{\"id\":\"https://framapiaf.org/users/admin#main-key\",\"owner\":\"https://framapiaf.org/users/admin\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyHaU/AZ5dWtSxZXkPa89\\nDUQ4z+JQHGGUG/xkGuq0v8P6qJfQqtHPBO5vH0IQJqluXWQS96gqTwjZnYevcpNA\\nveYv0K25DWszx5Ehz6JX2/sSvu2rNUcQ3YZvSjdo/Yy1u5Fuc5lLmvw8uFzXYekD\\nWovTMOnp4mIKpVEm/G/v4w8jvFEKw88h743vwaEIim88GEQItMxzGAV6zSqV1DWO\\nLxtoRsinslJYfAG46ex4YUATFveWvOUeWk5W1sEa5f3c0moaTmBM/PAAo8vLxhlw\\nJhsHihsCH+BcXKVMjW8OCqYYqISMxEifUBX63HcJt78ELHpOuc1c2eG59PomtTjQ\\nywIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"News\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Support\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:06:58 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"773e09a2a60446fe74d997858877f7e0\"", + "Set-Cookie": "_mastodon_session=CKtWGZYWl4vVfXZbzKqloeppXKqSHbWZD11101lpU2w8P7rAJSyeO8f29%2BcZRXnQDyqRpH4cS2ykUv5S0upK--8Minoa5pDpPskCqZ--a3Mi5V8CIM8%2BzUAPf3HejA%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "ba12e99c-14ff-4f26-b5d3-8d17ab01f907", + "X-Runtime": "0.027171", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/tcit" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/tcit\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/tcit/following\",\"followers\":\"https://framapiaf.org/users/tcit/followers\",\"inbox\":\"https://framapiaf.org/users/tcit/inbox\",\"outbox\":\"https://framapiaf.org/users/tcit/outbox\",\"featured\":\"https://framapiaf.org/users/tcit/collections/featured\",\"preferredUsername\":\"tcit\",\"name\":\"💼 Thomas Citharel (Work)\",\"summary\":\"\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Framasoft\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/FreeSoftware\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFreeSoftware\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Activism\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eActivism\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/wallabag\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003ewallabag\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Federation\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFederation\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Nextcloud\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eNextcloud\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Mobilizon\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eMobilizon\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Libre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eLibre\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@tcit\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/tcit#main-key\",\"owner\":\"https://framapiaf.org/users/tcit\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApscVCt06lrIiB5jT6Kqk\\nZZwPVoPkhR7HzoTGb8rnklZuOyP4goHIuBDnurklztkmDCaM7DbsUWAPgRVtwWFE\\nWuQrOenb7BPRe/m99pJfUTkBQU3IeuRMD/5Fc3OTIhHQOltTSiB900srCUxjysfw\\nnV5JFciCz8YAXTNJZD34qyv8DbtC/pCJM7wMd9Hl3ohxSPETa6CJUaTdlNwlYJa2\\nMOMCj6/7Iv5oAg14FT9lwqS5lF7jPHk9Z7PNc2wPmNVgIYA2n9d5k7JY8TdM8iu4\\nHLnIbJuqDd1uitlYgy1qsdsxjv4U2Y7Nytc+3ZKHtGsCzUltYL5kC7uWrFpGoWo1\\n0QIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/activism\",\"name\":\"#activism\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/federation\",\"name\":\"#federation\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/framasoft\",\"name\":\"#framasoft\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/freesoftware\",\"name\":\"#freesoftware\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/libre\",\"name\":\"#libre\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/mobilizon\",\"name\":\"#mobilizon\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/nextcloud\",\"name\":\"#nextcloud\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/wallabag\",\"name\":\"#wallabag\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Personal account\",\"value\":\"\\u003ca href=\\\"https://social.tcit.fr/@tcit\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esocial.tcit.fr/@tcit\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Location\",\"value\":\"Nantes, France\"},{\"type\":\"PropertyValue\",\"name\":\"Works at\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Website\",\"value\":\"\\u003ca href=\\\"https://tcit.fr\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etcit.fr\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"IdentityProof\",\"name\":\"tcit\",\"signatureAlgorithm\":\"keybase\",\"signatureValue\":\"f66b45be42803010fe2f4d80e729b41bbe5ed056e2ff1286b7b5a5ea9c724cc70f\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/001/original/da0cad7ffd20eb61.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/001/original/198d058b3086d82d.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:06:58 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"11665b12333a8c7708de7b17f58147b2\"", + "Set-Cookie": "_mastodon_session=Y5%2BTYemXd6V60bDdmZ0yVDccNkpEclesSqSGiWvBcjjwkg54dFqlorvZd4qAcPBQ9sV%2FkmZCl9sTNo2JObDt--NIGkxxOf2zlZTjFI--7XfcLTp268uldNzVRElWOg%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "3fb7c3bb-20bb-4e00-b20e-7e26165870ed", + "X-Runtime": "0.011068", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/mastodon_announce_activity.json b/test/fixtures/vcr_cassettes/activity_pub/mastodon_announce_activity.json new file mode 100644 index 000000000..f42a270b4 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/mastodon_announce_activity.json @@ -0,0 +1,118 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/Framasoft" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/Framasoft\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/Framasoft/following\",\"followers\":\"https://framapiaf.org/users/Framasoft/followers\",\"inbox\":\"https://framapiaf.org/users/Framasoft/inbox\",\"outbox\":\"https://framapiaf.org/users/Framasoft/outbox\",\"featured\":\"https://framapiaf.org/users/Framasoft/collections/featured\",\"preferredUsername\":\"Framasoft\",\"name\":\"Framasoft\",\"summary\":\"\\u003cp\\u003eLa route est longue mais la voie est libre…\\u003c/p\\u003e\\u003cp\\u003eBesoin d\\u0026apos;aide ? \\u003ca href=\\\"https://contact.framasoft.org\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e /!\\\\ Pas de support sur Mastodon /!\\\\\\u003c/p\\u003e\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Framasoft\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Libre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eLibre\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@Framasoft\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/Framasoft#main-key\",\"owner\":\"https://framapiaf.org/users/Framasoft\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0SgyiKbsNd0adHldDHiw\\nCotPzipq0QMrBgvmapnME8obZvrJWTF+imihNBH/DBemQqRb0ABilWvs0hluWCHl\\nouCi4SnlUljjpp2nmMTFUMPeF/GQByZS4ZPmnipgG+/uqkWL0U/206r//6agvw2s\\nmRcuVwo1xR4MZshxdtqXm/Wg9zavDSMLf/66VevieWvVy+5n0ZsqFAFuHrITgrgt\\n6wS8S3IT7de+7F28JeU/zmRFA3/3+IyWrpTx1CY4J+UM11mLbtpLWy3MCAMffchF\\nZh7TAiaJKAVMjT2Ubyr/1nNn9b4FORwOMIgWIGp5OAD1W/xVTW/rmqArAllgUMEW\\nvwIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/framasoft\",\"name\":\"#framasoft\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/libre\",\"name\":\"#libre\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Contact\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Découvrir\",\"value\":\"\\u003ca href=\\\"https://framasoft.org\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/399/original/aa56a445efb72803.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/399/original/94f271e4ef58fc79.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:08:40 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"244f2282ec9b1fac35b0381a673683da\"", + "Set-Cookie": "_mastodon_session=nDhrqshXpdzZbmrdaZlyZkoLdtCWwR7Fk5gfGmzbM6rYwIWLmolI6l4ZrZJ8u9LlxtTW2fKDCPSQb0n65eGZ--g9GiXhPk1UPHMvPK--vSrcr3WUxxUowT8mc86ZEg%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "df45f7aa-3018-4387-b75f-e3991eff34a5", + "X-Runtime": "0.004189", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true", + "recv_timeout": 20000, + "connect_timeout": 10000 + }, + "request_body": "", + "url": "https://framapiaf.org/users/Framasoft/statuses/102501959686438400" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",{\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"sensitive\":\"as:sensitive\",\"toot\":\"http://joinmastodon.org/ns#\",\"votersCount\":\"toot:votersCount\",\"blurhash\":\"toot:blurhash\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"Hashtag\":\"as:Hashtag\"}],\"id\":\"https://framapiaf.org/users/Framasoft/statuses/102501959686438400\",\"type\":\"Note\",\"summary\":null,\"inReplyTo\":null,\"published\":\"2019-07-25T11:56:21Z\",\"url\":\"https://framapiaf.org/@Framasoft/102501959686438400\",\"attributedTo\":\"https://framapiaf.org/users/Framasoft\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://framapiaf.org/users/Framasoft/followers\",\"https://framapiaf.org/users/tofeo\"],\"sensitive\":false,\"atomUri\":\"https://framapiaf.org/users/Framasoft/statuses/102501959686438400\",\"inReplyToAtomUri\":null,\"conversation\":\"tag:framapiaf.org,2019-07-25:objectId=20221279:objectType=Conversation\",\"content\":\"\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Hubzilla\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eHubzilla\\u003c/span\\u003e\\u003c/a\\u003e a été ajouté sur \\u003ca href=\\\"https://framapiaf.org/tags/Framalibre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramalibre\\u003c/span\\u003e\\u003c/a\\u003e ! Merci \\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@tofeo\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003etofeo\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e :wink: !\\u003c/p\\u003e\\u003cp\\u003eOn commence à avoir une belle page consacrée au \\u003ca href=\\\"https://framapiaf.org/tags/F%C3%A9diverse\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFédiverse\\u003c/span\\u003e\\u003c/a\\u003e : \\u003ca href=\\\"https://framalibre.org/tags/fediverse\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframalibre.org/tags/fediverse\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e Il manque encore votre logiciel fédéré préféré ? Vous pouvez l’ajouter !\\u003c/p\\u003e\",\"contentMap\":{\"fr\":\"\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Hubzilla\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eHubzilla\\u003c/span\\u003e\\u003c/a\\u003e a été ajouté sur \\u003ca href=\\\"https://framapiaf.org/tags/Framalibre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramalibre\\u003c/span\\u003e\\u003c/a\\u003e ! Merci \\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@tofeo\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003etofeo\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e :wink: !\\u003c/p\\u003e\\u003cp\\u003eOn commence à avoir une belle page consacrée au \\u003ca href=\\\"https://framapiaf.org/tags/F%C3%A9diverse\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFédiverse\\u003c/span\\u003e\\u003c/a\\u003e : \\u003ca href=\\\"https://framalibre.org/tags/fediverse\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframalibre.org/tags/fediverse\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e Il manque encore votre logiciel fédéré préféré ? Vous pouvez l’ajouter !\\u003c/p\\u003e\"},\"attachment\":[{\"type\":\"Document\",\"mediaType\":\"image/png\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/media_attachments/files/004/189/154/original/39b9b6cbe503fe46.png\",\"name\":null,\"blurhash\":\"U7Q]+xZ~xYMy9ZShNdWY?aRjRPad~qNHX8j?\"}],\"tag\":[{\"type\":\"Mention\",\"href\":\"https://framapiaf.org/users/tofeo\",\"name\":\"@tofeo\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/tags/hubzilla\",\"name\":\"#hubzilla\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/tags/framalibre\",\"name\":\"#framalibre\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/tags/f%C3%A9diverse\",\"name\":\"#fédiverse\"}],\"replies\":{\"id\":\"https://framapiaf.org/users/Framasoft/statuses/102501959686438400/replies\",\"type\":\"Collection\",\"first\":{\"type\":\"CollectionPage\",\"next\":\"https://framapiaf.org/users/Framasoft/statuses/102501959686438400/replies?only_other_accounts=true\\u0026page=true\",\"partOf\":\"https://framapiaf.org/users/Framasoft/statuses/102501959686438400/replies\",\"items\":[]}}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:08:41 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Link": "; rel=\"alternate\"; type=\"application/activity+json\"", + "Vary": "Accept,Accept-Encoding", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"8ad0a3c0db2302fb0586533aa119e14a\"", + "X-Request-Id": "e44554ac-2714-4ba6-a59f-4aba40758a8e", + "X-Runtime": "0.019506", + "X-Cached": "HIT", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/tofeo" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/tofeo\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/tofeo/following\",\"followers\":\"https://framapiaf.org/users/tofeo/followers\",\"inbox\":\"https://framapiaf.org/users/tofeo/inbox\",\"outbox\":\"https://framapiaf.org/users/tofeo/outbox\",\"featured\":\"https://framapiaf.org/users/tofeo/collections/featured\",\"preferredUsername\":\"tofeo\",\"name\":\"Toféo\",\"summary\":\"\\u003cp\\u003eDéveloppeur de l\\u0026apos;application \\u003ca href=\\\"https://framapiaf.org/tags/tasko\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003etasko\\u003c/span\\u003e\\u003c/a\\u003e Pour s\\u0026apos;entrainer à \\u003ca href=\\\"https://framapiaf.org/tags/codeigniter\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003ecodeigniter\\u003c/span\\u003e\\u003c/a\\u003e et à \\u003ca href=\\\"https://framapiaf.org/tags/bootstrap\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003ebootstrap\\u003c/span\\u003e\\u003c/a\\u003e et à \\u003ca href=\\\"https://framapiaf.org/tags/git\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003egit\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\\u003cp\\u003e \\u003cbr /\\u003edurée de conservation : 60 jours\\u003c/p\\u003e\\u003cp\\u003eCréation 2018-01-02\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@tofeo\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/tofeo#main-key\",\"owner\":\"https://framapiaf.org/users/tofeo\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqKooEuaouEfs5NEkt7y9\\ngsBFF8NRB3f6LltOe5KBMCXbTxWjWKdxGE5vIjD9A7a1v0X6/glqC0ELpeZVQ23x\\nmqWVub1r5y8vG1SPMucVUQovqZ1MpG4hlqTN+4IFOB/6K9N0bj4ApJRTh+ACCO9T\\nvW3nx1ATxyMK8SqGL9bYInjxxB1PpfC+hqli9DxJ71/LzUzpP4k8w8vGq07uJ631\\nKOFISNrMWqFSXoAgMUqBs/nJlbmmcZNgshz8qKJwTea80YAUO8CsXUWQWKAtixTG\\ndRmb84RLOWmNEDDVBrarQ0eYmPJgYdTgPKrx+13kXU8xD6G9KG6WPlhNLzbLkgt1\\nwQIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/tasko\",\"name\":\"#tasko\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/codeigniter\",\"name\":\"#codeigniter\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/bootstrap\",\"name\":\"#bootstrap\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/git\",\"name\":\"#git\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"http://tofeo.aga.ovh\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttp://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etofeo.aga.ovh\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"pixelfed\",\"value\":\"\\u003ca href=\\\"https://pix.diaspodon.fr/Tofeo\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003epix.diaspodon.fr/Tofeo\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Hubzilla\",\"value\":\"\\u003ca href=\\\"https://source-code.club/channel/tofeo\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esource-code.club/channel/tofeo\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Peertube\",\"value\":\"\\u003ca href=\\\"https://peertube.nogafa.org/accounts/tofeo/videos\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"ellipsis\\\"\\u003epeertube.nogafa.org/accounts/t\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003eofeo/videos\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/046/043/original/c769b5044db03309.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/png\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/046/043/original/33193ce2bc2777fe.png\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:08:41 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"38dd6bb2ec7bc7f8bdd3a0b81a0cdc16\"", + "Set-Cookie": "_mastodon_session=v8R%2BhzNZq3%2BWeFC4b%2BgTSla%2FC6bU0QxAF953rhsvQzglIjNhh8%2FojDKBbZ38D9IOqbMShUyNluHNBm%2B8UpKg--STtzbZSa%2FyjeNWoU--xU%2BLa8NwHl9d%2F04rBCSy5A%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "c91186f7-b827-427c-9fd1-6a0f67822e4a", + "X-Runtime": "0.010243", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/mastodon_announce_existing_activity.json b/test/fixtures/vcr_cassettes/activity_pub/mastodon_announce_existing_activity.json new file mode 100644 index 000000000..74397b4ed --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/mastodon_announce_existing_activity.json @@ -0,0 +1,40 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/Framasoft" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/Framasoft\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/Framasoft/following\",\"followers\":\"https://framapiaf.org/users/Framasoft/followers\",\"inbox\":\"https://framapiaf.org/users/Framasoft/inbox\",\"outbox\":\"https://framapiaf.org/users/Framasoft/outbox\",\"featured\":\"https://framapiaf.org/users/Framasoft/collections/featured\",\"preferredUsername\":\"Framasoft\",\"name\":\"Framasoft\",\"summary\":\"\\u003cp\\u003eLa route est longue mais la voie est libre…\\u003c/p\\u003e\\u003cp\\u003eBesoin d\\u0026apos;aide ? \\u003ca href=\\\"https://contact.framasoft.org\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e /!\\\\ Pas de support sur Mastodon /!\\\\\\u003c/p\\u003e\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Framasoft\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Libre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eLibre\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@Framasoft\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/Framasoft#main-key\",\"owner\":\"https://framapiaf.org/users/Framasoft\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0SgyiKbsNd0adHldDHiw\\nCotPzipq0QMrBgvmapnME8obZvrJWTF+imihNBH/DBemQqRb0ABilWvs0hluWCHl\\nouCi4SnlUljjpp2nmMTFUMPeF/GQByZS4ZPmnipgG+/uqkWL0U/206r//6agvw2s\\nmRcuVwo1xR4MZshxdtqXm/Wg9zavDSMLf/66VevieWvVy+5n0ZsqFAFuHrITgrgt\\n6wS8S3IT7de+7F28JeU/zmRFA3/3+IyWrpTx1CY4J+UM11mLbtpLWy3MCAMffchF\\nZh7TAiaJKAVMjT2Ubyr/1nNn9b4FORwOMIgWIGp5OAD1W/xVTW/rmqArAllgUMEW\\nvwIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/framasoft\",\"name\":\"#framasoft\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/libre\",\"name\":\"#libre\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Contact\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Découvrir\",\"value\":\"\\u003ca href=\\\"https://framasoft.org\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/399/original/aa56a445efb72803.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/399/original/94f271e4ef58fc79.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:09:47 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"244f2282ec9b1fac35b0381a673683da\"", + "Set-Cookie": "_mastodon_session=oLAzClz16WslSvWV2DqKE3h8nqfOVIFGE27%2BX5Ih6yqrChtwZCJVz3BghIcYTpBMOU467Or8nJZO2yPLkQPh--iCbklHRx4hwRBwGH--iLFXW%2B3UtBr28kV8Lfuk5A%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "9ee29645-1f25-479e-8db5-bc90d7b31f4c", + "X-Runtime": "0.028450", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/mastodon_follow_activity.json b/test/fixtures/vcr_cassettes/activity_pub/mastodon_follow_activity.json new file mode 100644 index 000000000..45c0e69c5 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/mastodon_follow_activity.json @@ -0,0 +1,42 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://social.tcit.fr/users/tcit" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://social.tcit.fr/users/tcit\",\"type\":\"Person\",\"following\":\"https://social.tcit.fr/users/tcit/following\",\"followers\":\"https://social.tcit.fr/users/tcit/followers\",\"inbox\":\"https://social.tcit.fr/users/tcit/inbox\",\"outbox\":\"https://social.tcit.fr/users/tcit/outbox\",\"featured\":\"https://social.tcit.fr/users/tcit/collections/featured\",\"preferredUsername\":\"tcit\",\"name\":\"🦄 Thomas Citharel\",\"summary\":\"\\u003cp\\u003eHoping to make people\\u0026apos;s life better with free software at \\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e.\\u003c/p\\u003e\",\"url\":\"https://social.tcit.fr/@tcit\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://social.tcit.fr/users/tcit#main-key\",\"owner\":\"https://social.tcit.fr/users/tcit\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApXwYMUdFg3XUd+bGsh8C\\nyiMRGpRGAWuCdM5pDWx5uM4pW2pM3xbHbcI21j9h8BmlAiPg6hbZD73KGly2N8Rt\\n5iIS0I+l6i8kA1JCCdlAaDTRd41RKMggZDoQvjVZQtsyE1VzMeU2kbqqTFN6ew7H\\nvbd6O0NhixoKoZ5f3jwuBDZoT0p1TAcaMdmG8oqHD97isizkDnRn8cOBA6wtI+xb\\n5xP2zxZMsLpTDZLiKU8XcPKZCw4OfQfmDmKkHtrFb77jCAQj/s/FxjVnvxRwmfhN\\nnWy0D+LUV/g63nHh/b5zXIeV92QZLvDYbgbezmzUzv9UeA1s70GGbaDqCIy85gw9\\n+wIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Works at\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Pronouns\",\"value\":\"He/Him\"},{\"type\":\"PropertyValue\",\"name\":\"Work Account\",\"value\":\"\\u003ca href=\\\"https://framapiaf.org/@tcit\\\" rel=\\\"me nofollow noopener noreferrer\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframapiaf.org/@tcit\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://tcit.fr\\\" rel=\\\"me nofollow noopener noreferrer\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etcit.fr\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://social.tcit.fr/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://media.social.tcit.fr/mastodontcit/accounts/avatars/000/000/001/original/a28c50ce5f2b13fd.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/png\",\"url\":\"https://media.social.tcit.fr/mastodontcit/accounts/headers/000/000/001/original/a3f3ec4f1b6f9f50.png\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:07:29 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "same-origin", + "Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload", + "X-Clacks-Overhead": "GNU Natalie Nguyen", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"ff1350ff75d62d3c2cb61a0119576ed0\"", + "Set-Cookie": "_mastodon_session=MLASVoTuayZJ50UdWnqLnyKTC4kLydS00RuPn%2BhopTFttZ8Gn3sZc0Tdwmg%2FXBVVC%2F6Pcx7giDvzLa33%2FMGb--WcnqF6HZMoKXoJt%2F--nhk%2FU6I%2FQhqd4yJI8o3oiQ%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "dee85282-f9d0-4c85-8d06-daa455eb2bfb", + "X-Runtime": "0.022962", + "X-Cached": "MISS" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/mastodon_post_activity.json b/test/fixtures/vcr_cassettes/activity_pub/mastodon_post_activity.json new file mode 100644 index 000000000..f8033adc2 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/mastodon_post_activity.json @@ -0,0 +1,78 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/admin" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Service\",\"following\":\"https://framapiaf.org/users/admin/following\",\"followers\":\"https://framapiaf.org/users/admin/followers\",\"inbox\":\"https://framapiaf.org/users/admin/inbox\",\"outbox\":\"https://framapiaf.org/users/admin/outbox\",\"featured\":\"https://framapiaf.org/users/admin/collections/featured\",\"preferredUsername\":\"admin\",\"name\":\"Administrateur\",\"summary\":\"\\u003cp\\u003eJe ne suis qu\\u0026apos;un compte inutile. Merci nous de contacter via \\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"discoverable\":null,\"publicKey\":{\"id\":\"https://framapiaf.org/users/admin#main-key\",\"owner\":\"https://framapiaf.org/users/admin\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyHaU/AZ5dWtSxZXkPa89\\nDUQ4z+JQHGGUG/xkGuq0v8P6qJfQqtHPBO5vH0IQJqluXWQS96gqTwjZnYevcpNA\\nveYv0K25DWszx5Ehz6JX2/sSvu2rNUcQ3YZvSjdo/Yy1u5Fuc5lLmvw8uFzXYekD\\nWovTMOnp4mIKpVEm/G/v4w8jvFEKw88h743vwaEIim88GEQItMxzGAV6zSqV1DWO\\nLxtoRsinslJYfAG46ex4YUATFveWvOUeWk5W1sEa5f3c0moaTmBM/PAAo8vLxhlw\\nJhsHihsCH+BcXKVMjW8OCqYYqISMxEifUBX63HcJt78ELHpOuc1c2eG59PomtTjQ\\nywIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"News\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Support\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:10:03 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"773e09a2a60446fe74d997858877f7e0\"", + "Set-Cookie": "_mastodon_session=6dcTP9h4RR4HqrIi0iJ2neQ19yBrfxhhZA%2BD1Fs5gfHj2u8htoiPXlYl6ESMDpV28pVxYLYk0q24%2Br1BmFKt--EtCG1U%2Bmr0sXq%2BtG--%2FYBrju1V6UmVKWc5ohy8iw%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "f3ebdac0-f5ab-4c59-87fd-4bea301eee2c", + "X-Runtime": "0.009815", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/tcit" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/tcit\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/tcit/following\",\"followers\":\"https://framapiaf.org/users/tcit/followers\",\"inbox\":\"https://framapiaf.org/users/tcit/inbox\",\"outbox\":\"https://framapiaf.org/users/tcit/outbox\",\"featured\":\"https://framapiaf.org/users/tcit/collections/featured\",\"preferredUsername\":\"tcit\",\"name\":\"💼 Thomas Citharel (Work)\",\"summary\":\"\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Framasoft\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/FreeSoftware\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFreeSoftware\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Activism\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eActivism\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/wallabag\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003ewallabag\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Federation\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFederation\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Nextcloud\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eNextcloud\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Mobilizon\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eMobilizon\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Libre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eLibre\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@tcit\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/tcit#main-key\",\"owner\":\"https://framapiaf.org/users/tcit\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApscVCt06lrIiB5jT6Kqk\\nZZwPVoPkhR7HzoTGb8rnklZuOyP4goHIuBDnurklztkmDCaM7DbsUWAPgRVtwWFE\\nWuQrOenb7BPRe/m99pJfUTkBQU3IeuRMD/5Fc3OTIhHQOltTSiB900srCUxjysfw\\nnV5JFciCz8YAXTNJZD34qyv8DbtC/pCJM7wMd9Hl3ohxSPETa6CJUaTdlNwlYJa2\\nMOMCj6/7Iv5oAg14FT9lwqS5lF7jPHk9Z7PNc2wPmNVgIYA2n9d5k7JY8TdM8iu4\\nHLnIbJuqDd1uitlYgy1qsdsxjv4U2Y7Nytc+3ZKHtGsCzUltYL5kC7uWrFpGoWo1\\n0QIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/activism\",\"name\":\"#activism\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/federation\",\"name\":\"#federation\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/framasoft\",\"name\":\"#framasoft\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/freesoftware\",\"name\":\"#freesoftware\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/libre\",\"name\":\"#libre\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/mobilizon\",\"name\":\"#mobilizon\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/nextcloud\",\"name\":\"#nextcloud\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/wallabag\",\"name\":\"#wallabag\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Personal account\",\"value\":\"\\u003ca href=\\\"https://social.tcit.fr/@tcit\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esocial.tcit.fr/@tcit\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Location\",\"value\":\"Nantes, France\"},{\"type\":\"PropertyValue\",\"name\":\"Works at\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Website\",\"value\":\"\\u003ca href=\\\"https://tcit.fr\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etcit.fr\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"IdentityProof\",\"name\":\"tcit\",\"signatureAlgorithm\":\"keybase\",\"signatureValue\":\"f66b45be42803010fe2f4d80e729b41bbe5ed056e2ff1286b7b5a5ea9c724cc70f\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/001/original/da0cad7ffd20eb61.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/001/original/198d058b3086d82d.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:10:03 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"11665b12333a8c7708de7b17f58147b2\"", + "Set-Cookie": "_mastodon_session=rPmuPnnGzAa%2BBZb0%2Bvt%2FRok4ydHD1Y9npqp1YgJk1H4JuqST21aIj3kEQjv1glh5wN8Su67CYlh5aWZgDKbU--J4qitcxHS2ZQzuHu--2WNpmCDTZOU1uA3YlOYESg%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "cae056e0-2661-4321-a541-0a3b6379db90", + "X-Runtime": "0.011647", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/mastodon_unannounce_activity.json b/test/fixtures/vcr_cassettes/activity_pub/mastodon_unannounce_activity.json new file mode 100644 index 000000000..08f4b08ba --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/mastodon_unannounce_activity.json @@ -0,0 +1,40 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/Framasoft" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/Framasoft\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/Framasoft/following\",\"followers\":\"https://framapiaf.org/users/Framasoft/followers\",\"inbox\":\"https://framapiaf.org/users/Framasoft/inbox\",\"outbox\":\"https://framapiaf.org/users/Framasoft/outbox\",\"featured\":\"https://framapiaf.org/users/Framasoft/collections/featured\",\"preferredUsername\":\"Framasoft\",\"name\":\"Framasoft\",\"summary\":\"\\u003cp\\u003eLa route est longue mais la voie est libre…\\u003c/p\\u003e\\u003cp\\u003eBesoin d\\u0026apos;aide ? \\u003ca href=\\\"https://contact.framasoft.org\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e /!\\\\ Pas de support sur Mastodon /!\\\\\\u003c/p\\u003e\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Framasoft\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Libre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eLibre\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@Framasoft\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/Framasoft#main-key\",\"owner\":\"https://framapiaf.org/users/Framasoft\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0SgyiKbsNd0adHldDHiw\\nCotPzipq0QMrBgvmapnME8obZvrJWTF+imihNBH/DBemQqRb0ABilWvs0hluWCHl\\nouCi4SnlUljjpp2nmMTFUMPeF/GQByZS4ZPmnipgG+/uqkWL0U/206r//6agvw2s\\nmRcuVwo1xR4MZshxdtqXm/Wg9zavDSMLf/66VevieWvVy+5n0ZsqFAFuHrITgrgt\\n6wS8S3IT7de+7F28JeU/zmRFA3/3+IyWrpTx1CY4J+UM11mLbtpLWy3MCAMffchF\\nZh7TAiaJKAVMjT2Ubyr/1nNn9b4FORwOMIgWIGp5OAD1W/xVTW/rmqArAllgUMEW\\nvwIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/framasoft\",\"name\":\"#framasoft\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/libre\",\"name\":\"#libre\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Contact\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Découvrir\",\"value\":\"\\u003ca href=\\\"https://framasoft.org\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/399/original/aa56a445efb72803.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/399/original/94f271e4ef58fc79.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:09:19 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"244f2282ec9b1fac35b0381a673683da\"", + "Set-Cookie": "_mastodon_session=qFu4eHpJm1RgLVk6TyzbLxfQXMGZFqkybY4uqQNKUSUWboKh0edWetZQgoSPIXzAwTTFICfkkEPIhpQ4HnJU--NF09knzR8oukiQAs--2ax%2FdfLh6pkUpm6WDtngbw%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "b121b7a6-423e-4378-97e0-e88a9a51928e", + "X-Runtime": "0.006326", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/unfollow_existing_follow_activity.json b/test/fixtures/vcr_cassettes/activity_pub/unfollow_existing_follow_activity.json new file mode 100644 index 000000000..041fb6361 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/unfollow_existing_follow_activity.json @@ -0,0 +1,42 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://social.tcit.fr/users/tcit" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://social.tcit.fr/users/tcit\",\"type\":\"Person\",\"following\":\"https://social.tcit.fr/users/tcit/following\",\"followers\":\"https://social.tcit.fr/users/tcit/followers\",\"inbox\":\"https://social.tcit.fr/users/tcit/inbox\",\"outbox\":\"https://social.tcit.fr/users/tcit/outbox\",\"featured\":\"https://social.tcit.fr/users/tcit/collections/featured\",\"preferredUsername\":\"tcit\",\"name\":\"🦄 Thomas Citharel\",\"summary\":\"\\u003cp\\u003eHoping to make people\\u0026apos;s life better with free software at \\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e.\\u003c/p\\u003e\",\"url\":\"https://social.tcit.fr/@tcit\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://social.tcit.fr/users/tcit#main-key\",\"owner\":\"https://social.tcit.fr/users/tcit\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApXwYMUdFg3XUd+bGsh8C\\nyiMRGpRGAWuCdM5pDWx5uM4pW2pM3xbHbcI21j9h8BmlAiPg6hbZD73KGly2N8Rt\\n5iIS0I+l6i8kA1JCCdlAaDTRd41RKMggZDoQvjVZQtsyE1VzMeU2kbqqTFN6ew7H\\nvbd6O0NhixoKoZ5f3jwuBDZoT0p1TAcaMdmG8oqHD97isizkDnRn8cOBA6wtI+xb\\n5xP2zxZMsLpTDZLiKU8XcPKZCw4OfQfmDmKkHtrFb77jCAQj/s/FxjVnvxRwmfhN\\nnWy0D+LUV/g63nHh/b5zXIeV92QZLvDYbgbezmzUzv9UeA1s70GGbaDqCIy85gw9\\n+wIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Works at\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Pronouns\",\"value\":\"He/Him\"},{\"type\":\"PropertyValue\",\"name\":\"Work Account\",\"value\":\"\\u003ca href=\\\"https://framapiaf.org/@tcit\\\" rel=\\\"me nofollow noopener noreferrer\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframapiaf.org/@tcit\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://tcit.fr\\\" rel=\\\"me nofollow noopener noreferrer\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etcit.fr\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://social.tcit.fr/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://media.social.tcit.fr/mastodontcit/accounts/avatars/000/000/001/original/a28c50ce5f2b13fd.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/png\",\"url\":\"https://media.social.tcit.fr/mastodontcit/accounts/headers/000/000/001/original/a3f3ec4f1b6f9f50.png\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:12:31 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "same-origin", + "Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload", + "X-Clacks-Overhead": "GNU Natalie Nguyen", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"ff1350ff75d62d3c2cb61a0119576ed0\"", + "Set-Cookie": "_mastodon_session=9eVpoF4UR66ZVzSZin58%2BNuKKLcWiF2icEY1gXXHm1nBjtugdp9H09CrYrAmpvni3ihTxnuUYTF%2BZxmdt%2FC4--ADVuJ0WvPj243aYT--rRarAcYF9GVTGqnDe7HBvg%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "16571166-5e85-4699-9c26-367f9035ea89", + "X-Runtime": "0.020868", + "X-Cached": "MISS" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/activity_pub/update_actor_activity.json b/test/fixtures/vcr_cassettes/activity_pub/update_actor_activity.json new file mode 100644 index 000000000..e000782a1 --- /dev/null +++ b/test/fixtures/vcr_cassettes/activity_pub/update_actor_activity.json @@ -0,0 +1,78 @@ +[ + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/admin" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Service\",\"following\":\"https://framapiaf.org/users/admin/following\",\"followers\":\"https://framapiaf.org/users/admin/followers\",\"inbox\":\"https://framapiaf.org/users/admin/inbox\",\"outbox\":\"https://framapiaf.org/users/admin/outbox\",\"featured\":\"https://framapiaf.org/users/admin/collections/featured\",\"preferredUsername\":\"admin\",\"name\":\"Administrateur\",\"summary\":\"\\u003cp\\u003eJe ne suis qu\\u0026apos;un compte inutile. Merci nous de contacter via \\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"discoverable\":null,\"publicKey\":{\"id\":\"https://framapiaf.org/users/admin#main-key\",\"owner\":\"https://framapiaf.org/users/admin\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyHaU/AZ5dWtSxZXkPa89\\nDUQ4z+JQHGGUG/xkGuq0v8P6qJfQqtHPBO5vH0IQJqluXWQS96gqTwjZnYevcpNA\\nveYv0K25DWszx5Ehz6JX2/sSvu2rNUcQ3YZvSjdo/Yy1u5Fuc5lLmvw8uFzXYekD\\nWovTMOnp4mIKpVEm/G/v4w8jvFEKw88h743vwaEIim88GEQItMxzGAV6zSqV1DWO\\nLxtoRsinslJYfAG46ex4YUATFveWvOUeWk5W1sEa5f3c0moaTmBM/PAAo8vLxhlw\\nJhsHihsCH+BcXKVMjW8OCqYYqISMxEifUBX63HcJt78ELHpOuc1c2eG59PomtTjQ\\nywIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"News\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Support\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:09:15 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"773e09a2a60446fe74d997858877f7e0\"", + "Set-Cookie": "_mastodon_session=p%2FAsJ26WkoKvURg5nN9Rh%2B1JffdgLb4saJVZ1tInotuWf%2FZCaizgu4SiFkj1ATbcMw6TgA4sNM%2FbZqkeKtAS--RwZMhUoogKfTH9tE--xXNUQiDmwjqXhStH%2BQcHeg%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "da4e1d8f-dd99-4de3-acd0-82bb867e485e", + "X-Runtime": "0.010806", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + }, + { + "request": { + "body": "", + "headers": { + "Accept": "application/activity+json" + }, + "method": "get", + "options": { + "follow_redirect": "true" + }, + "request_body": "", + "url": "https://framapiaf.org/users/tcit" + }, + "response": { + "binary": false, + "body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"Hashtag\":\"as:Hashtag\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/tcit\",\"type\":\"Person\",\"following\":\"https://framapiaf.org/users/tcit/following\",\"followers\":\"https://framapiaf.org/users/tcit/followers\",\"inbox\":\"https://framapiaf.org/users/tcit/inbox\",\"outbox\":\"https://framapiaf.org/users/tcit/outbox\",\"featured\":\"https://framapiaf.org/users/tcit/collections/featured\",\"preferredUsername\":\"tcit\",\"name\":\"💼 Thomas Citharel (Work)\",\"summary\":\"\\u003cp\\u003e\\u003ca href=\\\"https://framapiaf.org/tags/Framasoft\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/FreeSoftware\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFreeSoftware\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Activism\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eActivism\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/wallabag\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003ewallabag\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Federation\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eFederation\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Nextcloud\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eNextcloud\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Mobilizon\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eMobilizon\\u003c/span\\u003e\\u003c/a\\u003e \\u003ca href=\\\"https://framapiaf.org/tags/Libre\\\" class=\\\"mention hashtag\\\" rel=\\\"tag\\\"\\u003e#\\u003cspan\\u003eLibre\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@tcit\",\"manuallyApprovesFollowers\":false,\"discoverable\":true,\"publicKey\":{\"id\":\"https://framapiaf.org/users/tcit#main-key\",\"owner\":\"https://framapiaf.org/users/tcit\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApscVCt06lrIiB5jT6Kqk\\nZZwPVoPkhR7HzoTGb8rnklZuOyP4goHIuBDnurklztkmDCaM7DbsUWAPgRVtwWFE\\nWuQrOenb7BPRe/m99pJfUTkBQU3IeuRMD/5Fc3OTIhHQOltTSiB900srCUxjysfw\\nnV5JFciCz8YAXTNJZD34qyv8DbtC/pCJM7wMd9Hl3ohxSPETa6CJUaTdlNwlYJa2\\nMOMCj6/7Iv5oAg14FT9lwqS5lF7jPHk9Z7PNc2wPmNVgIYA2n9d5k7JY8TdM8iu4\\nHLnIbJuqDd1uitlYgy1qsdsxjv4U2Y7Nytc+3ZKHtGsCzUltYL5kC7uWrFpGoWo1\\n0QIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/activism\",\"name\":\"#activism\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/federation\",\"name\":\"#federation\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/framasoft\",\"name\":\"#framasoft\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/freesoftware\",\"name\":\"#freesoftware\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/libre\",\"name\":\"#libre\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/mobilizon\",\"name\":\"#mobilizon\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/nextcloud\",\"name\":\"#nextcloud\"},{\"type\":\"Hashtag\",\"href\":\"https://framapiaf.org/explore/wallabag\",\"name\":\"#wallabag\"}],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Personal account\",\"value\":\"\\u003ca href=\\\"https://social.tcit.fr/@tcit\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esocial.tcit.fr/@tcit\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Location\",\"value\":\"Nantes, France\"},{\"type\":\"PropertyValue\",\"name\":\"Works at\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Website\",\"value\":\"\\u003ca href=\\\"https://tcit.fr\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etcit.fr\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"IdentityProof\",\"name\":\"tcit\",\"signatureAlgorithm\":\"keybase\",\"signatureValue\":\"f66b45be42803010fe2f4d80e729b41bbe5ed056e2ff1286b7b5a5ea9c724cc70f\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/001/original/da0cad7ffd20eb61.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/001/original/198d058b3086d82d.jpg\"}}", + "headers": { + "Date": "Sun, 17 Nov 2019 18:09:15 GMT", + "Content-Type": "application/activity+json; charset=utf-8", + "Transfer-Encoding": "chunked", + "Connection": "keep-alive", + "Server": "Mastodon", + "X-Frame-Options": "DENY", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Vary": "Accept, Accept-Encoding, Origin", + "Cache-Control": "max-age=180, public", + "ETag": "W/\"11665b12333a8c7708de7b17f58147b2\"", + "Set-Cookie": "_mastodon_session=tIUy5QcQYyqXJHn2C7eBWRa%2FmLgJAB3hyTVKqqRBR4Br7azH5sL7TiKLYihZsjY0MBLzxaSN%2BcDaaMSpzYi0--SOi4GnXfjLVSzpwi--zUaSh4KSb6E0dcsjNgXS9A%3D%3D; path=/; secure; HttpOnly", + "X-Request-Id": "0f17c5ca-d79c-478e-b132-15cce6b1c2d5", + "X-Runtime": "0.013832", + "X-Cached": "MISS", + "Strict-Transport-Security": "max-age=31536000" + }, + "status_code": 200, + "type": "ok" + } + } +] \ No newline at end of file diff --git a/test/mobilizon/service/activity_pub/transmogrifier_test.exs b/test/mobilizon/service/activity_pub/transmogrifier_test.exs index 4329060dc..605114829 100644 --- a/test/mobilizon/service/activity_pub/transmogrifier_test.exs +++ b/test/mobilizon/service/activity_pub/transmogrifier_test.exs @@ -26,45 +26,47 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do describe "handle incoming events" do test "it works for incoming events" do - data = File.read!("test/fixtures/mobilizon-post-activity.json") |> Jason.decode!() + use_cassette "activity_pub/fetch_mobilizon_post_activity" do + data = File.read!("test/fixtures/mobilizon-post-activity.json") |> Jason.decode!() - {:ok, %Activity{data: data, local: false}, %Event{} = event} = - Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, %Event{} = event} = + Transmogrifier.handle_incoming(data) - assert data["id"] == - "https://event1.tcit.fr/@tcit/events/109ccdfd-ee3e-46e1-a877-6c228763df0c/activity" + assert data["id"] == + "https://test.mobilizon.org/events/39026210-0c69-4238-b3cc-986f33f98ed0/activity" - assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"] - # - # assert data["cc"] == [ - # "https://framapiaf.org/users/admin/followers", - # "http://localtesting.pleroma.lol/users/lain" - # ] + assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"] + # + # assert data["cc"] == [ + # "https://framapiaf.org/users/admin/followers", + # "http://localtesting.pleroma.lol/users/lain" + # ] - assert data["actor"] == "https://event1.tcit.fr/@tcit" + assert data["actor"] == "https://test.mobilizon.org/@Alicia" - object = data["object"] + object = data["object"] - assert object["id"] == - "https://event1.tcit.fr/@tcit/events/109ccdfd-ee3e-46e1-a877-6c228763df0c" + assert object["id"] == + "https://test.mobilizon.org/events/39026210-0c69-4238-b3cc-986f33f98ed0" - assert object["to"] == ["https://www.w3.org/ns/activitystreams#Public"] + assert object["to"] == ["https://www.w3.org/ns/activitystreams#Public"] - # assert object["cc"] == [ - # "https://framapiaf.org/users/admin/followers", - # "http://localtesting.pleroma.lol/users/lain" - # ] + # assert object["cc"] == [ + # "https://framapiaf.org/users/admin/followers", + # "http://localtesting.pleroma.lol/users/lain" + # ] - assert object["actor"] == "https://event1.tcit.fr/@tcit" - assert object["location"]["name"] == "Locaux de Framasoft" - assert object["attributedTo"] == "https://event1.tcit.fr/@tcit" + assert object["actor"] == "https://test.mobilizon.org/@Alicia" + assert object["location"]["name"] == "Locaux de Framasoft" + assert object["attributedTo"] == "https://test.mobilizon.org/@Alicia" - assert event.physical_address.street == "10 Rue Jangot" + assert event.physical_address.street == "10 Rue Jangot" - assert event.physical_address.url == - "https://event1.tcit.fr/address/eeecc11d-0030-43e8-a897-6422876372jd" + assert event.physical_address.url == + "https://event1.tcit.fr/address/eeecc11d-0030-43e8-a897-6422876372jd" - {:ok, %Actor{}} = Actors.get_actor_by_url(object["actor"]) + {:ok, %Actor{}} = Actors.get_actor_by_url(object["actor"]) + end end end @@ -116,43 +118,48 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do # end test "it works for incoming notices" do - data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!() + use_cassette "activity_pub/mastodon_post_activity" do + data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!() - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert data["id"] == "https://framapiaf.org/users/admin/statuses/99512778738411822/activity" + assert data["id"] == + "https://framapiaf.org/users/admin/statuses/99512778738411822/activity" - assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"] + assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"] - # assert data["cc"] == [ - # "https://framapiaf.org/users/admin/followers", - # "http://mobilizon.com/@tcit" - # ] + # assert data["cc"] == [ + # "https://framapiaf.org/users/admin/followers", + # "http://mobilizon.com/@tcit" + # ] - assert data["actor"] == "https://framapiaf.org/users/admin" + assert data["actor"] == "https://framapiaf.org/users/admin" - object = data["object"] - assert object["id"] == "https://framapiaf.org/users/admin/statuses/99512778738411822" + object = data["object"] + assert object["id"] == "https://framapiaf.org/users/admin/statuses/99512778738411822" - assert object["to"] == ["https://www.w3.org/ns/activitystreams#Public"] + assert object["to"] == ["https://www.w3.org/ns/activitystreams#Public"] - # assert object["cc"] == [ - # "https://framapiaf.org/users/admin/followers", - # "http://localtesting.pleroma.lol/users/lain" - # ] + # assert object["cc"] == [ + # "https://framapiaf.org/users/admin/followers", + # "http://localtesting.pleroma.lol/users/lain" + # ] - assert object["actor"] == "https://framapiaf.org/users/admin" - assert object["attributedTo"] == "https://framapiaf.org/users/admin" + assert object["actor"] == "https://framapiaf.org/users/admin" + assert object["attributedTo"] == "https://framapiaf.org/users/admin" - {:ok, %Actor{}} = Actors.get_actor_by_url(object["actor"]) + {:ok, %Actor{}} = Actors.get_actor_by_url(object["actor"]) + end end test "it works for incoming notices with hashtags" do - data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Jason.decode!() + use_cassette "activity_pub/mastodon_activity_hashtag" do + data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Jason.decode!() - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert Enum.at(data["object"]["tag"], 0)["name"] == "@tcit@framapiaf.org" - assert Enum.at(data["object"]["tag"], 1)["name"] == "#moo" + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + assert Enum.at(data["object"]["tag"], 0)["name"] == "@tcit@framapiaf.org" + assert Enum.at(data["object"]["tag"], 1)["name"] == "#moo" + end end # test "it works for incoming notices with contentMap" do @@ -209,21 +216,23 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do end test "it works for incoming follow requests" do - actor = insert(:actor) + use_cassette "activity_pub/mastodon_follow_activity" do + actor = insert(:actor) - data = - File.read!("test/fixtures/mastodon-follow-activity.json") - |> Jason.decode!() - |> Map.put("object", actor.url) + data = + File.read!("test/fixtures/mastodon-follow-activity.json") + |> Jason.decode!() + |> Map.put("object", actor.url) - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert data["actor"] == "https://social.tcit.fr/users/tcit" - assert data["type"] == "Follow" - assert data["id"] == "https://social.tcit.fr/users/tcit#follows/2" + assert data["actor"] == "https://social.tcit.fr/users/tcit" + assert data["type"] == "Follow" + assert data["id"] == "https://social.tcit.fr/users/tcit#follows/2" - actor = Actors.get_actor_with_preload(actor.id) - assert Actors.is_following(Actors.get_actor_by_url!(data["actor"], true), actor) + actor = Actors.get_actor_with_preload(actor.id) + assert Actors.is_following(Actors.get_actor_by_url!(data["actor"], true), actor) + end end # test "it works for incoming follow requests from hubzilla" do @@ -295,89 +304,99 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do # end test "it works for incoming announces" do - data = File.read!("test/fixtures/mastodon-announce.json") |> Jason.decode!() + use_cassette "activity_pub/mastodon_announce_activity" do + data = File.read!("test/fixtures/mastodon-announce.json") |> Jason.decode!() - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert data["actor"] == "https://framapiaf.org/users/Framasoft" - assert data["type"] == "Announce" + assert data["actor"] == "https://framapiaf.org/users/Framasoft" + assert data["type"] == "Announce" - assert data["id"] == - "https://framapiaf.org/users/Framasoft/statuses/102501959686438400/activity" + assert data["id"] == + "https://framapiaf.org/users/Framasoft/statuses/102501959686438400/activity" - assert data["object"] == - "https://framapiaf.org/users/Framasoft/statuses/102501959686438400" + assert data["object"] == + "https://framapiaf.org/users/Framasoft/statuses/102501959686438400" - assert %Comment{} = Events.get_comment_from_url(data["object"]) + assert %Comment{} = Events.get_comment_from_url(data["object"]) + end end test "it works for incoming announces with an existing activity" do - comment = insert(:comment) + use_cassette "activity_pub/mastodon_announce_existing_activity" do + comment = insert(:comment) - data = - File.read!("test/fixtures/mastodon-announce.json") - |> Jason.decode!() - |> Map.put("object", comment.url) + data = + File.read!("test/fixtures/mastodon-announce.json") + |> Jason.decode!() + |> Map.put("object", comment.url) - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert data["actor"] == "https://framapiaf.org/users/Framasoft" - assert data["type"] == "Announce" + assert data["actor"] == "https://framapiaf.org/users/Framasoft" + assert data["type"] == "Announce" - assert data["id"] == - "https://framapiaf.org/users/Framasoft/statuses/102501959686438400/activity" + assert data["id"] == + "https://framapiaf.org/users/Framasoft/statuses/102501959686438400/activity" - assert data["object"] == comment.url + assert data["object"] == comment.url + end end test "it works for incoming update activities on actors" do - data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!() + use_cassette "activity_pub/update_actor_activity" do + data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!() - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!() + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!() - object = - update_data["object"] - |> Map.put("actor", data["actor"]) - |> Map.put("id", data["actor"]) + object = + update_data["object"] + |> Map.put("actor", data["actor"]) + |> Map.put("id", data["actor"]) - update_data = - update_data - |> Map.put("actor", data["actor"]) - |> Map.put("object", object) + update_data = + update_data + |> Map.put("actor", data["actor"]) + |> 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) - {:ok, %Actor{} = actor} = Actors.get_actor_by_url(update_data["actor"]) - assert actor.name == "nextsoft" + {:ok, %Actor{} = actor} = Actors.get_actor_by_url(update_data["actor"]) + assert actor.name == "nextsoft" - assert actor.summary == "

Some bio

" + assert actor.summary == "

Some bio

" + end end test "it works for incoming update activities on events" do - data = File.read!("test/fixtures/mobilizon-post-activity.json") |> Jason.decode!() + use_cassette "activity_pub/event_update_activities" do + data = File.read!("test/fixtures/mobilizon-post-activity.json") |> Jason.decode!() - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!() + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!() - object = - data["object"] - |> Map.put("actor", data["actor"]) - |> Map.put("name", "My updated event") - |> Map.put("id", data["object"]["id"]) - |> Map.put("type", "Event") + object = + data["object"] + |> Map.put("actor", data["actor"]) + |> Map.put("name", "My updated event") + |> Map.put("id", data["object"]["id"]) + |> Map.put("type", "Event") - update_data = - update_data - |> Map.put("actor", data["actor"]) - |> Map.put("object", object) + update_data = + update_data + |> Map.put("actor", data["actor"]) + |> 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) - %Event{} = event = Events.get_event_by_url(data["object"]["id"]) - assert event.title == "My updated event" + %Event{} = event = Events.get_event_by_url(data["object"]["id"]) + assert event.title == "My updated event" - assert event.description == data["object"]["content"] + assert event.description == data["object"]["content"] + end end # test "it works for incoming update activities which lock the account" do @@ -449,56 +468,60 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do # end test "it works for incoming unannounces with an existing notice" do - comment = insert(:comment) + use_cassette "activity_pub/mastodon_unannounce_activity" do + comment = insert(:comment) - announce_data = - File.read!("test/fixtures/mastodon-announce.json") - |> Jason.decode!() - |> Map.put("object", comment.url) + announce_data = + File.read!("test/fixtures/mastodon-announce.json") + |> Jason.decode!() + |> Map.put("object", comment.url) - {:ok, %Activity{data: announce_data, local: false}, _} = - Transmogrifier.handle_incoming(announce_data) + {:ok, %Activity{data: announce_data, local: false}, _} = + Transmogrifier.handle_incoming(announce_data) - data = - File.read!("test/fixtures/mastodon-undo-announce.json") - |> Jason.decode!() - |> Map.put("object", announce_data) - |> Map.put("actor", announce_data["actor"]) + data = + File.read!("test/fixtures/mastodon-undo-announce.json") + |> Jason.decode!() + |> Map.put("object", announce_data) + |> Map.put("actor", announce_data["actor"]) - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert data["type"] == "Undo" - assert data["object"]["type"] == "Announce" - assert data["object"]["object"] == comment.url + assert data["type"] == "Undo" + assert data["object"]["type"] == "Announce" + assert data["object"]["object"] == comment.url - assert data["object"]["id"] == - "https://framapiaf.org/users/Framasoft/statuses/102501959686438400/activity" + assert data["object"]["id"] == + "https://framapiaf.org/users/Framasoft/statuses/102501959686438400/activity" + end end test "it works for incomming unfollows with an existing follow" do - actor = insert(:actor) + use_cassette "activity_pub/unfollow_existing_follow_activity" do + actor = insert(:actor) - follow_data = - File.read!("test/fixtures/mastodon-follow-activity.json") - |> Jason.decode!() - |> Map.put("object", actor.url) + follow_data = + File.read!("test/fixtures/mastodon-follow-activity.json") + |> Jason.decode!() + |> Map.put("object", actor.url) - {:ok, %Activity{data: _, local: false}, _} = Transmogrifier.handle_incoming(follow_data) + {:ok, %Activity{data: _, local: false}, _} = Transmogrifier.handle_incoming(follow_data) - data = - File.read!("test/fixtures/mastodon-unfollow-activity.json") - |> Jason.decode!() - |> Map.put("object", follow_data) + data = + File.read!("test/fixtures/mastodon-unfollow-activity.json") + |> Jason.decode!() + |> Map.put("object", follow_data) - {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) + {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data) - assert data["type"] == "Undo" - assert data["object"]["type"] == "Follow" - assert data["object"]["object"] == actor.url - assert data["actor"] == "https://social.tcit.fr/users/tcit" + assert data["type"] == "Undo" + assert data["object"]["type"] == "Follow" + assert data["object"]["object"] == actor.url + assert data["actor"] == "https://social.tcit.fr/users/tcit" - {:ok, followed} = Actors.get_actor_by_url(data["actor"]) - refute Actors.is_following(followed, actor) + {:ok, followed} = Actors.get_actor_by_url(data["actor"]) + refute Actors.is_following(followed, actor) + end end # test "it works for incoming blocks" do