Add WebFinger test for AP-only account
This commit is contained in:
parent
ac27b94ffa
commit
8d9f43e1d1
3 changed files with 32 additions and 0 deletions
10
test/fixtures/tesla_mock/kpherox@mstdn.jp.xml
vendored
Normal file
10
test/fixtures/tesla_mock/kpherox@mstdn.jp.xml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||||
|
<Subject>acct:kPherox@mstdn.jp</Subject>
|
||||||
|
<Alias>https://mstdn.jp/@kPherox</Alias>
|
||||||
|
<Alias>https://mstdn.jp/users/kPherox</Alias>
|
||||||
|
<Link rel="http://webfinger.net/rel/profile-page" type="text/html" href="https://mstdn.jp/@kPherox"/>
|
||||||
|
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="https://mstdn.jp/users/kPherox.atom"/>
|
||||||
|
<Link rel="self" type="application/activity+json" href="https://mstdn.jp/users/kPherox"/>
|
||||||
|
<Link rel="http://ostatus.org/schema/1.0/subscribe" template="https://mstdn.jp/authorize_interaction?acct={uri}"/>
|
||||||
|
</XRD>
|
|
@ -915,6 +915,14 @@ def get("https://info.pleroma.site/activity3.json", _, _, _) do
|
||||||
{:ok, %Tesla.Env{status: 404, body: ""}}
|
{:ok, %Tesla.Env{status: 404, body: ""}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get("https://mstdn.jp/.well-known/webfinger?resource=acct:kpherox@mstdn.jp", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
def get(url, query, body, headers) do
|
def get(url, query, body, headers) do
|
||||||
{:error,
|
{:error,
|
||||||
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
||||||
|
|
|
@ -81,6 +81,20 @@ test "returns the correctly for json ostatus users" do
|
||||||
assert data["subscribe_address"] == "https://gnusocial.de/main/ostatussub?profile={uri}"
|
assert data["subscribe_address"] == "https://gnusocial.de/main/ostatussub?profile={uri}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it work for AP-only user" do
|
||||||
|
user = "kpherox@mstdn.jp"
|
||||||
|
|
||||||
|
{:ok, data} = WebFinger.finger(user)
|
||||||
|
|
||||||
|
assert data["magic_key"] == nil
|
||||||
|
assert data["salmon"] == nil
|
||||||
|
|
||||||
|
assert data["topic"] == "https://mstdn.jp/users/kPherox.atom"
|
||||||
|
assert data["subject"] == "acct:kPherox@mstdn.jp"
|
||||||
|
assert data["ap_id"] == "https://mstdn.jp/users/kPherox"
|
||||||
|
assert data["subscribe_address"] == "https://mstdn.jp/authorize_interaction?acct={uri}"
|
||||||
|
end
|
||||||
|
|
||||||
test "it works for friendica" do
|
test "it works for friendica" do
|
||||||
user = "lain@squeet.me"
|
user = "lain@squeet.me"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue