diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-04-29 17:51:59 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-04-29 17:51:59 +0200 |
commit | 69922bc724736fb07bf36beaef42d944158d9269 (patch) | |
tree | fc204e0621f9c32029b43a07a4ebbd0d1dd95198 /test | |
parent | ca40dda04c114c32ca9ecfe5f998a083448a189c (diff) | |
download | pleroma-69922bc724736fb07bf36beaef42d944158d9269.tar.gz |
Add user info gathering.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/ostatus/ostatus_test.exs | 22 | ||||
-rw-r--r-- | test/web/websub/websub_test.exs | 11 |
2 files changed, 31 insertions, 2 deletions
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs index 140b32f36..2a5156b31 100644 --- a/test/web/ostatus/ostatus_test.exs +++ b/test/web/ostatus/ostatus_test.exs @@ -63,4 +63,26 @@ defmodule Pleroma.Web.OStatusTest do assert user == user_again end end + + describe "gathering user info from a user id" do + test "it returns user info in a hash" do + user = "shp@social.heldscal.la" + + # TODO: make test local + {:ok, data} = OStatus.gather_user_info(user) + + expected = %{ + hub: "https://social.heldscal.la/main/push/hub", + magic_key: "RSA.wQ3i9UA0qmAxZ0WTIp4a-waZn_17Ez1pEEmqmqoooRsG1_BvpmOvLN0G2tEcWWxl2KOtdQMCiPptmQObeZeuj48mdsDZ4ArQinexY2hCCTcbV8Xpswpkb8K05RcKipdg07pnI7tAgQ0VWSZDImncL6YUGlG5YN8b5TjGOwk2VG8=.AQAB", + name: "shp", + nickname: "shp", + salmon: "https://social.heldscal.la/main/salmon/user/29191", + subject: "acct:shp@social.heldscal.la", + topic: "https://social.heldscal.la/api/statuses/user_timeline/29191.atom", + uri: "https://social.heldscal.la/user/29191", + fqn: user + } + assert data == expected + end + end end diff --git a/test/web/websub/websub_test.exs b/test/web/websub/websub_test.exs index ca04a55cd..1b1ef3fa6 100644 --- a/test/web/websub/websub_test.exs +++ b/test/web/websub/websub_test.exs @@ -112,8 +112,15 @@ defmodule Pleroma.Web.WebsubTest do {:ok, %{status_code: 200, body: doc}} end - {:ok, discovered} = Websub.discover(topic, getter) - assert %{hub: "https://mastodon.social/api/push", url: topic} == discovered + {:ok, discovered} = Websub.gather_feed_data(topic, getter) + expected = %{ + hub: "https://mastodon.social/api/push", + uri: "https://mastodon.social/users/lambadalambda", + nickname: "lambadalambda", + name: "Critical Value" + } + + assert expected == discovered end test "calls the hub, requests topic" do |