Fetch the same data from json webfinger as from xml webfinger.
This commit is contained in:
parent
d1ee3edd3c
commit
e3a81fe58f
4 changed files with 31 additions and 3 deletions
1
test/fixtures/httpoison_mock/winterdienst_webfinger.json
vendored
Normal file
1
test/fixtures/httpoison_mock/winterdienst_webfinger.json
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"subject":"acct:winterdienst@gnusocial.de","aliases":["https:\/\/gnusocial.de\/user\/249296","https:\/\/gnusocial.de\/winterdienst","https:\/\/gnusocial.de\/index.php\/user\/249296","https:\/\/gnusocial.de\/index.php\/winterdienst"],"links":[{"rel":"http:\/\/webfinger.net\/rel\/profile-page","type":"text\/html","href":"https:\/\/gnusocial.de\/winterdienst"},{"rel":"http:\/\/gmpg.org\/xfn\/11","type":"text\/html","href":"https:\/\/gnusocial.de\/winterdienst"},{"rel":"describedby","type":"application\/rdf+xml","href":"https:\/\/gnusocial.de\/winterdienst\/foaf"},{"rel":"http:\/\/apinamespace.org\/atom","type":"application\/atomsvc+xml","href":"https:\/\/gnusocial.de\/api\/statusnet\/app\/service\/winterdienst.xml"},{"rel":"http:\/\/apinamespace.org\/twitter","href":"https:\/\/gnusocial.de\/api\/"},{"rel":"http:\/\/schemas.google.com\/g\/2010#updates-from","type":"application\/atom+xml","href":"https:\/\/gnusocial.de\/api\/statuses\/user_timeline\/249296.atom"},{"rel":"magic-public-key","href":"data:application\/magic-public-key,RSA.qfYaxztz7ZELrE4v5WpJrPM99SKI3iv9Y3Tw6nfLGk-4CRljNYqV8IYX2FXjeucC_DKhPNnlF6fXyASpcSmA_qupX9WC66eVhFhZ5OuyBOeLvJ1C4x7Hi7Di8MNBxY3VdQuQR0tTaS_YAZCwASKp7H6XEid3EJpGt0EQZoNzRd8=.AQAB"},{"rel":"salmon","href":"https:\/\/gnusocial.de\/main\/salmon\/user\/249296"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-replies","href":"https:\/\/gnusocial.de\/main\/salmon\/user\/249296"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-mention","href":"https:\/\/gnusocial.de\/main\/salmon\/user\/249296"},{"rel":"http:\/\/ostatus.org\/schema\/1.0\/subscribe","template":"https:\/\/gnusocial.de\/main\/ostatussub?profile={uri}"}]}
|
||||
|
|
@ -9,6 +9,12 @@ defmodule HTTPoisonMock do
|
|||
body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
|
||||
}}
|
||||
end
|
||||
def get("http://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de", [Accept: "application/xrd+xml,application/jrd+json"], [follow_redirect: true]) do
|
||||
{:ok, %Response{
|
||||
status_code: 200,
|
||||
body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
|
||||
}}
|
||||
end
|
||||
|
||||
def get("https://social.heldscal.la/.well-known/webfinger", [Accept: "application/xrd+xml,application/jrd+json"], [params: [resource: "nonexistant@social.heldscal.la"], follow_redirect: true]) do
|
||||
{:ok, %Response{
|
||||
|
|
|
|||
|
|
@ -45,6 +45,18 @@ defmodule Pleroma.Web.WebFingerTest do
|
|||
{:ok, _data} = WebFinger.finger(user)
|
||||
end
|
||||
|
||||
test "returns the correctly for json ostatus users" do
|
||||
user = "winterdienst@gnusocial.de"
|
||||
|
||||
{:ok, data} = WebFinger.finger(user)
|
||||
|
||||
assert data["magic_key"] == "RSA.qfYaxztz7ZELrE4v5WpJrPM99SKI3iv9Y3Tw6nfLGk-4CRljNYqV8IYX2FXjeucC_DKhPNnlF6fXyASpcSmA_qupX9WC66eVhFhZ5OuyBOeLvJ1C4x7Hi7Di8MNBxY3VdQuQR0tTaS_YAZCwASKp7H6XEid3EJpGt0EQZoNzRd8=.AQAB"
|
||||
assert data["topic"] == "https://gnusocial.de/api/statuses/user_timeline/249296.atom"
|
||||
assert data["subject"] == "acct:winterdienst@gnusocial.de"
|
||||
assert data["salmon"] == "https://gnusocial.de/main/salmon/user/249296"
|
||||
assert data["subscribe_address"] == "https://gnusocial.de/main/ostatussub?profile={uri}"
|
||||
end
|
||||
|
||||
test "it works for friendica" do
|
||||
user = "lain@squeet.me"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue