summaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-01-28 15:25:06 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-01-28 15:25:06 +0300
commit1d2f41642cfec5710055bcf8409778bb362beecb (patch)
tree18ee9598a4dfcde0751c1f53e756e3e8a75331cc /test/support
parent9560abea102b8cd4927c9350bbd0a1a2f1800ea6 (diff)
downloadpleroma-1d2f41642cfec5710055bcf8409778bb362beecb.tar.gz
pleroma-1d2f41642cfec5710055bcf8409778bb362beecb.zip
[#534] Various tweaks. Tests for Instances and Instance.
Diffstat (limited to 'test/support')
-rw-r--r--test/support/factory.ex7
-rw-r--r--test/support/http_request_mock.ex28
2 files changed, 35 insertions, 0 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex
index 964b2b61c..0c21093ce 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -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 e4279e14d..3d6efd52c 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -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