1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def get(url, body \\ [], headers \\ [])
6 def get("https://prismo.news/@mxb", _, _) do
10 body: File.read!("test/fixtures/httpoison_mock/https___prismo.news__mxb.json")
14 def get("https://osada.macgirvin.com/channel/mike", _, _) do
19 File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json")
24 "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
31 body: File.read!("test/fixtures/httpoison_mock/mike@osada.macgirvin.com.json")
35 def get("https://info.pleroma.site/activity.json", _, _) do
39 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
43 def get("https://info.pleroma.site/activity2.json", _, _) do
47 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json")
51 def get("https://info.pleroma.site/activity3.json", _, _) do
55 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity3.json")
59 def get("https://info.pleroma.site/activity4.json", _, _) do
63 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity4.json")
67 def get("https://info.pleroma.site/actor.json", _, _) do
71 body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
75 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
79 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
84 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
85 [Accept: "application/xrd+xml,application/jrd+json"],
91 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
96 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
97 [Accept: "application/xrd+xml,application/jrd+json"],
103 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
108 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
109 [Accept: "application/xrd+xml,application/jrd+json"],
110 follow_redirect: true
115 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
120 "https://social.heldscal.la/.well-known/webfinger",
121 [Accept: "application/xrd+xml,application/jrd+json"],
122 params: [resource: "nonexistant@social.heldscal.la"],
123 follow_redirect: true
128 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
133 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
134 [Accept: "application/xrd+xml,application/jrd+json"],
135 follow_redirect: true
140 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
145 "https://social.heldscal.la/.well-known/webfinger",
146 [Accept: "application/xrd+xml,application/jrd+json"],
147 params: [resource: "shp@social.heldscal.la"],
148 follow_redirect: true
153 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
158 "https://social.heldscal.la/.well-known/webfinger",
159 [Accept: "application/xrd+xml,application/jrd+json"],
160 params: [resource: "https://social.heldscal.la/user/23211"],
161 follow_redirect: true
166 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
171 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
172 [Accept: "application/xrd+xml,application/jrd+json"],
173 follow_redirect: true
178 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
183 "https://social.heldscal.la/.well-known/webfinger",
184 [Accept: "application/xrd+xml,application/jrd+json"],
185 params: [resource: "https://social.heldscal.la/user/29191"],
186 follow_redirect: true
191 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
196 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
197 [Accept: "application/xrd+xml,application/jrd+json"],
198 follow_redirect: true
203 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
208 "https://mastodon.social/.well-known/webfinger",
209 [Accept: "application/xrd+xml,application/jrd+json"],
210 params: [resource: "https://mastodon.social/users/lambadalambda"],
211 follow_redirect: true
218 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
224 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
225 [Accept: "application/xrd+xml,application/jrd+json"],
226 follow_redirect: true
233 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
239 "https://shitposter.club/.well-known/webfinger",
240 [Accept: "application/xrd+xml,application/jrd+json"],
241 params: [resource: "https://shitposter.club/user/1"],
242 follow_redirect: true
247 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
252 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
253 [Accept: "application/xrd+xml,application/jrd+json"],
254 follow_redirect: true
259 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
264 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
265 [Accept: "application/xrd+xml,application/jrd+json"],
266 follow_redirect: true
271 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
276 "http://gs.example.org/.well-known/webfinger",
277 [Accept: "application/xrd+xml,application/jrd+json"],
278 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
279 follow_redirect: true
286 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
292 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
293 [Accept: "application/xrd+xml,application/jrd+json"],
294 follow_redirect: true
301 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
307 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
308 [Accept: "application/xrd+xml,application/jrd+json"],
309 follow_redirect: true
314 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
319 "https://pleroma.soykaf.com/.well-known/webfinger",
320 [Accept: "application/xrd+xml,application/jrd+json"],
321 params: [resource: "https://pleroma.soykaf.com/users/lain"],
322 follow_redirect: true
327 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
332 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
333 [Accept: "application/xrd+xml,application/jrd+json"],
334 follow_redirect: true
339 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
343 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
349 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
354 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
358 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
362 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
368 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
373 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
379 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
385 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
392 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
396 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
402 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
407 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
411 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
415 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
421 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
426 def get("https://shitposter.club/notice/2827873", _body, _headers) do
431 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
435 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
441 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
446 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
452 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
458 "https://social.heldscal.la/main/push/hub",
460 "Content-type": "application/x-www-form-urlencoded"
468 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
474 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
480 "https://pawoo.net/.well-known/webfinger",
481 [Accept: "application/xrd+xml,application/jrd+json"],
482 params: [resource: "https://pawoo.net/users/pekorino"],
483 follow_redirect: true
488 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
493 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
494 [Accept: "application/xrd+xml,application/jrd+json"],
495 follow_redirect: true
500 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
504 def get("https://pawoo.net/users/pekorino.atom", _, _) do
508 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
513 "https://mamot.fr/.well-known/webfinger",
514 [Accept: "application/xrd+xml,application/jrd+json"],
515 params: [resource: "https://mamot.fr/users/Skruyb"],
516 follow_redirect: true
521 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
526 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
527 [Accept: "application/xrd+xml,application/jrd+json"],
528 follow_redirect: true
533 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
538 "https://social.sakamoto.gq/.well-known/webfinger",
539 [Accept: "application/xrd+xml,application/jrd+json"],
540 params: [resource: "https://social.sakamoto.gq/users/eal"],
541 follow_redirect: true
546 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
551 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
552 [Accept: "application/xrd+xml,application/jrd+json"],
553 follow_redirect: true
558 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
563 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
564 [Accept: "application/xrd+xml,application/jrd+json"],
565 follow_redirect: true
570 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
575 "https://squeet.me/xrd/?uri=lain@squeet.me",
576 [Accept: "application/xrd+xml,application/jrd+json"],
577 follow_redirect: true
582 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
586 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
590 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
595 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
596 [Accept: "application/atom+xml"],
602 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
606 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
610 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
614 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
622 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
630 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
638 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
642 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
646 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
650 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
654 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
658 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
662 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
666 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
670 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
674 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
678 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
682 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
686 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
690 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
694 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
698 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
702 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
706 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
710 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
714 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
719 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
721 follow_redirect: true
727 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
731 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
735 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
740 "https://hubzilla.example.org/channel/kaniini",
741 [Accept: "application/activity+json"],
747 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
751 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
755 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
759 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
763 body: File.read!("test/fixtures/httpoison_mock/rye.json")
767 def get("https://n1u.moe/users/rye", [Accept: "application/activity+json"], _) do
771 body: File.read!("test/fixtures/httpoison_mock/rye.json")
776 "https://mst3k.interlinked.me/users/luciferMysticus",
777 [Accept: "application/activity+json"],
783 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
787 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
791 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
796 "http://mastodon.example.org/@admin/99541947525187367",
797 [Accept: "application/activity+json"],
803 body: File.read!("test/fixtures/mastodon-note-object.json")
808 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
809 [Accept: "application/activity+json"],
815 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
819 def get("https://shitposter.club/notice/7369654", _, _) do
823 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
827 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
831 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
835 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
839 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
843 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
847 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
851 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
855 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
859 def get("https://peertube.moe/accounts/7even", _, _) do
863 body: File.read!("test/fixtures/httpoison_mock/7even.json")
867 def get(url, body, headers) do
869 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
874 def post(url, _body, _headers) do
875 {:error, "Not implemented the mock response for post #{inspect(url)}"}
878 def post(url, _body, _headers, _options) do
879 {:error, "Not implemented the mock response for post #{inspect(url)}"}