Add WebFinger test for AP-only account

This commit is contained in:
kPherox 2019-07-25 01:27:34 +09:00
parent ac27b94ffa
commit 8d9f43e1d1
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D
3 changed files with 32 additions and 0 deletions

View 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>

View File

@ -915,6 +915,14 @@ defmodule HttpRequestMock 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)}, #{

View File

@ -81,6 +81,20 @@ defmodule Pleroma.Web.WebFingerTest 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"