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/actor.json", _, _) do
55 body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
59 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
63 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
68 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
69 [Accept: "application/xrd+xml,application/jrd+json"],
75 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
80 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
81 [Accept: "application/xrd+xml,application/jrd+json"],
87 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
92 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
93 [Accept: "application/xrd+xml,application/jrd+json"],
99 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
104 "https://social.heldscal.la/.well-known/webfinger",
105 [Accept: "application/xrd+xml,application/jrd+json"],
106 params: [resource: "nonexistant@social.heldscal.la"],
107 follow_redirect: true
112 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
117 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
118 [Accept: "application/xrd+xml,application/jrd+json"],
119 follow_redirect: true
124 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
129 "https://social.heldscal.la/.well-known/webfinger",
130 [Accept: "application/xrd+xml,application/jrd+json"],
131 params: [resource: "shp@social.heldscal.la"],
132 follow_redirect: true
137 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
142 "https://social.heldscal.la/.well-known/webfinger",
143 [Accept: "application/xrd+xml,application/jrd+json"],
144 params: [resource: "https://social.heldscal.la/user/23211"],
145 follow_redirect: true
150 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
155 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
156 [Accept: "application/xrd+xml,application/jrd+json"],
157 follow_redirect: true
162 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
167 "https://social.heldscal.la/.well-known/webfinger",
168 [Accept: "application/xrd+xml,application/jrd+json"],
169 params: [resource: "https://social.heldscal.la/user/29191"],
170 follow_redirect: true
175 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
180 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
181 [Accept: "application/xrd+xml,application/jrd+json"],
182 follow_redirect: true
187 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
192 "https://mastodon.social/.well-known/webfinger",
193 [Accept: "application/xrd+xml,application/jrd+json"],
194 params: [resource: "https://mastodon.social/users/lambadalambda"],
195 follow_redirect: true
202 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
208 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
209 [Accept: "application/xrd+xml,application/jrd+json"],
210 follow_redirect: true
217 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
223 "https://shitposter.club/.well-known/webfinger",
224 [Accept: "application/xrd+xml,application/jrd+json"],
225 params: [resource: "https://shitposter.club/user/1"],
226 follow_redirect: true
231 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
236 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
237 [Accept: "application/xrd+xml,application/jrd+json"],
238 follow_redirect: true
243 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
248 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
249 [Accept: "application/xrd+xml,application/jrd+json"],
250 follow_redirect: true
255 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
260 "http://gs.example.org/.well-known/webfinger",
261 [Accept: "application/xrd+xml,application/jrd+json"],
262 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
263 follow_redirect: true
270 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
276 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
277 [Accept: "application/xrd+xml,application/jrd+json"],
278 follow_redirect: true
285 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
291 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
292 [Accept: "application/xrd+xml,application/jrd+json"],
293 follow_redirect: true
298 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
303 "https://pleroma.soykaf.com/.well-known/webfinger",
304 [Accept: "application/xrd+xml,application/jrd+json"],
305 params: [resource: "https://pleroma.soykaf.com/users/lain"],
306 follow_redirect: true
311 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
316 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
317 [Accept: "application/xrd+xml,application/jrd+json"],
318 follow_redirect: true
323 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
327 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
333 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
338 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
342 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
346 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
352 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
357 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
363 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
369 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
376 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
380 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
386 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
391 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
395 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
399 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
405 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
410 def get("https://shitposter.club/notice/2827873", _body, _headers) do
415 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
419 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
425 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
430 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
436 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
442 "https://social.heldscal.la/main/push/hub",
444 "Content-type": "application/x-www-form-urlencoded"
452 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
458 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
464 "https://pawoo.net/.well-known/webfinger",
465 [Accept: "application/xrd+xml,application/jrd+json"],
466 params: [resource: "https://pawoo.net/users/pekorino"],
467 follow_redirect: true
472 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
477 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
478 [Accept: "application/xrd+xml,application/jrd+json"],
479 follow_redirect: true
484 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
488 def get("https://pawoo.net/users/pekorino.atom", _, _) do
492 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
497 "https://mamot.fr/.well-known/webfinger",
498 [Accept: "application/xrd+xml,application/jrd+json"],
499 params: [resource: "https://mamot.fr/users/Skruyb"],
500 follow_redirect: true
505 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
510 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
511 [Accept: "application/xrd+xml,application/jrd+json"],
512 follow_redirect: true
517 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
522 "https://social.sakamoto.gq/.well-known/webfinger",
523 [Accept: "application/xrd+xml,application/jrd+json"],
524 params: [resource: "https://social.sakamoto.gq/users/eal"],
525 follow_redirect: true
530 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
535 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
536 [Accept: "application/xrd+xml,application/jrd+json"],
537 follow_redirect: true
542 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
547 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
548 [Accept: "application/xrd+xml,application/jrd+json"],
549 follow_redirect: true
554 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
559 "https://squeet.me/xrd/?uri=lain@squeet.me",
560 [Accept: "application/xrd+xml,application/jrd+json"],
561 follow_redirect: true
566 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
570 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
574 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
579 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
580 [Accept: "application/atom+xml"],
586 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
590 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
594 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
598 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
602 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
606 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
610 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
614 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
622 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
630 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
638 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
642 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
646 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
650 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
654 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
658 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
662 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
666 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
670 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
674 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
678 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
682 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
686 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
690 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
694 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
698 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
703 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
705 follow_redirect: true
711 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
715 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
719 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
724 "https://hubzilla.example.org/channel/kaniini",
725 [Accept: "application/activity+json"],
731 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
735 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
739 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
743 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
747 body: File.read!("test/fixtures/httpoison_mock/rye.json")
752 "https://mst3k.interlinked.me/users/luciferMysticus",
753 [Accept: "application/activity+json"],
759 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
763 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
767 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
772 "http://mastodon.example.org/@admin/99541947525187367",
773 [Accept: "application/activity+json"],
779 body: File.read!("test/fixtures/mastodon-note-object.json")
784 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
785 [Accept: "application/activity+json"],
791 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
795 def get("https://shitposter.club/notice/7369654", _, _) do
799 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
803 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
807 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
811 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
815 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
819 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
823 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
827 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
831 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
835 def get("https://peertube.moe/accounts/7even", _, _) do
839 body: File.read!("test/fixtures/httpoison_mock/7even.json")
843 def get(url, body, headers) do
845 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
850 def post(url, _body, _headers) do
851 {:error, "Not implemented the mock response for post #{inspect(url)}"}
854 def post(url, _body, _headers, _options) do
855 {:error, "Not implemented the mock response for post #{inspect(url)}"}