diff options
author | kaniini <ariadne@dereferenced.org> | 2019-07-24 19:29:01 +0000 |
---|---|---|
committer | kaniini <ariadne@dereferenced.org> | 2019-07-24 19:29:01 +0000 |
commit | 19835be0677a9fa941b831ebf576c8cea9df080a (patch) | |
tree | 246ec82d9a004b8b81edfa4867f32ca12e982ccb /test | |
parent | 931c4974ee4a5e5e806433ce7b367928e4210e0c (diff) | |
parent | 8d9f43e1d1a55f445e4e6e4659b9493cd35d99d9 (diff) | |
download | pleroma-19835be0677a9fa941b831ebf576c8cea9df080a.tar.gz pleroma-19835be0677a9fa941b831ebf576c8cea9df080a.zip |
Merge branch 'fix-remote-follow-from-ostatus-subscribe' into 'develop'
Fix remote follow from /ostatus_subscribe
Closes #1103
See merge request pleroma/pleroma!1472
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/tesla_mock/kpherox@mstdn.jp.xml | 10 | ||||
-rw-r--r-- | test/support/http_request_mock.ex | 8 | ||||
-rw-r--r-- | test/web/web_finger/web_finger_test.exs | 14 |
3 files changed, 32 insertions, 0 deletions
diff --git a/test/fixtures/tesla_mock/kpherox@mstdn.jp.xml b/test/fixtures/tesla_mock/kpherox@mstdn.jp.xml new file mode 100644 index 000000000..2ec134eaa --- /dev/null +++ b/test/fixtures/tesla_mock/kpherox@mstdn.jp.xml @@ -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> diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 55cfc1e00..2ed5f5042 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -940,6 +940,14 @@ defmodule HttpRequestMock do {:ok, %Tesla.Env{status: 404, body: ""}} 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 {:error, "Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{ diff --git a/test/web/web_finger/web_finger_test.exs b/test/web/web_finger/web_finger_test.exs index abf512604..8fdb9adea 100644 --- a/test/web/web_finger/web_finger_test.exs +++ b/test/web/web_finger/web_finger_test.exs @@ -86,6 +86,20 @@ defmodule Pleroma.Web.WebFingerTest do assert data["subscribe_address"] == "https://gnusocial.de/main/ostatussub?profile={uri}" 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 user = "lain@squeet.me" |