[#534] Various tweaks. Tests for Instances and Instance.
This commit is contained in:
parent
9560abea10
commit
1d2f41642c
15 changed files with 312 additions and 40 deletions
|
|
@ -220,4 +220,11 @@ defmodule Pleroma.Factory do
|
|||
client_secret: "aaa;/&bbb"
|
||||
}
|
||||
end
|
||||
|
||||
def instance_factory do
|
||||
%Pleroma.Instances.Instance{
|
||||
host: "domain.com",
|
||||
unreachable_since: nil
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -653,6 +653,14 @@ defmodule HttpRequestMock do
|
|||
{:ok, Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)}
|
||||
end
|
||||
|
||||
def get("http://404.site" <> _, _, _, _) do
|
||||
{:ok,
|
||||
%Tesla.Env{
|
||||
status: 404,
|
||||
body: ""
|
||||
}}
|
||||
end
|
||||
|
||||
def get(url, query, body, headers) do
|
||||
{:error,
|
||||
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{
|
||||
|
|
@ -673,6 +681,26 @@ defmodule HttpRequestMock do
|
|||
}}
|
||||
end
|
||||
|
||||
def post("http://200.site" <> _, _, _, _) do
|
||||
{:ok,
|
||||
%Tesla.Env{
|
||||
status: 200,
|
||||
body: ""
|
||||
}}
|
||||
end
|
||||
|
||||
def post("http://connrefused.site" <> _, _, _, _) do
|
||||
{:error, :connrefused}
|
||||
end
|
||||
|
||||
def post("http://404.site" <> _, _, _, _) do
|
||||
{:ok,
|
||||
%Tesla.Env{
|
||||
status: 404,
|
||||
body: ""
|
||||
}}
|
||||
end
|
||||
|
||||
def post(url, _query, _body, _headers) do
|
||||
{:error, "Not implemented the mock response for post #{inspect(url)}"}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue