1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def process_request_options(options), do: options
6 def get(url, body \\ [], headers \\ [])
8 def get("https://prismo.news/@mxb", _, _) do
12 body: File.read!("test/fixtures/httpoison_mock/https___prismo.news__mxb.json")
16 def get("https://osada.macgirvin.com/channel/mike", _, _) do
21 File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json")
26 "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
33 body: File.read!("test/fixtures/httpoison_mock/mike@osada.macgirvin.com.json")
37 def get("https://info.pleroma.site/activity.json", _, _) do
41 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
45 def get("https://info.pleroma.site/activity2.json", _, _) do
49 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json")
53 def get("https://info.pleroma.site/activity3.json", _, _) do
57 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity3.json")
61 def get("https://info.pleroma.site/activity4.json", _, _) do
65 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity4.json")
69 def get("https://info.pleroma.site/actor.json", _, _) do
73 body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
77 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
81 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
86 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
87 [Accept: "application/xrd+xml,application/jrd+json"],
93 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
98 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
99 [Accept: "application/xrd+xml,application/jrd+json"],
100 follow_redirect: true
105 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
110 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
111 [Accept: "application/xrd+xml,application/jrd+json"],
112 follow_redirect: true
117 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
122 "https://social.heldscal.la/.well-known/webfinger",
123 [Accept: "application/xrd+xml,application/jrd+json"],
124 params: [resource: "nonexistant@social.heldscal.la"],
125 follow_redirect: true
130 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
135 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
136 [Accept: "application/xrd+xml,application/jrd+json"],
137 follow_redirect: true
142 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
147 "https://social.heldscal.la/.well-known/webfinger",
148 [Accept: "application/xrd+xml,application/jrd+json"],
149 params: [resource: "shp@social.heldscal.la"],
150 follow_redirect: true
155 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
160 "https://social.heldscal.la/.well-known/webfinger",
161 [Accept: "application/xrd+xml,application/jrd+json"],
162 params: [resource: "https://social.heldscal.la/user/23211"],
163 follow_redirect: true
168 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
173 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
174 [Accept: "application/xrd+xml,application/jrd+json"],
175 follow_redirect: true
180 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
185 "https://social.heldscal.la/.well-known/webfinger",
186 [Accept: "application/xrd+xml,application/jrd+json"],
187 params: [resource: "https://social.heldscal.la/user/29191"],
188 follow_redirect: true
193 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
198 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
199 [Accept: "application/xrd+xml,application/jrd+json"],
200 follow_redirect: true
205 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
210 "https://mastodon.social/.well-known/webfinger",
211 [Accept: "application/xrd+xml,application/jrd+json"],
212 params: [resource: "https://mastodon.social/users/lambadalambda"],
213 follow_redirect: true
220 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
226 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
227 [Accept: "application/xrd+xml,application/jrd+json"],
228 follow_redirect: true
235 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
241 "https://shitposter.club/.well-known/webfinger",
242 [Accept: "application/xrd+xml,application/jrd+json"],
243 params: [resource: "https://shitposter.club/user/1"],
244 follow_redirect: true
249 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
254 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
255 [Accept: "application/xrd+xml,application/jrd+json"],
256 follow_redirect: true
261 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
266 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
267 [Accept: "application/xrd+xml,application/jrd+json"],
268 follow_redirect: true
273 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
278 "http://gs.example.org/.well-known/webfinger",
279 [Accept: "application/xrd+xml,application/jrd+json"],
280 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
281 follow_redirect: true
288 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
294 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
295 [Accept: "application/xrd+xml,application/jrd+json"],
296 follow_redirect: true
303 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
309 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
310 [Accept: "application/xrd+xml,application/jrd+json"],
311 follow_redirect: true
316 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
321 "https://pleroma.soykaf.com/.well-known/webfinger",
322 [Accept: "application/xrd+xml,application/jrd+json"],
323 params: [resource: "https://pleroma.soykaf.com/users/lain"],
324 follow_redirect: true
329 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
334 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
335 [Accept: "application/xrd+xml,application/jrd+json"],
336 follow_redirect: true
341 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
345 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
351 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
356 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
360 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
364 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
370 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
375 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
381 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
387 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
394 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
398 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
404 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
409 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
413 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
417 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
423 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
428 def get("https://shitposter.club/notice/2827873", _body, _headers) do
433 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
437 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
443 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
448 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
454 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
460 "https://social.heldscal.la/main/push/hub",
462 "Content-type": "application/x-www-form-urlencoded"
470 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
476 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
482 "https://pawoo.net/.well-known/webfinger",
483 [Accept: "application/xrd+xml,application/jrd+json"],
484 params: [resource: "https://pawoo.net/users/pekorino"],
485 follow_redirect: true
490 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
495 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
496 [Accept: "application/xrd+xml,application/jrd+json"],
497 follow_redirect: true
502 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
506 def get("https://pawoo.net/users/pekorino.atom", _, _) do
510 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
515 "https://mamot.fr/.well-known/webfinger",
516 [Accept: "application/xrd+xml,application/jrd+json"],
517 params: [resource: "https://mamot.fr/users/Skruyb"],
518 follow_redirect: true
523 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
528 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
529 [Accept: "application/xrd+xml,application/jrd+json"],
530 follow_redirect: true
535 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
540 "https://social.sakamoto.gq/.well-known/webfinger",
541 [Accept: "application/xrd+xml,application/jrd+json"],
542 params: [resource: "https://social.sakamoto.gq/users/eal"],
543 follow_redirect: true
548 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
553 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
554 [Accept: "application/xrd+xml,application/jrd+json"],
555 follow_redirect: true
560 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
565 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
566 [Accept: "application/xrd+xml,application/jrd+json"],
567 follow_redirect: true
572 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
577 "https://squeet.me/xrd/?uri=lain@squeet.me",
578 [Accept: "application/xrd+xml,application/jrd+json"],
579 follow_redirect: true
584 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
588 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
592 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
597 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
598 [Accept: "application/atom+xml"],
604 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
608 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
612 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
616 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
620 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
624 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
628 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
632 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
636 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
640 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
644 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
648 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
652 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
656 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
660 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
664 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
668 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
672 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
676 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
680 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
684 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
688 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
692 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
696 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
700 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
704 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
708 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
712 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
716 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
721 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
723 follow_redirect: true
729 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
733 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
737 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
742 "https://hubzilla.example.org/channel/kaniini",
743 [Accept: "application/activity+json"],
749 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
753 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
757 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
761 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
765 body: File.read!("test/fixtures/httpoison_mock/rye.json")
769 def get("https://n1u.moe/users/rye", [Accept: "application/activity+json"], _) do
773 body: File.read!("test/fixtures/httpoison_mock/rye.json")
778 "https://mst3k.interlinked.me/users/luciferMysticus",
779 [Accept: "application/activity+json"],
785 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
789 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
793 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
798 "http://mastodon.example.org/@admin/99541947525187367",
799 [Accept: "application/activity+json"],
805 body: File.read!("test/fixtures/mastodon-note-object.json")
810 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
811 [Accept: "application/activity+json"],
817 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
821 def get("https://shitposter.club/notice/7369654", _, _) do
825 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
829 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
833 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
837 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
841 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
845 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
849 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
853 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
857 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
861 def get("https://peertube.moe/accounts/7even", _, _) do
865 body: File.read!("test/fixtures/httpoison_mock/7even.json")
869 def get(url, body, headers) do
871 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
876 def post(url, _body, _headers) do
877 {:error, "Not implemented the mock response for post #{inspect(url)}"}
880 def post(url, _body, _headers, _options) do
881 {:error, "Not implemented the mock response for post #{inspect(url)}"}