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"
408 "https://pawoo.net/.well-known/webfinger",
409 [Accept: "application/xrd+xml,application/jrd+json"],
410 params: [resource: "https://pawoo.net/users/pekorino"],
411 follow_redirect: true
416 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
421 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
422 [Accept: "application/xrd+xml,application/jrd+json"],
423 follow_redirect: true
428 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
432 def get("https://pawoo.net/users/pekorino.atom", _, _) do
436 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
441 "https://mamot.fr/.well-known/webfinger",
442 [Accept: "application/xrd+xml,application/jrd+json"],
443 params: [resource: "https://mamot.fr/users/Skruyb"],
444 follow_redirect: true
449 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
454 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
455 [Accept: "application/xrd+xml,application/jrd+json"],
456 follow_redirect: true
461 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
466 "https://social.sakamoto.gq/.well-known/webfinger",
467 [Accept: "application/xrd+xml,application/jrd+json"],
468 params: [resource: "https://social.sakamoto.gq/users/eal"],
469 follow_redirect: true
474 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
479 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
480 [Accept: "application/xrd+xml,application/jrd+json"],
481 follow_redirect: true
486 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
491 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
492 [Accept: "application/xrd+xml,application/jrd+json"],
493 follow_redirect: true
498 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
503 "https://squeet.me/xrd/?uri=lain@squeet.me",
504 [Accept: "application/xrd+xml,application/jrd+json"],
505 follow_redirect: true
510 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
514 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
518 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
523 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
524 [Accept: "application/atom+xml"],
530 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
534 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
538 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
542 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
546 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
550 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
554 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
558 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
562 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
566 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
570 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
574 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
578 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
582 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
586 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
590 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
594 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
598 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
602 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
606 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
610 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
614 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
622 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
630 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
638 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
642 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
647 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
649 follow_redirect: true
655 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
659 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
663 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
668 "https://hubzilla.example.org/channel/kaniini",
669 [Accept: "application/activity+json"],
675 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
679 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
683 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
687 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
691 body: File.read!("test/fixtures/httpoison_mock/rye.json")
696 "https://mst3k.interlinked.me/users/luciferMysticus",
697 [Accept: "application/activity+json"],
703 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
707 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
711 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
716 "http://mastodon.example.org/@admin/99541947525187367",
717 [Accept: "application/activity+json"],
723 body: File.read!("test/fixtures/mastodon-note-object.json")
728 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
729 [Accept: "application/activity+json"],
735 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
739 def get("https://shitposter.club/notice/7369654", _, _) do
743 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
747 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
751 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
755 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
759 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
763 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
767 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
771 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
775 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
779 def get("https://peertube.moe/accounts/7even", _, _) do
783 body: File.read!("test/fixtures/httpoison_mock/7even.json")
787 def get(url, body, headers) do
789 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
794 def post(url, _body, _headers) do
795 {:error, "Not implemented the mock response for post #{inspect(url)}"}
798 def post(url, _body, _headers, _options) do
799 {:error, "Not implemented the mock response for post #{inspect(url)}"}