1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-12-25 04:53:06 +00:00

Merge branch 'guppe-example' into 'develop'

ActivtityPub Test: Add example for guppe actor

See merge request pleroma/pleroma!3243
This commit is contained in:
lain 2021-01-08 15:55:48 +00:00
commit 5822338f3a
2 changed files with 44 additions and 0 deletions

26
test/fixtures/guppe-actor.json vendored Normal file
View file

@ -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"
}

View file

@ -190,6 +190,24 @@ test "it returns a user that accepts chat messages" 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