1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule HttpRequestMock do
17 with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
21 with {:error, message} <- error do
22 Logger.warn(to_string(message))
31 def get(url, query \\ [], body \\ [], headers \\ [])
33 def get("https://osada.macgirvin.com/channel/mike", _, _, _) do
37 body: File.read!("test/fixtures/tesla_mock/https___osada.macgirvin.com_channel_mike.json")
41 def get("https://shitposter.club/users/moonman", _, _, _) do
45 body: File.read!("test/fixtures/tesla_mock/moonman@shitposter.club.json")
49 def get("https://mastodon.social/users/emelie/statuses/101849165031453009", _, _, _) do
53 body: File.read!("test/fixtures/tesla_mock/status.emelie.json")
57 def get("https://mastodon.social/users/emelie/statuses/101849165031453404", _, _, _) do
65 def get("https://mastodon.social/users/emelie", _, _, _) do
69 body: File.read!("test/fixtures/tesla_mock/emelie.json")
73 def get("https://mastodon.social/users/not_found", _, _, _) do
74 {:ok, %Tesla.Env{status: 404}}
77 def get("https://mastodon.sdf.org/users/rinpatch", _, _, _) do
81 body: File.read!("test/fixtures/tesla_mock/rinpatch.json")
85 def get("https://patch.cx/objects/tesla_mock/poll_attachment", _, _, _) do
89 body: File.read!("test/fixtures/tesla_mock/poll_attachment.json")
94 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/emelie",
102 body: File.read!("test/fixtures/tesla_mock/webfinger_emelie.json")
107 "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
110 [{"accept", "application/xrd+xml,application/jrd+json"}]
115 body: File.read!("test/fixtures/tesla_mock/mike@osada.macgirvin.com.json")
120 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
123 [{"accept", "application/xrd+xml,application/jrd+json"}]
128 body: File.read!("test/fixtures/tesla_mock/https___social.heldscal.la_user_29191.xml")
133 "https://pawoo.net/.well-known/webfinger?resource=acct:https://pawoo.net/users/pekorino",
136 [{"accept", "application/xrd+xml,application/jrd+json"}]
141 body: File.read!("test/fixtures/tesla_mock/https___pawoo.net_users_pekorino.xml")
146 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=acct:https://social.stopwatchingus-heidelberg.de/user/18330",
149 [{"accept", "application/xrd+xml,application/jrd+json"}]
154 body: File.read!("test/fixtures/tesla_mock/atarifrosch_webfinger.xml")
159 "https://social.heldscal.la/.well-known/webfinger?resource=nonexistant@social.heldscal.la",
162 [{"accept", "application/xrd+xml,application/jrd+json"}]
167 body: File.read!("test/fixtures/tesla_mock/nonexistant@social.heldscal.la.xml")
172 "https://squeet.me/xrd/?uri=acct:lain@squeet.me",
175 [{"accept", "application/xrd+xml,application/jrd+json"}]
180 body: File.read!("test/fixtures/tesla_mock/lain_squeet.me_webfinger.xml")
185 "https://mst3k.interlinked.me/users/luciferMysticus",
188 [{"accept", "application/activity+json"}]
193 body: File.read!("test/fixtures/tesla_mock/lucifermysticus.json")
197 def get("https://prismo.news/@mxb", _, _, _) do
201 body: File.read!("test/fixtures/tesla_mock/https___prismo.news__mxb.json")
206 "https://hubzilla.example.org/channel/kaniini",
209 [{"accept", "application/activity+json"}]
214 body: File.read!("test/fixtures/tesla_mock/kaniini@hubzilla.example.org.json")
218 def get("https://niu.moe/users/rye", _, _, [{"accept", "application/activity+json"}]) do
222 body: File.read!("test/fixtures/tesla_mock/rye.json")
226 def get("https://n1u.moe/users/rye", _, _, [{"accept", "application/activity+json"}]) do
230 body: File.read!("test/fixtures/tesla_mock/rye.json")
234 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _, _) do
240 "test/fixtures/tesla_mock/http___mastodon.example.org_users_admin_status_1234.json"
245 def get("https://puckipedia.com/", _, _, [{"accept", "application/activity+json"}]) do
249 body: File.read!("test/fixtures/tesla_mock/puckipedia.com.json")
253 def get("https://peertube.moe/accounts/7even", _, _, _) do
257 body: File.read!("test/fixtures/tesla_mock/7even.json")
261 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _, _) do
265 body: File.read!("test/fixtures/tesla_mock/peertube.moe-vid.json")
269 def get("https://framatube.org/accounts/framasoft", _, _, _) do
273 body: File.read!("test/fixtures/tesla_mock/https___framatube.org_accounts_framasoft.json")
277 def get("https://framatube.org/videos/watch/6050732a-8a7a-43d4-a6cd-809525a1d206", _, _, _) do
281 body: File.read!("test/fixtures/tesla_mock/framatube.org-video.json")
285 def get("https://peertube.social/accounts/craigmaloney", _, _, _) do
289 body: File.read!("test/fixtures/tesla_mock/craigmaloney.json")
293 def get("https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe", _, _, _) do
297 body: File.read!("test/fixtures/tesla_mock/peertube-social.json")
301 def get("https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39", _, _, [
302 {"accept", "application/activity+json"}
307 body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json")
311 def get("https://mobilizon.org/@tcit", _, _, [{"accept", "application/activity+json"}]) do
315 body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json")
319 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _, _) do
323 body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-user.json")
327 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _, _) do
331 body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-article.json")
335 def get("https://wedistribute.org/wp-json/pterotype/v1/object/85810", _, _, _) do
339 body: File.read!("test/fixtures/tesla_mock/wedistribute-article.json")
343 def get("https://wedistribute.org/wp-json/pterotype/v1/actor/-blog", _, _, _) do
347 body: File.read!("test/fixtures/tesla_mock/wedistribute-user.json")
351 def get("http://mastodon.example.org/users/admin", _, _, _) do
355 body: File.read!("test/fixtures/tesla_mock/admin@mastdon.example.org.json")
359 def get("http://mastodon.example.org/users/relay", _, _, [
360 {"accept", "application/activity+json"}
365 body: File.read!("test/fixtures/tesla_mock/relay@mastdon.example.org.json")
369 def get("http://mastodon.example.org/users/gargron", _, _, [
370 {"accept", "application/activity+json"}
375 def get("http://osada.macgirvin.com/.well-known/host-meta", _, _, _) do
383 def get("https://osada.macgirvin.com/.well-known/host-meta", _, _, _) do
391 def get("http://mastodon.sdf.org/.well-known/host-meta", _, _, _) do
395 body: File.read!("test/fixtures/tesla_mock/sdf.org_host_meta")
399 def get("https://mastodon.sdf.org/.well-known/host-meta", _, _, _) do
403 body: File.read!("test/fixtures/tesla_mock/sdf.org_host_meta")
408 "https://mastodon.sdf.org/.well-known/webfinger?resource=https://mastodon.sdf.org/users/snowdusk",
416 body: File.read!("test/fixtures/tesla_mock/snowdusk@sdf.org_host_meta.json")
420 def get("http://mstdn.jp/.well-known/host-meta", _, _, _) do
424 body: File.read!("test/fixtures/tesla_mock/mstdn.jp_host_meta")
428 def get("https://mstdn.jp/.well-known/host-meta", _, _, _) do
432 body: File.read!("test/fixtures/tesla_mock/mstdn.jp_host_meta")
436 def get("https://mstdn.jp/.well-known/webfinger?resource=kpherox@mstdn.jp", _, _, _) do
440 body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml")
444 def get("http://mamot.fr/.well-known/host-meta", _, _, _) do
448 body: File.read!("test/fixtures/tesla_mock/mamot.fr_host_meta")
452 def get("https://mamot.fr/.well-known/host-meta", _, _, _) do
456 body: File.read!("test/fixtures/tesla_mock/mamot.fr_host_meta")
460 def get("http://pawoo.net/.well-known/host-meta", _, _, _) do
464 body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta")
468 def get("https://pawoo.net/.well-known/host-meta", _, _, _) do
472 body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta")
477 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
485 body: File.read!("test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json")
489 def get("http://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do
493 body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta")
497 def get("https://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do
501 body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta")
505 def get("http://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do
509 body: File.read!("test/fixtures/tesla_mock/soykaf.com_host_meta")
513 def get("https://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do
517 body: File.read!("test/fixtures/tesla_mock/soykaf.com_host_meta")
521 def get("http://social.stopwatchingus-heidelberg.de/.well-known/host-meta", _, _, _) do
525 body: File.read!("test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta")
529 def get("https://social.stopwatchingus-heidelberg.de/.well-known/host-meta", _, _, _) do
533 body: File.read!("test/fixtures/tesla_mock/stopwatchingus-heidelberg.de_host_meta")
538 "http://mastodon.example.org/@admin/99541947525187367",
546 body: File.read!("test/fixtures/mastodon-note-object.json")
550 def get("http://mastodon.example.org/@admin/99541947525187368", _, _, _) do
558 def get("https://shitposter.club/notice/7369654", _, _, _) do
562 body: File.read!("test/fixtures/tesla_mock/7369654.html")
566 def get("https://mstdn.io/users/mayuutann", _, _, [{"accept", "application/activity+json"}]) do
570 body: File.read!("test/fixtures/tesla_mock/mayumayu.json")
575 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
578 [{"accept", "application/activity+json"}]
583 body: File.read!("test/fixtures/tesla_mock/mayumayupost.json")
587 def get(url, _, _, [{"accept", "application/xrd+xml,application/jrd+json"}])
589 "https://pleroma.soykaf.com/.well-known/webfinger?resource=acct:https://pleroma.soykaf.com/users/lain",
590 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain"
595 body: File.read!("test/fixtures/tesla_mock/https___pleroma.soykaf.com_users_lain.xml")
600 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
603 [{"accept", "application/xrd+xml,application/jrd+json"}]
608 body: File.read!("test/fixtures/tesla_mock/https___shitposter.club_user_1.xml")
612 def get("https://testing.pleroma.lol/objects/b319022a-4946-44c5-9de9-34801f95507b", _, _, _) do
613 {:ok, %Tesla.Env{status: 200}}
617 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
620 [{"accept", "application/xrd+xml,application/jrd+json"}]
625 body: File.read!("test/fixtures/tesla_mock/spc_5381_xrd.xml")
629 def get("http://shitposter.club/.well-known/host-meta", _, _, _) do
633 body: File.read!("test/fixtures/tesla_mock/shitposter.club_host_meta")
637 def get("https://shitposter.club/notice/4027863", _, _, _) do
641 body: File.read!("test/fixtures/tesla_mock/7369654.html")
645 def get("http://social.sakamoto.gq/.well-known/host-meta", _, _, _) do
649 body: File.read!("test/fixtures/tesla_mock/social.sakamoto.gq_host_meta")
654 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
657 [{"accept", "application/xrd+xml,application/jrd+json"}]
662 body: File.read!("test/fixtures/tesla_mock/eal_sakamoto.xml")
666 def get("http://mastodon.social/.well-known/host-meta", _, _, _) do
670 body: File.read!("test/fixtures/tesla_mock/mastodon.social_host_meta")
675 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
678 [{"accept", "application/xrd+xml,application/jrd+json"}]
684 File.read!("test/fixtures/tesla_mock/https___mastodon.social_users_lambadalambda.xml")
688 def get("http://gs.example.org/.well-known/host-meta", _, _, _) do
692 body: File.read!("test/fixtures/tesla_mock/gs.example.org_host_meta")
697 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
700 [{"accept", "application/xrd+xml,application/jrd+json"}]
706 File.read!("test/fixtures/tesla_mock/http___gs.example.org_4040_index.php_user_1.xml")
711 "http://gs.example.org:4040/index.php/user/1",
714 [{"accept", "application/activity+json"}]
716 {:ok, %Tesla.Env{status: 406, body: ""}}
719 def get("http://squeet.me/.well-known/host-meta", _, _, _) do
721 %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/squeet.me_host_meta")}}
725 "https://squeet.me/xrd?uri=lain@squeet.me",
728 [{"accept", "application/xrd+xml,application/jrd+json"}]
733 body: File.read!("test/fixtures/tesla_mock/lain_squeet.me_webfinger.xml")
738 "https://social.heldscal.la/.well-known/webfinger?resource=acct:shp@social.heldscal.la",
741 [{"accept", "application/xrd+xml,application/jrd+json"}]
746 body: File.read!("test/fixtures/tesla_mock/shp@social.heldscal.la.xml")
751 "https://social.heldscal.la/.well-known/webfinger?resource=acct:invalid_content@social.heldscal.la",
754 [{"accept", "application/xrd+xml,application/jrd+json"}]
756 {:ok, %Tesla.Env{status: 200, body: ""}}
759 def get("http://framatube.org/.well-known/host-meta", _, _, _) do
763 body: File.read!("test/fixtures/tesla_mock/framatube.org_host_meta")
768 "http://framatube.org/main/xrd?uri=acct:framasoft@framatube.org",
771 [{"accept", "application/xrd+xml,application/jrd+json"}]
776 headers: [{"content-type", "application/json"}],
777 body: File.read!("test/fixtures/tesla_mock/framasoft@framatube.org.json")
781 def get("http://gnusocial.de/.well-known/host-meta", _, _, _) do
785 body: File.read!("test/fixtures/tesla_mock/gnusocial.de_host_meta")
790 "http://gnusocial.de/main/xrd?uri=winterdienst@gnusocial.de",
793 [{"accept", "application/xrd+xml,application/jrd+json"}]
798 body: File.read!("test/fixtures/tesla_mock/winterdienst_webfinger.json")
802 def get("http://status.alpicola.com/.well-known/host-meta", _, _, _) do
806 body: File.read!("test/fixtures/tesla_mock/status.alpicola.com_host_meta")
810 def get("http://macgirvin.com/.well-known/host-meta", _, _, _) do
814 body: File.read!("test/fixtures/tesla_mock/macgirvin.com_host_meta")
818 def get("http://gerzilla.de/.well-known/host-meta", _, _, _) do
822 body: File.read!("test/fixtures/tesla_mock/gerzilla.de_host_meta")
827 "https://gerzilla.de/xrd/?uri=acct:kaniini@gerzilla.de",
830 [{"accept", "application/xrd+xml,application/jrd+json"}]
835 headers: [{"content-type", "application/json"}],
836 body: File.read!("test/fixtures/tesla_mock/kaniini@gerzilla.de.json")
841 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
849 body: File.read!("test/fixtures/tesla_mock/https___social.heldscal.la_user_23211.xml")
853 def get("http://social.heldscal.la/.well-known/host-meta", _, _, _) do
857 body: File.read!("test/fixtures/tesla_mock/social.heldscal.la_host_meta")
861 def get("https://social.heldscal.la/.well-known/host-meta", _, _, _) do
865 body: File.read!("test/fixtures/tesla_mock/social.heldscal.la_host_meta")
869 def get("https://mastodon.social/users/lambadalambda", _, _, _) do
870 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.json")}}
873 def get("https://apfed.club/channel/indio", _, _, _) do
875 %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/osada-user-indio.json")}}
878 def get("https://social.heldscal.la/user/23211", _, _, [{"accept", "application/activity+json"}]) do
879 {:ok, Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)}
882 def get("http://example.com/ogp", _, _, _) do
883 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}}
886 def get("https://example.com/ogp", _, _, _) do
887 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}}
890 def get("https://pleroma.local/notice/9kCP7V", _, _, _) do
891 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}}
894 def get("http://localhost:4001/users/masto_closed/followers", _, _, _) do
898 body: File.read!("test/fixtures/users_mock/masto_closed_followers.json")
902 def get("http://localhost:4001/users/masto_closed/followers?page=1", _, _, _) do
906 body: File.read!("test/fixtures/users_mock/masto_closed_followers_page.json")
910 def get("http://localhost:4001/users/masto_closed/following", _, _, _) do
914 body: File.read!("test/fixtures/users_mock/masto_closed_following.json")
918 def get("http://localhost:4001/users/masto_closed/following?page=1", _, _, _) do
922 body: File.read!("test/fixtures/users_mock/masto_closed_following_page.json")
926 def get("http://localhost:8080/followers/fuser3", _, _, _) do
930 body: File.read!("test/fixtures/users_mock/friendica_followers.json")
934 def get("http://localhost:8080/following/fuser3", _, _, _) do
938 body: File.read!("test/fixtures/users_mock/friendica_following.json")
942 def get("http://localhost:4001/users/fuser2/followers", _, _, _) do
946 body: File.read!("test/fixtures/users_mock/pleroma_followers.json")
950 def get("http://localhost:4001/users/fuser2/following", _, _, _) do
954 body: File.read!("test/fixtures/users_mock/pleroma_following.json")
958 def get("http://domain-with-errors:4001/users/fuser1/followers", _, _, _) do
966 def get("http://domain-with-errors:4001/users/fuser1/following", _, _, _) do
974 def get("http://example.com/ogp-missing-data", _, _, _) do
978 body: File.read!("test/fixtures/rich_media/ogp-missing-data.html")
982 def get("https://example.com/ogp-missing-data", _, _, _) do
986 body: File.read!("test/fixtures/rich_media/ogp-missing-data.html")
990 def get("http://example.com/malformed", _, _, _) do
992 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/malformed-data.html")}}
995 def get("http://example.com/empty", _, _, _) do
996 {:ok, %Tesla.Env{status: 200, body: "hello"}}
999 def get("http://404.site" <> _, _, _, _) do
1008 "https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource=acct:lain@zetsubou.xn--q9jyb4c",
1011 [{"accept", "application/xrd+xml,application/jrd+json"}]
1016 body: File.read!("test/fixtures/lain.xml")
1021 "https://zetsubou.xn--q9jyb4c/.well-known/webfinger?resource=acct:https://zetsubou.xn--q9jyb4c/users/lain",
1024 [{"accept", "application/xrd+xml,application/jrd+json"}]
1029 body: File.read!("test/fixtures/lain.xml")
1034 "https://zetsubou.xn--q9jyb4c/.well-known/host-meta",
1042 body: File.read!("test/fixtures/host-meta-zetsubou.xn--q9jyb4c.xml")
1046 def get("https://info.pleroma.site/activity.json", _, _, [
1047 {"accept", "application/activity+json"}
1052 body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity.json")
1056 def get("https://info.pleroma.site/activity.json", _, _, _) do
1057 {:ok, %Tesla.Env{status: 404, body: ""}}
1060 def get("https://info.pleroma.site/activity2.json", _, _, [
1061 {"accept", "application/activity+json"}
1066 body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity2.json")
1070 def get("https://info.pleroma.site/activity2.json", _, _, _) do
1071 {:ok, %Tesla.Env{status: 404, body: ""}}
1074 def get("https://info.pleroma.site/activity3.json", _, _, [
1075 {"accept", "application/activity+json"}
1080 body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity3.json")
1084 def get("https://info.pleroma.site/activity3.json", _, _, _) do
1085 {:ok, %Tesla.Env{status: 404, body: ""}}
1088 def get("https://mstdn.jp/.well-known/webfinger?resource=acct:kpherox@mstdn.jp", _, _, _) do
1092 body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml")
1096 def get("https://10.111.10.1/notice/9kCP7V", _, _, _) do
1097 {:ok, %Tesla.Env{status: 200, body: ""}}
1100 def get("https://172.16.32.40/notice/9kCP7V", _, _, _) do
1101 {:ok, %Tesla.Env{status: 200, body: ""}}
1104 def get("https://192.168.10.40/notice/9kCP7V", _, _, _) do
1105 {:ok, %Tesla.Env{status: 200, body: ""}}
1108 def get("https://www.patreon.com/posts/mastodon-2-9-and-28121681", _, _, _) do
1109 {:ok, %Tesla.Env{status: 200, body: ""}}
1112 def get("http://mastodon.example.org/@admin/99541947525187367", _, _, _) do
1113 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/mastodon-post-activity.json")}}
1116 def get("https://info.pleroma.site/activity4.json", _, _, _) do
1117 {:ok, %Tesla.Env{status: 500, body: "Error occurred"}}
1120 def get("http://example.com/rel_me/anchor", _, _, _) do
1121 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor.html")}}
1124 def get("http://example.com/rel_me/anchor_nofollow", _, _, _) do
1125 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor_nofollow.html")}}
1128 def get("http://example.com/rel_me/link", _, _, _) do
1129 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_link.html")}}
1132 def get("http://example.com/rel_me/null", _, _, _) do
1133 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_null.html")}}
1136 def get("https://skippers-bin.com/notes/7x9tmrp97i", _, _, _) do
1140 body: File.read!("test/fixtures/tesla_mock/misskey_poll_no_end_date.json")
1144 def get("https://example.org/emoji/firedfox.png", _, _, _) do
1145 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/image.jpg")}}
1148 def get("https://skippers-bin.com/users/7v1w1r8ce6", _, _, _) do
1149 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/sjw.json")}}
1152 def get("https://patch.cx/users/rin", _, _, _) do
1153 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/rin.json")}}
1157 "https://channels.tests.funkwhale.audio/federation/music/uploads/42342395-0208-4fee-a38d-259a6dae0871",
1163 %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/funkwhale_audio.json")}}
1166 def get("https://channels.tests.funkwhale.audio/federation/actors/compositions", _, _, _) do
1168 %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json")}}
1171 def get("http://example.com/rel_me/error", _, _, _) do
1172 {:ok, %Tesla.Env{status: 404, body: ""}}
1175 def get("https://relay.mastodon.host/actor", _, _, _) do
1176 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
1179 def get("http://localhost:4001/", _, "", [{"accept", "text/html"}]) do
1180 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/7369654.html")}}
1183 def get("https://osada.macgirvin.com/", _, "", [{"accept", "text/html"}]) do
1187 body: File.read!("test/fixtures/tesla_mock/https___osada.macgirvin.com.html")
1191 def get(url, query, body, headers) do
1193 "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
1201 def post(url, query \\ [], body \\ [], headers \\ [])
1203 def post("https://relay.mastodon.host/inbox", _, _, _) do
1204 {:ok, %Tesla.Env{status: 200, body: ""}}
1207 def post("http://example.org/needs_refresh", _, _, _) do
1215 def post("http://mastodon.example.org/inbox", _, _, _) do
1223 def post("https://hubzilla.example.org/inbox", _, _, _) do
1231 def post("http://gs.example.org/index.php/main/salmon/user/1", _, _, _) do
1239 def post("http://200.site" <> _, _, _, _) do
1247 def post("http://connrefused.site" <> _, _, _, _) do
1248 {:error, :connrefused}
1251 def post("http://404.site" <> _, _, _, _) do
1259 def post(url, query, body, headers) do
1261 "Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{
1266 # Most of the rich media mocks are missing HEAD requests, so we just return 404.
1268 "https://example.com/ogp",
1269 "https://example.com/ogp-missing-data",
1270 "https://example.com/twitter-card"
1272 def head(url, _query, _body, _headers) when url in @rich_media_mocks do
1273 {:ok, %Tesla.Env{status: 404, body: ""}}
1276 def head(url, query, body, headers) do
1278 "Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{