ActivtityPub Test: Add example for guppe actor
authorlain <lain@soykaf.club>
Thu, 7 Jan 2021 15:20:30 +0000 (16:20 +0100)
committerlain <lain@soykaf.club>
Thu, 7 Jan 2021 15:20:30 +0000 (16:20 +0100)
test/fixtures/guppe-actor.json [new file with mode: 0644]
test/pleroma/web/activity_pub/activity_pub_test.exs

diff --git a/test/fixtures/guppe-actor.json b/test/fixtures/guppe-actor.json
new file mode 100644 (file)
index 0000000..d5829ee
--- /dev/null
@@ -0,0 +1,26 @@
+{
+   "@context" : [
+      "https://www.w3.org/ns/activitystreams",
+      "https://w3id.org/security/v1"
+   ],
+   "followers" : "https://gup.pe/u/bernie2020/followers",
+   "following" : "https://gup.pe/u/bernie2020/following",
+   "icon" : {
+      "mediaType" : "image/jpeg",
+      "type" : "Image",
+      "url" : "https://gup.pe/f/guppe.png"
+   },
+   "id" : "https://gup.pe/u/bernie2020",
+   "inbox" : "https://gup.pe/u/bernie2020/inbox",
+   "liked" : "https://gup.pe/u/bernie2020/liked",
+   "name" : "Bernie2020 group",
+   "outbox" : "https://gup.pe/u/bernie2020/outbox",
+   "preferredUsername" : "Bernie2020",
+   "publicKey" : {
+      "id" : "https://gup.pe/u/bernie2020#main-key",
+      "owner" : "https://gup.pe/u/bernie2020",
+      "publicKeyPem" : "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAw4J8nSrdWWxFaipgWDhR\nbTFzHUGoFy7Gjdc6gg9ZWGWDm9ZU5Ct0C/4o72dXSWdyLbQGYMbWVHLI1LHWKSiC\nVtwIYoccQBaxfi5bCxsahWhhSNPfK8tVlySHvBy73ir8KUZm93eAYh1iE9x+Dk63\nInmi7wzjsqHSlu1KxPGYcnyxs+xxhlTUSd5LsPfO1b9sHMW+X4rEky7OC90veCdD\nsoHU+nCmf+2zJSlOrU7DAzqB4Axc9oS9Q5RlT3yARJQMeu6JyjJJP9CMbpGFbUNT\n5Gsw0km1Rc1rR4tUoz8pLUYtliEUK+/0EmHi2EHAT1ueEfMoGGbCaX/mCoMmAwYJ\nwIGYXmKn2/ARIJpw2XPmrKWXqa2AndOQdb3l44Sl3ej2rC/JQmimGCn7tbfKEZyC\n6mMkOYTIeBtyW/wXFc1+GzJxtvA3C9HjilE+O/7gLHfCLP6FRIxg/9kOLhEj64Ed\n5HZ3sylvifXXubS/lLZr6sZW6d9ICoYLZpFw9AoF2zaYWpvJqBrWinnCJzvbMCYj\nfq/RAkcQYSxkDOHquiGgbRZHGAMKLnz5fMKJIzBtdQojYCUmB14OArW+ITUE9i2a\nPAJaXEGZ+BHYp/0ScFaXwp5LIgT1S+sPKxWJU//77wQfs25i7NZHSN/jtXVmsFS6\nLFVw49LcWAz3J2Im+A+uSd8CAwEAAQ==\n-----END PUBLIC KEY-----\n"
+   },
+   "summary" : "I'm a group about Bernie2020. Follow me to get all the group posts. Tag me to share with the group. Create other groups by searching for or tagging @yourGroupName@gup.pe",
+   "type" : "Group"
+}
index 0d30ba20bebdca317763d74a89cc5a4d899a24fb..98242ff633f9f80fe2232bb56087bdea5d54fe56 100644 (file)
@@ -190,6 +190,24 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
 
       assert user.accepts_chat_messages
     end
+
+    test "works for guppe actors" do
+      user_id = "https://gup.pe/u/bernie2020"
+
+      Tesla.Mock.mock(fn
+        %{method: :get, url: ^user_id} ->
+          %Tesla.Env{
+            status: 200,
+            body: File.read!("test/fixtures/guppe-actor.json"),
+            headers: [{"content-type", "application/activity+json"}]
+          }
+      end)
+
+      {:ok, user} = ActivityPub.make_user_from_ap_id(user_id)
+
+      assert user.name == "Bernie2020 group"
+      assert user.actor_type == "Group"
+    end
   end
 
   test "it fetches the appropriate tag-restricted posts" do