X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fsupport%2Fhttp_request_mock.ex;h=344e27f137506a8fb65f43789b5df98a65c243ca;hb=c5830ac037c0c344bd22b674c41f4dc244a088aa;hp=b825a93075b7d856fd8391dac67e26ef86a5aa52;hpb=06b3bb54c5567fe82ad2a015673fffba667997ee;p=akkoma
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
index b825a9307..344e27f13 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule HttpRequestMock do
@@ -19,7 +19,7 @@ defmodule HttpRequestMock do
else
error ->
with {:error, message} <- error do
- Logger.warn(message)
+ Logger.warn(to_string(message))
end
{_, _r} = error
@@ -38,6 +38,14 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://shitposter.club/users/moonman", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/moonman@shitposter.club.json")
+ }}
+ end
+
def get("https://mastodon.social/users/emelie/statuses/101849165031453009", _, _, _) do
{:ok,
%Tesla.Env{
@@ -74,6 +82,14 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://patch.cx/objects/tesla_mock/poll_attachment", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/poll_attachment.json")
+ }}
+ end
+
def get(
"https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/emelie",
_,
@@ -87,19 +103,11 @@ defmodule HttpRequestMock do
}}
end
- def get("https://mastodon.social/users/emelie.atom", _, _, _) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body: File.read!("test/fixtures/tesla_mock/emelie.atom")
- }}
- end
-
def get(
"https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -112,7 +120,7 @@ defmodule HttpRequestMock do
"https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -121,19 +129,11 @@ defmodule HttpRequestMock do
}}
end
- def get("https://pawoo.net/users/pekorino.atom", _, _, _) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___pawoo.net_users_pekorino.atom")
- }}
- end
-
def get(
"https://pawoo.net/.well-known/webfinger?resource=acct:https://pawoo.net/users/pekorino",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -142,24 +142,11 @@ defmodule HttpRequestMock do
}}
end
- def get(
- "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
- _,
- _,
- _
- ) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body: File.read!("test/fixtures/tesla_mock/atarifrosch_feed.xml")
- }}
- end
-
def get(
"https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=acct:https://social.stopwatchingus-heidelberg.de/user/18330",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -168,32 +155,11 @@ defmodule HttpRequestMock do
}}
end
- def get("https://mamot.fr/users/Skruyb.atom", _, _, _) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___mamot.fr_users_Skruyb.atom")
- }}
- end
-
- def get(
- "https://mamot.fr/.well-known/webfinger?resource=acct:https://mamot.fr/users/Skruyb",
- _,
- _,
- Accept: "application/xrd+xml,application/jrd+json"
- ) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body: File.read!("test/fixtures/tesla_mock/skruyb@mamot.fr.atom")
- }}
- end
-
def get(
"https://social.heldscal.la/.well-known/webfinger?resource=nonexistant@social.heldscal.la",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -203,10 +169,10 @@ defmodule HttpRequestMock do
end
def get(
- "https://squeet.me/xrd/?uri=lain@squeet.me",
+ "https://squeet.me/xrd/?uri=acct:lain@squeet.me",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -219,7 +185,7 @@ defmodule HttpRequestMock do
"https://mst3k.interlinked.me/users/luciferMysticus",
_,
_,
- Accept: "application/activity+json"
+ [{"accept", "application/activity+json"}]
) do
{:ok,
%Tesla.Env{
@@ -240,7 +206,7 @@ defmodule HttpRequestMock do
"https://hubzilla.example.org/channel/kaniini",
_,
_,
- Accept: "application/activity+json"
+ [{"accept", "application/activity+json"}]
) do
{:ok,
%Tesla.Env{
@@ -249,7 +215,7 @@ defmodule HttpRequestMock do
}}
end
- def get("https://niu.moe/users/rye", _, _, Accept: "application/activity+json") do
+ def get("https://niu.moe/users/rye", _, _, [{"accept", "application/activity+json"}]) do
{:ok,
%Tesla.Env{
status: 200,
@@ -257,7 +223,7 @@ defmodule HttpRequestMock do
}}
end
- def get("https://n1u.moe/users/rye", _, _, Accept: "application/activity+json") do
+ def get("https://n1u.moe/users/rye", _, _, [{"accept", "application/activity+json"}]) do
{:ok,
%Tesla.Env{
status: 200,
@@ -276,7 +242,7 @@ defmodule HttpRequestMock do
}}
end
- def get("https://puckipedia.com/", _, _, Accept: "application/activity+json") do
+ def get("https://puckipedia.com/", _, _, [{"accept", "application/activity+json"}]) do
{:ok,
%Tesla.Env{
status: 200,
@@ -300,6 +266,56 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://framatube.org/accounts/framasoft", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/https___framatube.org_accounts_framasoft.json")
+ }}
+ end
+
+ def get("https://framatube.org/videos/watch/6050732a-8a7a-43d4-a6cd-809525a1d206", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/framatube.org-video.json")
+ }}
+ end
+
+ def get("https://peertube.social/accounts/craigmaloney", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/craigmaloney.json")
+ }}
+ end
+
+ def get("https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/peertube-social.json")
+ }}
+ end
+
+ def get("https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39", _, _, [
+ {"accept", "application/activity+json"}
+ ]) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json")
+ }}
+ end
+
+ def get("https://mobilizon.org/@tcit", _, _, [{"accept", "application/activity+json"}]) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json")
+ }}
+ end
+
def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _, _) do
{:ok,
%Tesla.Env{
@@ -332,7 +348,7 @@ defmodule HttpRequestMock do
}}
end
- def get("http://mastodon.example.org/users/admin", _, _, Accept: "application/activity+json") do
+ def get("http://mastodon.example.org/users/admin", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
@@ -340,24 +356,31 @@ defmodule HttpRequestMock do
}}
end
- def get("http://mastodon.example.org/users/gargron", _, _, Accept: "application/activity+json") do
+ def get("http://mastodon.example.org/users/relay", _, _, [
+ {"accept", "application/activity+json"}
+ ]) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/relay@mastdon.example.org.json")
+ }}
+ end
+
+ def get("http://mastodon.example.org/users/gargron", _, _, [
+ {"accept", "application/activity+json"}
+ ]) do
{:error, :nxdomain}
end
- def get(
- "http://mastodon.example.org/@admin/99541947525187367",
- _,
- _,
- Accept: "application/activity+json"
- ) do
+ def get("http://osada.macgirvin.com/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
- status: 200,
- body: File.read!("test/fixtures/mastodon-note-object.json")
+ status: 404,
+ body: ""
}}
end
- def get("http://mastodon.example.org/@admin/99541947525187368", _, _, _) do
+ def get("https://osada.macgirvin.com/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 404,
@@ -365,186 +388,279 @@ defmodule HttpRequestMock do
}}
end
- def get("https://shitposter.club/notice/7369654", _, _, _) do
+ def get("http://mastodon.sdf.org/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/7369654.html")
+ body: File.read!("test/fixtures/tesla_mock/sdf.org_host_meta")
}}
end
- def get("https://mstdn.io/users/mayuutann", _, _, Accept: "application/activity+json") do
+ def get("https://mastodon.sdf.org/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mayumayu.json")
+ body: File.read!("test/fixtures/tesla_mock/sdf.org_host_meta")
}}
end
def get(
- "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
+ "https://mastodon.sdf.org/.well-known/webfinger?resource=https://mastodon.sdf.org/users/snowdusk",
_,
_,
- Accept: "application/activity+json"
+ _
) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mayumayupost.json")
+ body: File.read!("test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json")
}}
end
- def get("https://pleroma.soykaf.com/users/lain/feed.atom", _, _, _) do
+ def get("http://mstdn.jp/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body:
- File.read!(
- "test/fixtures/tesla_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
- )
+ body: File.read!("test/fixtures/tesla_mock/mstdn.jp_host_meta")
}}
end
- def get(url, _, _, Accept: "application/xrd+xml,application/jrd+json")
- when url in [
- "https://pleroma.soykaf.com/.well-known/webfinger?resource=acct:https://pleroma.soykaf.com/users/lain",
- "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain"
- ] do
+ def get("https://mstdn.jp/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___pleroma.soykaf.com_users_lain.xml")
+ body: File.read!("test/fixtures/tesla_mock/mstdn.jp_host_meta")
}}
end
- def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _, _, _) do
+ def get("https://mstdn.jp/.well-known/webfinger?resource=kpherox@mstdn.jp", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body:
- File.read!(
- "test/fixtures/tesla_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
- )
+ body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml")
+ }}
+ end
+
+ def get("http://mamot.fr/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/mamot.fr_host_meta")
+ }}
+ end
+
+ def get("https://mamot.fr/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/mamot.fr_host_meta")
+ }}
+ end
+
+ def get("http://pawoo.net/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta")
+ }}
+ end
+
+ def get("https://pawoo.net/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta")
}}
end
def get(
- "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
+ "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ _
) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___shitposter.club_user_1.xml")
+ body: File.read!("test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json")
}}
end
- def get("https://shitposter.club/notice/2827873", _, _, _) do
+ def get("http://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___shitposter.club_notice_2827873.html")
+ body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta")
}}
end
- def get("https://shitposter.club/api/statuses/show/2827873.atom", _, _, _) do
+ def get("https://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body:
- File.read!(
- "test/fixtures/tesla_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
- )
+ body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta")
}}
end
- def get("https://testing.pleroma.lol/objects/b319022a-4946-44c5-9de9-34801f95507b", _, _, _) do
- {:ok, %Tesla.Env{status: 200}}
+ def get("http://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/soykaf.com_host_meta")
+ }}
+ end
+
+ def get("https://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/soykaf.com_host_meta")
+ }}
+ end
+
+ def get("http://social.stopwatchingus-heidelberg.de/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta")
+ }}
end
- def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _, _, _) do
+ def get("https://social.stopwatchingus-heidelberg.de/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/spc_5381.atom")
+ body: File.read!("test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta")
}}
end
def get(
- "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
+ "http://mastodon.example.org/@admin/99541947525187367",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ _
) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/spc_5381_xrd.xml")
+ body: File.read!("test/fixtures/mastodon-note-object.json")
}}
end
- def get("http://shitposter.club/.well-known/host-meta", _, _, _) do
+ def get("http://mastodon.example.org/@admin/99541947525187368", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 404,
+ body: ""
+ }}
+ end
+
+ def get("https://shitposter.club/notice/7369654", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/shitposter.club_host_meta")
+ body: File.read!("test/fixtures/tesla_mock/7369654.html")
}}
end
- def get("https://shitposter.club/api/statuses/show/7369654.atom", _, _, _) do
+ def get("https://mstdn.io/users/mayuutann", _, _, [{"accept", "application/activity+json"}]) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/7369654.atom")
+ body: File.read!("test/fixtures/tesla_mock/mayumayu.json")
}}
end
- def get("https://shitposter.club/notice/4027863", _, _, _) do
+ def get(
+ "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
+ _,
+ _,
+ [{"accept", "application/activity+json"}]
+ ) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/7369654.html")
+ body: File.read!("test/fixtures/tesla_mock/mayumayupost.json")
}}
end
- def get("https://social.sakamoto.gq/users/eal/feed.atom", _, _, _) do
+ def get(url, _, _, [{"accept", "application/xrd+xml,application/jrd+json"}])
+ when url in [
+ "https://pleroma.soykaf.com/.well-known/webfinger?resource=acct:https://pleroma.soykaf.com/users/lain",
+ "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain"
+ ] do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/sakamoto_eal_feed.atom")
+ body: File.read!("test/fixtures/tesla_mock/https___pleroma.soykaf.com_users_lain.xml")
}}
end
- def get("http://social.sakamoto.gq/.well-known/host-meta", _, _, _) do
+ def get(
+ "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
+ _,
+ _,
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
+ ) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/social.sakamoto.gq_host_meta")
+ body: File.read!("test/fixtures/tesla_mock/https___shitposter.club_user_1.xml")
}}
end
+ def get("https://testing.pleroma.lol/objects/b319022a-4946-44c5-9de9-34801f95507b", _, _, _) do
+ {:ok, %Tesla.Env{status: 200}}
+ end
+
def get(
- "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
+ "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/eal_sakamoto.xml")
+ body: File.read!("test/fixtures/tesla_mock/spc_5381_xrd.xml")
+ }}
+ end
+
+ def get("http://shitposter.club/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/shitposter.club_host_meta")
+ }}
+ end
+
+ def get("https://shitposter.club/notice/4027863", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/7369654.html")
+ }}
+ end
+
+ def get("http://social.sakamoto.gq/.well-known/host-meta", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/social.sakamoto.gq_host_meta")
}}
end
def get(
- "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
+ "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
_,
_,
- Accept: "application/atom+xml"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/sakamoto.atom")}}
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/eal_sakamoto.xml")
+ }}
end
def get("http://mastodon.social/.well-known/host-meta", _, _, _) do
@@ -559,7 +675,7 @@ defmodule HttpRequestMock do
"https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -581,7 +697,7 @@ defmodule HttpRequestMock do
"http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -595,33 +711,11 @@ defmodule HttpRequestMock do
"http://gs.example.org:4040/index.php/user/1",
_,
_,
- Accept: "application/activity+json"
+ [{"accept", "application/activity+json"}]
) do
{:ok, %Tesla.Env{status: 406, body: ""}}
end
- def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _, _, _) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body:
- File.read!(
- "test/fixtures/tesla_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
- )
- }}
- end
-
- def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _, _, _) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body:
- File.read!(
- "test/fixtures/tesla_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
- )
- }}
- end
-
def get("http://squeet.me/.well-known/host-meta", _, _, _) do
{:ok,
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/squeet.me_host_meta")}}
@@ -631,7 +725,7 @@ defmodule HttpRequestMock do
"https://squeet.me/xrd?uri=lain@squeet.me",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -641,10 +735,10 @@ defmodule HttpRequestMock do
end
def get(
- "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
+ "https://social.heldscal.la/.well-known/webfinger?resource=acct:shp@social.heldscal.la",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -654,10 +748,10 @@ defmodule HttpRequestMock do
end
def get(
- "https://social.heldscal.la/.well-known/webfinger?resource=invalid_content@social.heldscal.la",
+ "https://social.heldscal.la/.well-known/webfinger?resource=acct:invalid_content@social.heldscal.la",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok, %Tesla.Env{status: 200, body: ""}}
end
@@ -671,10 +765,10 @@ defmodule HttpRequestMock do
end
def get(
- "http://framatube.org/main/xrd?uri=framasoft@framatube.org",
+ "http://framatube.org/main/xrd?uri=acct:framasoft@framatube.org",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -696,7 +790,7 @@ defmodule HttpRequestMock do
"http://gnusocial.de/main/xrd?uri=winterdienst@gnusocial.de",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -730,10 +824,10 @@ defmodule HttpRequestMock do
end
def get(
- "https://gerzilla.de/xrd/?uri=kaniini@gerzilla.de",
+ "https://gerzilla.de/xrd/?uri=acct:kaniini@gerzilla.de",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -743,17 +837,6 @@ defmodule HttpRequestMock do
}}
end
- def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _, _, _) do
- {:ok,
- %Tesla.Env{
- status: 200,
- body:
- File.read!(
- "test/fixtures/tesla_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
- )
- }}
- end
-
def get(
"https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
_,
@@ -783,10 +866,6 @@ defmodule HttpRequestMock do
}}
end
- def get("https://mastodon.social/users/lambadalambda.atom", _, _, _) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.atom")}}
- end
-
def get("https://mastodon.social/users/lambadalambda", _, _, _) do
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.json")}}
end
@@ -796,7 +875,7 @@ defmodule HttpRequestMock do
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/osada-user-indio.json")}}
end
- def get("https://social.heldscal.la/user/23211", _, _, Accept: "application/activity+json") do
+ def get("https://social.heldscal.la/user/23211", _, _, [{"accept", "application/activity+json"}]) do
{:ok, Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)}
end
@@ -844,6 +923,22 @@ defmodule HttpRequestMock do
}}
end
+ def get("http://localhost:8080/followers/fuser3", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/users_mock/friendica_followers.json")
+ }}
+ end
+
+ def get("http://localhost:8080/following/fuser3", _, _, _) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/users_mock/friendica_following.json")
+ }}
+ end
+
def get("http://localhost:4001/users/fuser2/followers", _, _, _) do
{:ok,
%Tesla.Env{
@@ -910,10 +1005,10 @@ defmodule HttpRequestMock do
end
def get(
- "https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource=lain@zetsubou.xn--q9jyb4c",
+ "https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource=acct:lain@zetsubou.xn--q9jyb4c",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -923,10 +1018,10 @@ defmodule HttpRequestMock do
end
def get(
- "https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource=https://zetsubou.xn--q9jyb4c/users/lain",
+ "https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource=acct:https://zetsubou.xn--q9jyb4c/users/lain",
_,
_,
- Accept: "application/xrd+xml,application/jrd+json"
+ [{"accept", "application/xrd+xml,application/jrd+json"}]
) do
{:ok,
%Tesla.Env{
@@ -948,7 +1043,9 @@ defmodule HttpRequestMock do
}}
end
- def get("https://info.pleroma.site/activity.json", _, _, Accept: "application/activity+json") do
+ def get("https://info.pleroma.site/activity.json", _, _, [
+ {"accept", "application/activity+json"}
+ ]) do
{:ok,
%Tesla.Env{
status: 200,
@@ -960,7 +1057,9 @@ defmodule HttpRequestMock do
{:ok, %Tesla.Env{status: 404, body: ""}}
end
- def get("https://info.pleroma.site/activity2.json", _, _, Accept: "application/activity+json") do
+ def get("https://info.pleroma.site/activity2.json", _, _, [
+ {"accept", "application/activity+json"}
+ ]) do
{:ok,
%Tesla.Env{
status: 200,
@@ -972,7 +1071,9 @@ defmodule HttpRequestMock do
{:ok, %Tesla.Env{status: 404, body: ""}}
end
- def get("https://info.pleroma.site/activity3.json", _, _, Accept: "application/activity+json") do
+ def get("https://info.pleroma.site/activity3.json", _, _, [
+ {"accept", "application/activity+json"}
+ ]) do
{:ok,
%Tesla.Env{
status: 200,
@@ -992,6 +1093,30 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://10.111.10.1/notice/9kCP7V", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end
+
+ def get("https://172.16.32.40/notice/9kCP7V", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end
+
+ def get("https://192.168.10.40/notice/9kCP7V", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end
+
+ def get("https://www.patreon.com/posts/mastodon-2-9-and-28121681", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end
+
+ def get("http://mastodon.example.org/@admin/99541947525187367", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/mastodon-post-activity.json")}}
+ end
+
+ def get("https://info.pleroma.site/activity4.json", _, _, _) do
+ {:ok, %Tesla.Env{status: 500, body: "Error occurred"}}
+ 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
@@ -1016,6 +1141,10 @@ defmodule HttpRequestMock do
}}
end
+ def get("https://example.org/emoji/firedfox.png", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/image.jpg")}}
+ end
+
def get("https://skippers-bin.com/users/7v1w1r8ce6", _, _, _) do
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/sjw.json")}}
end
@@ -1024,6 +1153,41 @@ defmodule HttpRequestMock do
{:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/rin.json")}}
end
+ def get(
+ "https://channels.tests.funkwhale.audio/federation/music/uploads/42342395-0208-4fee-a38d-259a6dae0871",
+ _,
+ _,
+ _
+ ) do
+ {:ok,
+ %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/funkwhale_audio.json")}}
+ end
+
+ def get("https://channels.tests.funkwhale.audio/federation/actors/compositions", _, _, _) do
+ {:ok,
+ %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json")}}
+ end
+
+ def get("http://example.com/rel_me/error", _, _, _) do
+ {:ok, %Tesla.Env{status: 404, body: ""}}
+ end
+
+ def get("https://relay.mastodon.host/actor", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
+ end
+
+ def get("http://localhost:4001/", _, "", [{"accept", "text/html"}]) do
+ {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/7369654.html")}}
+ end
+
+ def get("https://osada.macgirvin.com/", _, "", [{"accept", "text/html"}]) do
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/https___osada.macgirvin.com.html")
+ }}
+ end
+
def get(url, query, body, headers) do
{:error,
"Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
@@ -1036,6 +1200,10 @@ defmodule HttpRequestMock do
def post(url, query \\ [], body \\ [], headers \\ [])
+ def post("https://relay.mastodon.host/inbox", _, _, _) do
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end
+
def post("http://example.org/needs_refresh", _, _, _) do
{:ok,
%Tesla.Env{