summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2021-01-08 15:55:48 +0000
committerlain <lain@soykaf.club>2021-01-08 15:55:48 +0000
commit5822338f3a42852c18a323c35041b14b29661de6 (patch)
treea72c5986da119d4620a02b3f1ede875f4771dbe5
parent7173d35ef88930e36891cd46ee13bb58364394e4 (diff)
parentbd788c093911d84c1615948f8711257e6a7d8974 (diff)
Merge branch 'guppe-example' into 'develop'
ActivtityPub Test: Add example for guppe actor See merge request pleroma/pleroma!3243
-rw-r--r--test/fixtures/guppe-actor.json26
-rw-r--r--test/pleroma/web/activity_pub/activity_pub_test.exs18
2 files changed, 44 insertions, 0 deletions
diff --git a/test/fixtures/guppe-actor.json b/test/fixtures/guppe-actor.json
new file mode 100644
index 000000000..d5829ee1f
--- /dev/null
+++ b/test/fixtures/guppe-actor.json
@@ -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"
+}
diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs
index 0d30ba20b..98242ff63 100644
--- a/test/pleroma/web/activity_pub/activity_pub_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_test.exs
@@ -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