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://puckipedia.com/", [Accept: "application/activity+json"], _) do
47 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
52 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
53 [Accept: "application/xrd+xml,application/jrd+json"],
59 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
64 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
65 [Accept: "application/xrd+xml,application/jrd+json"],
71 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
76 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
77 [Accept: "application/xrd+xml,application/jrd+json"],
83 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
88 "https://social.heldscal.la/.well-known/webfinger",
89 [Accept: "application/xrd+xml,application/jrd+json"],
90 params: [resource: "nonexistant@social.heldscal.la"],
96 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
101 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
102 [Accept: "application/xrd+xml,application/jrd+json"],
103 follow_redirect: true
108 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
113 "https://social.heldscal.la/.well-known/webfinger",
114 [Accept: "application/xrd+xml,application/jrd+json"],
115 params: [resource: "shp@social.heldscal.la"],
116 follow_redirect: true
121 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
126 "https://social.heldscal.la/.well-known/webfinger",
127 [Accept: "application/xrd+xml,application/jrd+json"],
128 params: [resource: "https://social.heldscal.la/user/23211"],
129 follow_redirect: true
134 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
139 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
140 [Accept: "application/xrd+xml,application/jrd+json"],
141 follow_redirect: true
146 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
151 "https://social.heldscal.la/.well-known/webfinger",
152 [Accept: "application/xrd+xml,application/jrd+json"],
153 params: [resource: "https://social.heldscal.la/user/29191"],
154 follow_redirect: true
159 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
164 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
165 [Accept: "application/xrd+xml,application/jrd+json"],
166 follow_redirect: true
171 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
176 "https://mastodon.social/.well-known/webfinger",
177 [Accept: "application/xrd+xml,application/jrd+json"],
178 params: [resource: "https://mastodon.social/users/lambadalambda"],
179 follow_redirect: true
186 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
192 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
193 [Accept: "application/xrd+xml,application/jrd+json"],
194 follow_redirect: true
201 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
207 "https://shitposter.club/.well-known/webfinger",
208 [Accept: "application/xrd+xml,application/jrd+json"],
209 params: [resource: "https://shitposter.club/user/1"],
210 follow_redirect: true
215 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
220 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
221 [Accept: "application/xrd+xml,application/jrd+json"],
222 follow_redirect: true
227 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
232 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
233 [Accept: "application/xrd+xml,application/jrd+json"],
234 follow_redirect: true
239 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
244 "http://gs.example.org/.well-known/webfinger",
245 [Accept: "application/xrd+xml,application/jrd+json"],
246 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
247 follow_redirect: true
254 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
260 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
261 [Accept: "application/xrd+xml,application/jrd+json"],
262 follow_redirect: true
269 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
275 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
276 [Accept: "application/xrd+xml,application/jrd+json"],
277 follow_redirect: true
282 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
287 "https://pleroma.soykaf.com/.well-known/webfinger",
288 [Accept: "application/xrd+xml,application/jrd+json"],
289 params: [resource: "https://pleroma.soykaf.com/users/lain"],
290 follow_redirect: true
295 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
300 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
301 [Accept: "application/xrd+xml,application/jrd+json"],
302 follow_redirect: true
307 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
311 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
317 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
322 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
326 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
330 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
336 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
341 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
347 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
353 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
360 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
364 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
370 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
375 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
379 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
383 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
389 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
394 def get("https://shitposter.club/notice/2827873", _body, _headers) do
399 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
403 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
409 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
414 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
420 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
426 "https://social.heldscal.la/main/push/hub",
428 "Content-type": "application/x-www-form-urlencoded"
436 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
442 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
448 "https://pawoo.net/.well-known/webfinger",
449 [Accept: "application/xrd+xml,application/jrd+json"],
450 params: [resource: "https://pawoo.net/users/pekorino"],
451 follow_redirect: true
456 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
461 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
462 [Accept: "application/xrd+xml,application/jrd+json"],
463 follow_redirect: true
468 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
472 def get("https://pawoo.net/users/pekorino.atom", _, _) do
476 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
481 "https://mamot.fr/.well-known/webfinger",
482 [Accept: "application/xrd+xml,application/jrd+json"],
483 params: [resource: "https://mamot.fr/users/Skruyb"],
484 follow_redirect: true
489 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
494 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
495 [Accept: "application/xrd+xml,application/jrd+json"],
496 follow_redirect: true
501 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
506 "https://social.sakamoto.gq/.well-known/webfinger",
507 [Accept: "application/xrd+xml,application/jrd+json"],
508 params: [resource: "https://social.sakamoto.gq/users/eal"],
509 follow_redirect: true
514 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
519 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
520 [Accept: "application/xrd+xml,application/jrd+json"],
521 follow_redirect: true
526 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
531 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
532 [Accept: "application/xrd+xml,application/jrd+json"],
533 follow_redirect: true
538 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
543 "https://squeet.me/xrd/?uri=lain@squeet.me",
544 [Accept: "application/xrd+xml,application/jrd+json"],
545 follow_redirect: true
550 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
554 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
558 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
563 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
564 [Accept: "application/atom+xml"],
570 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
574 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
578 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
582 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
586 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
590 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
594 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
598 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
602 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
606 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
610 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
614 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
622 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
630 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
638 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
642 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
646 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
650 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
654 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
658 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
662 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
666 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
670 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
674 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
678 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
682 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
687 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
689 follow_redirect: true
695 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
699 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
703 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
708 "https://hubzilla.example.org/channel/kaniini",
709 [Accept: "application/activity+json"],
715 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
719 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
723 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
727 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
731 body: File.read!("test/fixtures/httpoison_mock/rye.json")
736 "https://mst3k.interlinked.me/users/luciferMysticus",
737 [Accept: "application/activity+json"],
743 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
747 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
751 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
756 "http://mastodon.example.org/@admin/99541947525187367",
757 [Accept: "application/activity+json"],
763 body: File.read!("test/fixtures/mastodon-note-object.json")
768 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
769 [Accept: "application/activity+json"],
775 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
779 def get("https://shitposter.club/notice/7369654", _, _) do
783 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
787 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
791 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
795 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
799 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
803 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
807 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
811 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
815 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
819 def get("https://peertube.moe/accounts/7even", _, _) do
823 body: File.read!("test/fixtures/httpoison_mock/7even.json")
827 def get(url, body, headers) do
829 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
834 def post(url, _body, _headers) do
835 {:error, "Not implemented the mock response for post #{inspect(url)}"}
838 def post(url, _body, _headers, _options) do
839 {:error, "Not implemented the mock response for post #{inspect(url)}"}