1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def get(url, body \\ [], headers \\ [])
6 def get("https://osada.macgirvin.com/channel/mike", _, _) do
11 File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json")
16 "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
23 body: File.read!("test/fixtures/httpoison_mock/mike@osada.macgirvin.com.json")
27 def get("https://info.pleroma.site/activity.json", _, _) do
31 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
35 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
39 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
44 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
45 [Accept: "application/xrd+xml,application/jrd+json"],
51 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
56 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
57 [Accept: "application/xrd+xml,application/jrd+json"],
63 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
68 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
69 [Accept: "application/xrd+xml,application/jrd+json"],
75 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
80 "https://social.heldscal.la/.well-known/webfinger",
81 [Accept: "application/xrd+xml,application/jrd+json"],
82 params: [resource: "nonexistant@social.heldscal.la"],
88 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
93 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
94 [Accept: "application/xrd+xml,application/jrd+json"],
100 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
105 "https://social.heldscal.la/.well-known/webfinger",
106 [Accept: "application/xrd+xml,application/jrd+json"],
107 params: [resource: "shp@social.heldscal.la"],
108 follow_redirect: true
113 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
118 "https://social.heldscal.la/.well-known/webfinger",
119 [Accept: "application/xrd+xml,application/jrd+json"],
120 params: [resource: "https://social.heldscal.la/user/23211"],
121 follow_redirect: true
126 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
131 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
132 [Accept: "application/xrd+xml,application/jrd+json"],
133 follow_redirect: true
138 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
143 "https://social.heldscal.la/.well-known/webfinger",
144 [Accept: "application/xrd+xml,application/jrd+json"],
145 params: [resource: "https://social.heldscal.la/user/29191"],
146 follow_redirect: true
151 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
156 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
157 [Accept: "application/xrd+xml,application/jrd+json"],
158 follow_redirect: true
163 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
168 "https://mastodon.social/.well-known/webfinger",
169 [Accept: "application/xrd+xml,application/jrd+json"],
170 params: [resource: "https://mastodon.social/users/lambadalambda"],
171 follow_redirect: true
178 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
184 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
185 [Accept: "application/xrd+xml,application/jrd+json"],
186 follow_redirect: true
193 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
199 "https://shitposter.club/.well-known/webfinger",
200 [Accept: "application/xrd+xml,application/jrd+json"],
201 params: [resource: "https://shitposter.club/user/1"],
202 follow_redirect: true
207 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
212 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
213 [Accept: "application/xrd+xml,application/jrd+json"],
214 follow_redirect: true
219 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
224 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
225 [Accept: "application/xrd+xml,application/jrd+json"],
226 follow_redirect: true
231 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
236 "http://gs.example.org/.well-known/webfinger",
237 [Accept: "application/xrd+xml,application/jrd+json"],
238 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
239 follow_redirect: true
246 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
252 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
253 [Accept: "application/xrd+xml,application/jrd+json"],
254 follow_redirect: true
261 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
267 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
268 [Accept: "application/xrd+xml,application/jrd+json"],
269 follow_redirect: true
274 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
279 "https://pleroma.soykaf.com/.well-known/webfinger",
280 [Accept: "application/xrd+xml,application/jrd+json"],
281 params: [resource: "https://pleroma.soykaf.com/users/lain"],
282 follow_redirect: true
287 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
292 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
293 [Accept: "application/xrd+xml,application/jrd+json"],
294 follow_redirect: true
299 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
303 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
309 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
314 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
318 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
322 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
328 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
333 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
339 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
345 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
352 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
356 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
362 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
367 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
371 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
375 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
381 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
386 def get("https://shitposter.club/notice/2827873", _body, _headers) do
391 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
395 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
401 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
406 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
412 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
418 "https://social.heldscal.la/main/push/hub",
420 "Content-type": "application/x-www-form-urlencoded"
428 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
434 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
440 "https://pawoo.net/.well-known/webfinger",
441 [Accept: "application/xrd+xml,application/jrd+json"],
442 params: [resource: "https://pawoo.net/users/pekorino"],
443 follow_redirect: true
448 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
453 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
454 [Accept: "application/xrd+xml,application/jrd+json"],
455 follow_redirect: true
460 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
464 def get("https://pawoo.net/users/pekorino.atom", _, _) do
468 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
473 "https://mamot.fr/.well-known/webfinger",
474 [Accept: "application/xrd+xml,application/jrd+json"],
475 params: [resource: "https://mamot.fr/users/Skruyb"],
476 follow_redirect: true
481 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
486 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
487 [Accept: "application/xrd+xml,application/jrd+json"],
488 follow_redirect: true
493 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
498 "https://social.sakamoto.gq/.well-known/webfinger",
499 [Accept: "application/xrd+xml,application/jrd+json"],
500 params: [resource: "https://social.sakamoto.gq/users/eal"],
501 follow_redirect: true
506 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
511 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
512 [Accept: "application/xrd+xml,application/jrd+json"],
513 follow_redirect: true
518 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
523 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
524 [Accept: "application/xrd+xml,application/jrd+json"],
525 follow_redirect: true
530 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
535 "https://squeet.me/xrd/?uri=lain@squeet.me",
536 [Accept: "application/xrd+xml,application/jrd+json"],
537 follow_redirect: true
542 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
546 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
550 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
555 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
556 [Accept: "application/atom+xml"],
562 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
566 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
570 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
574 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
578 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
582 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
586 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
590 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
594 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
598 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
602 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
606 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
610 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
614 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
622 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
630 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
638 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
642 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
646 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
650 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
654 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
658 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
662 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
666 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
670 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
674 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
679 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
681 follow_redirect: true
687 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
691 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
695 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
700 "https://hubzilla.example.org/channel/kaniini",
701 [Accept: "application/activity+json"],
707 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
711 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
715 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
719 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
723 body: File.read!("test/fixtures/httpoison_mock/rye.json")
728 "https://mst3k.interlinked.me/users/luciferMysticus",
729 [Accept: "application/activity+json"],
735 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
739 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
743 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
748 "http://mastodon.example.org/@admin/99541947525187367",
749 [Accept: "application/activity+json"],
755 body: File.read!("test/fixtures/mastodon-note-object.json")
760 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
761 [Accept: "application/activity+json"],
767 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
771 def get("https://shitposter.club/notice/7369654", _, _) do
775 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
779 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
783 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
787 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
791 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
795 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
799 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
803 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
807 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
811 def get("https://peertube.moe/accounts/7even", _, _) do
815 body: File.read!("test/fixtures/httpoison_mock/7even.json")
819 def get(url, body, headers) do
821 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
826 def post(url, _body, _headers) do
827 {:error, "Not implemented the mock response for post #{inspect(url)}"}
830 def post(url, _body, _headers, _options) do
831 {:error, "Not implemented the mock response for post #{inspect(url)}"}