1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def get(url, body \\ [], headers \\ [])
6 def get("https://info.pleroma.site/activity.json", _, _) do
10 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
14 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
18 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
23 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
24 [Accept: "application/xrd+xml,application/jrd+json"],
30 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
35 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
36 [Accept: "application/xrd+xml,application/jrd+json"],
42 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
47 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
48 [Accept: "application/xrd+xml,application/jrd+json"],
54 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
59 "https://social.heldscal.la/.well-known/webfinger",
60 [Accept: "application/xrd+xml,application/jrd+json"],
61 params: [resource: "nonexistant@social.heldscal.la"],
67 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
72 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
73 [Accept: "application/xrd+xml,application/jrd+json"],
79 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
84 "https://social.heldscal.la/.well-known/webfinger",
85 [Accept: "application/xrd+xml,application/jrd+json"],
86 params: [resource: "shp@social.heldscal.la"],
92 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
97 "https://social.heldscal.la/.well-known/webfinger",
98 [Accept: "application/xrd+xml,application/jrd+json"],
99 params: [resource: "https://social.heldscal.la/user/23211"],
100 follow_redirect: true
105 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
110 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
111 [Accept: "application/xrd+xml,application/jrd+json"],
112 follow_redirect: true
117 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
122 "https://social.heldscal.la/.well-known/webfinger",
123 [Accept: "application/xrd+xml,application/jrd+json"],
124 params: [resource: "https://social.heldscal.la/user/29191"],
125 follow_redirect: true
130 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
135 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
136 [Accept: "application/xrd+xml,application/jrd+json"],
137 follow_redirect: true
142 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
147 "https://mastodon.social/.well-known/webfinger",
148 [Accept: "application/xrd+xml,application/jrd+json"],
149 params: [resource: "https://mastodon.social/users/lambadalambda"],
150 follow_redirect: true
157 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
163 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
164 [Accept: "application/xrd+xml,application/jrd+json"],
165 follow_redirect: true
172 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
178 "https://shitposter.club/.well-known/webfinger",
179 [Accept: "application/xrd+xml,application/jrd+json"],
180 params: [resource: "https://shitposter.club/user/1"],
181 follow_redirect: true
186 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
191 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
192 [Accept: "application/xrd+xml,application/jrd+json"],
193 follow_redirect: true
198 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
203 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
204 [Accept: "application/xrd+xml,application/jrd+json"],
205 follow_redirect: true
210 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
215 "http://gs.example.org/.well-known/webfinger",
216 [Accept: "application/xrd+xml,application/jrd+json"],
217 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
218 follow_redirect: true
225 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
231 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
232 [Accept: "application/xrd+xml,application/jrd+json"],
233 follow_redirect: true
240 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
246 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
247 [Accept: "application/xrd+xml,application/jrd+json"],
248 follow_redirect: true
253 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
258 "https://pleroma.soykaf.com/.well-known/webfinger",
259 [Accept: "application/xrd+xml,application/jrd+json"],
260 params: [resource: "https://pleroma.soykaf.com/users/lain"],
261 follow_redirect: true
266 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
271 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
272 [Accept: "application/xrd+xml,application/jrd+json"],
273 follow_redirect: true
278 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
282 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
288 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
293 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
297 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
301 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
307 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
312 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
318 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
324 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
331 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
335 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
341 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
346 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
350 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
354 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
360 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
365 def get("https://shitposter.club/notice/2827873", _body, _headers) do
370 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
374 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
380 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
385 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
391 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
397 "https://social.heldscal.la/main/push/hub",
399 "Content-type": "application/x-www-form-urlencoded"
407 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
413 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
419 "https://pawoo.net/.well-known/webfinger",
420 [Accept: "application/xrd+xml,application/jrd+json"],
421 params: [resource: "https://pawoo.net/users/pekorino"],
422 follow_redirect: true
427 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
432 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
433 [Accept: "application/xrd+xml,application/jrd+json"],
434 follow_redirect: true
439 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
443 def get("https://pawoo.net/users/pekorino.atom", _, _) do
447 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
452 "https://mamot.fr/.well-known/webfinger",
453 [Accept: "application/xrd+xml,application/jrd+json"],
454 params: [resource: "https://mamot.fr/users/Skruyb"],
455 follow_redirect: true
460 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
465 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
466 [Accept: "application/xrd+xml,application/jrd+json"],
467 follow_redirect: true
472 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
477 "https://social.sakamoto.gq/.well-known/webfinger",
478 [Accept: "application/xrd+xml,application/jrd+json"],
479 params: [resource: "https://social.sakamoto.gq/users/eal"],
480 follow_redirect: true
485 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
490 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
491 [Accept: "application/xrd+xml,application/jrd+json"],
492 follow_redirect: true
497 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
502 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
503 [Accept: "application/xrd+xml,application/jrd+json"],
504 follow_redirect: true
509 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
514 "https://squeet.me/xrd/?uri=lain@squeet.me",
515 [Accept: "application/xrd+xml,application/jrd+json"],
516 follow_redirect: true
521 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
525 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
529 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
534 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
535 [Accept: "application/atom+xml"],
541 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
545 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
549 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
553 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
557 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
561 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
565 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
569 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
573 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
577 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
581 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
585 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
589 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
593 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
597 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
601 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
605 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
609 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
613 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
617 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
621 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
625 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
629 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
633 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
637 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
641 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
645 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
649 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
653 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
658 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
660 follow_redirect: true
666 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
670 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
674 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
679 "https://hubzilla.example.org/channel/kaniini",
680 [Accept: "application/activity+json"],
686 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
690 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
694 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
698 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
702 body: File.read!("test/fixtures/httpoison_mock/rye.json")
707 "https://mst3k.interlinked.me/users/luciferMysticus",
708 [Accept: "application/activity+json"],
714 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
718 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
722 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
727 "http://mastodon.example.org/@admin/99541947525187367",
728 [Accept: "application/activity+json"],
734 body: File.read!("test/fixtures/mastodon-note-object.json")
739 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
740 [Accept: "application/activity+json"],
746 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
750 def get("https://shitposter.club/notice/7369654", _, _) do
754 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
758 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
762 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
766 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
770 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
774 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
778 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
782 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
786 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
790 def get("https://peertube.moe/accounts/7even", _, _) do
794 body: File.read!("test/fixtures/httpoison_mock/7even.json")
798 def get(url, body, headers) do
800 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
805 def post(url, _body, _headers) do
806 {:error, "Not implemented the mock response for post #{inspect(url)}"}
809 def post(url, _body, _headers, _options) do
810 {:error, "Not implemented the mock response for post #{inspect(url)}"}