aboutsummaryrefslogtreecommitdiff
path: root/test/support/http_request_mock.ex
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2019-08-02 18:16:04 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2019-08-02 18:16:04 +0300
commit9d4f34fbcb1a8e2eca424b3a3374c9f9af972574 (patch)
treec5943eb5d2652e08cc12d0b58a992376c425e66d /test/support/http_request_mock.ex
parentd2da3d30f3349946500423bab53e0c1221ab7b9b (diff)
parent5ff8f07ca906d77a6ec1d5ba912a787f855364f9 (diff)
downloadpleroma-9d4f34fbcb1a8e2eca424b3a3374c9f9af972574.tar.gz
Merge branch 'develop' into feature/digest-email
Diffstat (limited to 'test/support/http_request_mock.ex')
-rw-r--r--test/support/http_request_mock.ex53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
index 7811f7807..3adb5ba3b 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -51,6 +51,10 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://mastodon.social/users/not_found", _, _, _) do
+ {:ok, %Tesla.Env{status: 404}}
+ end
+
def get("https://mastodon.sdf.org/users/rinpatch", _, _, _) do
{:ok,
%Tesla.Env{
@@ -301,6 +305,22 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://wedistribute.org/wp-json/pterotype/v1/object/85810", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/wedistribute-article.json")
+ }}
+ end
+
+ def get("https://wedistribute.org/wp-json/pterotype/v1/actor/-blog", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/wedistribute-user.json")
+ }}
+ end
+
def get("http://mastodon.example.org/users/admin", _, _, Accept: "application/activity+json") do
{:ok,
%Tesla.Env{
@@ -614,6 +634,15 @@ defmodule HttpRequestMock do
}}
end
+ def get(
+ "https://social.heldscal.la/.well-known/webfinger?resource=invalid_content@social.heldscal.la",
+ _,
+ _,
+ Accept: "application/xrd+xml,application/jrd+json"
+ ) do
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end
+
def get("http://framatube.org/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
@@ -767,6 +796,14 @@ defmodule HttpRequestMock do
}}
end
+ def get("http://localhost:4001/users/masto_closed/followers?page=1", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/users_mock/masto_closed_followers_page.json")
+ }}
+ end
+
def get("http://localhost:4001/users/masto_closed/following", _, _, _) do
{:ok,
%Tesla.Env{
@@ -775,6 +812,14 @@ defmodule HttpRequestMock do
}}
end
+ def get("http://localhost:4001/users/masto_closed/following?page=1", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/users_mock/masto_closed_following_page.json")
+ }}
+ end
+
def get("http://localhost:4001/users/fuser2/followers", _, _, _) do
{:ok,
%Tesla.Env{
@@ -915,6 +960,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)}, #{