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/actor.json", _, _) do
63 body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
67 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
71 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
76 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
77 [Accept: "application/xrd+xml,application/jrd+json"],
83 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
88 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
89 [Accept: "application/xrd+xml,application/jrd+json"],
95 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
100 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
101 [Accept: "application/xrd+xml,application/jrd+json"],
102 follow_redirect: true
107 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
112 "https://social.heldscal.la/.well-known/webfinger",
113 [Accept: "application/xrd+xml,application/jrd+json"],
114 params: [resource: "nonexistant@social.heldscal.la"],
115 follow_redirect: true
120 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
125 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
126 [Accept: "application/xrd+xml,application/jrd+json"],
127 follow_redirect: true
132 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
137 "https://social.heldscal.la/.well-known/webfinger",
138 [Accept: "application/xrd+xml,application/jrd+json"],
139 params: [resource: "shp@social.heldscal.la"],
140 follow_redirect: true
145 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
150 "https://social.heldscal.la/.well-known/webfinger",
151 [Accept: "application/xrd+xml,application/jrd+json"],
152 params: [resource: "https://social.heldscal.la/user/23211"],
153 follow_redirect: true
158 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
163 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
164 [Accept: "application/xrd+xml,application/jrd+json"],
165 follow_redirect: true
170 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
175 "https://social.heldscal.la/.well-known/webfinger",
176 [Accept: "application/xrd+xml,application/jrd+json"],
177 params: [resource: "https://social.heldscal.la/user/29191"],
178 follow_redirect: true
183 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
188 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
189 [Accept: "application/xrd+xml,application/jrd+json"],
190 follow_redirect: true
195 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
200 "https://mastodon.social/.well-known/webfinger",
201 [Accept: "application/xrd+xml,application/jrd+json"],
202 params: [resource: "https://mastodon.social/users/lambadalambda"],
203 follow_redirect: true
210 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
216 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
217 [Accept: "application/xrd+xml,application/jrd+json"],
218 follow_redirect: true
225 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
231 "https://shitposter.club/.well-known/webfinger",
232 [Accept: "application/xrd+xml,application/jrd+json"],
233 params: [resource: "https://shitposter.club/user/1"],
234 follow_redirect: true
239 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
244 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
245 [Accept: "application/xrd+xml,application/jrd+json"],
246 follow_redirect: true
251 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
256 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
257 [Accept: "application/xrd+xml,application/jrd+json"],
258 follow_redirect: true
263 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
268 "http://gs.example.org/.well-known/webfinger",
269 [Accept: "application/xrd+xml,application/jrd+json"],
270 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
271 follow_redirect: true
278 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
284 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
285 [Accept: "application/xrd+xml,application/jrd+json"],
286 follow_redirect: true
293 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
299 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
300 [Accept: "application/xrd+xml,application/jrd+json"],
301 follow_redirect: true
306 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
311 "https://pleroma.soykaf.com/.well-known/webfinger",
312 [Accept: "application/xrd+xml,application/jrd+json"],
313 params: [resource: "https://pleroma.soykaf.com/users/lain"],
314 follow_redirect: true
319 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
324 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
325 [Accept: "application/xrd+xml,application/jrd+json"],
326 follow_redirect: true
331 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
335 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
341 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
346 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
350 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
354 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
360 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
365 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
371 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
377 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
384 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
388 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
394 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
399 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
403 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
407 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
413 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
418 def get("https://shitposter.club/notice/2827873", _body, _headers) do
423 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
427 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
433 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
438 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
444 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
450 "https://social.heldscal.la/main/push/hub",
452 "Content-type": "application/x-www-form-urlencoded"
460 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
466 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
472 "https://pawoo.net/.well-known/webfinger",
473 [Accept: "application/xrd+xml,application/jrd+json"],
474 params: [resource: "https://pawoo.net/users/pekorino"],
475 follow_redirect: true
480 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
485 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
486 [Accept: "application/xrd+xml,application/jrd+json"],
487 follow_redirect: true
492 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
496 def get("https://pawoo.net/users/pekorino.atom", _, _) do
500 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
505 "https://mamot.fr/.well-known/webfinger",
506 [Accept: "application/xrd+xml,application/jrd+json"],
507 params: [resource: "https://mamot.fr/users/Skruyb"],
508 follow_redirect: true
513 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
518 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
519 [Accept: "application/xrd+xml,application/jrd+json"],
520 follow_redirect: true
525 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
530 "https://social.sakamoto.gq/.well-known/webfinger",
531 [Accept: "application/xrd+xml,application/jrd+json"],
532 params: [resource: "https://social.sakamoto.gq/users/eal"],
533 follow_redirect: true
538 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
543 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
544 [Accept: "application/xrd+xml,application/jrd+json"],
545 follow_redirect: true
550 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
555 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
556 [Accept: "application/xrd+xml,application/jrd+json"],
557 follow_redirect: true
562 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
567 "https://squeet.me/xrd/?uri=lain@squeet.me",
568 [Accept: "application/xrd+xml,application/jrd+json"],
569 follow_redirect: true
574 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
578 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
582 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
587 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
588 [Accept: "application/atom+xml"],
594 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
598 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
602 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
606 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
610 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
614 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
622 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
630 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
638 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
642 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
646 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
650 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
654 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
658 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
662 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
666 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
670 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
674 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
678 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
682 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
686 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
690 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
694 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
698 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
702 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
706 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
711 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
713 follow_redirect: true
719 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
723 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
727 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
732 "https://hubzilla.example.org/channel/kaniini",
733 [Accept: "application/activity+json"],
739 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
743 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
747 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
751 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
755 body: File.read!("test/fixtures/httpoison_mock/rye.json")
759 def get("https://n1u.moe/users/rye", [Accept: "application/activity+json"], _) do
763 body: File.read!("test/fixtures/httpoison_mock/rye.json")
768 "https://mst3k.interlinked.me/users/luciferMysticus",
769 [Accept: "application/activity+json"],
775 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
779 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
783 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
788 "http://mastodon.example.org/@admin/99541947525187367",
789 [Accept: "application/activity+json"],
795 body: File.read!("test/fixtures/mastodon-note-object.json")
800 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
801 [Accept: "application/activity+json"],
807 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
811 def get("https://shitposter.club/notice/7369654", _, _) do
815 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
819 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
823 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
827 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
831 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
835 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
839 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
843 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
847 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
851 def get("https://peertube.moe/accounts/7even", _, _) do
855 body: File.read!("test/fixtures/httpoison_mock/7even.json")
859 def get(url, body, headers) do
861 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
866 def post(url, _body, _headers) do
867 {:error, "Not implemented the mock response for post #{inspect(url)}"}
870 def post(url, _body, _headers, _options) do
871 {:error, "Not implemented the mock response for post #{inspect(url)}"}