Implement missing mocks for rel=me
This commit is contained in:
parent
e22737ffb5
commit
211e163770
2 changed files with 18 additions and 27 deletions
|
@ -973,6 +973,22 @@ def get("https://mstdn.jp/.well-known/webfinger?resource=acct:kpherox@mstdn.jp",
|
|||
}}
|
||||
end
|
||||
|
||||
def get("http://example.com/rel_me/anchor", _, _, _) do
|
||||
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor.html")}}
|
||||
end
|
||||
|
||||
def get("http://example.com/rel_me/anchor_nofollow", _, _, _) do
|
||||
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor_nofollow.html")}}
|
||||
end
|
||||
|
||||
def get("http://example.com/rel_me/link", _, _, _) do
|
||||
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_link.html")}}
|
||||
end
|
||||
|
||||
def get("http://example.com/rel_me/null", _, _, _) do
|
||||
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_null.html")}}
|
||||
end
|
||||
|
||||
def get(url, query, body, headers) do
|
||||
{:error,
|
||||
"Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
||||
|
|
|
@ -5,33 +5,8 @@
|
|||
defmodule Pleroma.Web.RelMeTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
setup do
|
||||
Tesla.Mock.mock(fn
|
||||
%{
|
||||
method: :get,
|
||||
url: "http://example.com/rel_me/anchor"
|
||||
} ->
|
||||
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor.html")}
|
||||
|
||||
%{
|
||||
method: :get,
|
||||
url: "http://example.com/rel_me/anchor_nofollow"
|
||||
} ->
|
||||
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor_nofollow.html")}
|
||||
|
||||
%{
|
||||
method: :get,
|
||||
url: "http://example.com/rel_me/link"
|
||||
} ->
|
||||
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_link.html")}
|
||||
|
||||
%{
|
||||
method: :get,
|
||||
url: "http://example.com/rel_me/null"
|
||||
} ->
|
||||
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_null.html")}
|
||||
end)
|
||||
|
||||
setup_all do
|
||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue