diff options
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/factory.ex | 9 | ||||
-rw-r--r-- | test/support/http_request_mock.ex | 28 |
2 files changed, 36 insertions, 1 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index 4ac77981a..0c21093ce 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -193,7 +193,7 @@ defmodule Pleroma.Factory do def websub_subscription_factory do %Pleroma.Web.Websub.WebsubServerSubscription{ topic: "http://example.org", - callback: "http://example/org/callback", + callback: "http://example.org/callback", secret: "here's a secret", valid_until: NaiveDateTime.add(NaiveDateTime.utc_now(), 100), state: "requested" @@ -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 diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index c60f61873..78e8efc9d 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -696,6 +696,14 @@ defmodule HttpRequestMock do {:ok, %Tesla.Env{status: 200, body: "hello"}} 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)}, #{ @@ -716,6 +724,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 |