1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def get(url, body \\ [], headers \\ [])
6 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
10 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
15 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
16 [Accept: "application/xrd+xml,application/jrd+json"],
22 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
27 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
28 [Accept: "application/xrd+xml,application/jrd+json"],
34 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
39 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
40 [Accept: "application/xrd+xml,application/jrd+json"],
46 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
51 "https://social.heldscal.la/.well-known/webfinger",
52 [Accept: "application/xrd+xml,application/jrd+json"],
53 params: [resource: "nonexistant@social.heldscal.la"],
59 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
64 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
65 [Accept: "application/xrd+xml,application/jrd+json"],
71 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
76 "https://social.heldscal.la/.well-known/webfinger",
77 [Accept: "application/xrd+xml,application/jrd+json"],
78 params: [resource: "shp@social.heldscal.la"],
84 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
89 "https://social.heldscal.la/.well-known/webfinger",
90 [Accept: "application/xrd+xml,application/jrd+json"],
91 params: [resource: "https://social.heldscal.la/user/23211"],
97 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
102 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
103 [Accept: "application/xrd+xml,application/jrd+json"],
104 follow_redirect: true
109 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
114 "https://social.heldscal.la/.well-known/webfinger",
115 [Accept: "application/xrd+xml,application/jrd+json"],
116 params: [resource: "https://social.heldscal.la/user/29191"],
117 follow_redirect: true
122 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
127 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
128 [Accept: "application/xrd+xml,application/jrd+json"],
129 follow_redirect: true
134 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
139 "https://mastodon.social/.well-known/webfinger",
140 [Accept: "application/xrd+xml,application/jrd+json"],
141 params: [resource: "https://mastodon.social/users/lambadalambda"],
142 follow_redirect: true
149 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
155 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
156 [Accept: "application/xrd+xml,application/jrd+json"],
157 follow_redirect: true
164 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
170 "https://shitposter.club/.well-known/webfinger",
171 [Accept: "application/xrd+xml,application/jrd+json"],
172 params: [resource: "https://shitposter.club/user/1"],
173 follow_redirect: true
178 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
183 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
184 [Accept: "application/xrd+xml,application/jrd+json"],
185 follow_redirect: true
190 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
195 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
196 [Accept: "application/xrd+xml,application/jrd+json"],
197 follow_redirect: true
202 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
207 "http://gs.example.org/.well-known/webfinger",
208 [Accept: "application/xrd+xml,application/jrd+json"],
209 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
210 follow_redirect: true
217 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
223 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
224 [Accept: "application/xrd+xml,application/jrd+json"],
225 follow_redirect: true
232 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
238 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
239 [Accept: "application/xrd+xml,application/jrd+json"],
240 follow_redirect: true
245 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
250 "https://pleroma.soykaf.com/.well-known/webfinger",
251 [Accept: "application/xrd+xml,application/jrd+json"],
252 params: [resource: "https://pleroma.soykaf.com/users/lain"],
253 follow_redirect: true
258 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
263 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
264 [Accept: "application/xrd+xml,application/jrd+json"],
265 follow_redirect: true
270 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
274 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
280 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
285 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
289 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
293 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
299 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
304 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
310 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
316 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
323 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
327 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
333 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
338 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
342 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
346 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
352 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
357 def get("https://shitposter.club/notice/2827873", _body, _headers) do
362 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
366 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
372 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
377 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
383 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
389 "https://social.heldscal.la/main/push/hub",
391 "Content-type": "application/x-www-form-urlencoded"
400 "https://pawoo.net/.well-known/webfinger",
401 [Accept: "application/xrd+xml,application/jrd+json"],
402 params: [resource: "https://pawoo.net/users/pekorino"],
403 follow_redirect: true
408 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
413 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
414 [Accept: "application/xrd+xml,application/jrd+json"],
415 follow_redirect: true
420 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
424 def get("https://pawoo.net/users/pekorino.atom", _, _) do
428 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
433 "https://mamot.fr/.well-known/webfinger",
434 [Accept: "application/xrd+xml,application/jrd+json"],
435 params: [resource: "https://mamot.fr/users/Skruyb"],
436 follow_redirect: true
441 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
446 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
447 [Accept: "application/xrd+xml,application/jrd+json"],
448 follow_redirect: true
453 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
458 "https://social.sakamoto.gq/.well-known/webfinger",
459 [Accept: "application/xrd+xml,application/jrd+json"],
460 params: [resource: "https://social.sakamoto.gq/users/eal"],
461 follow_redirect: true
466 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
471 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
472 [Accept: "application/xrd+xml,application/jrd+json"],
473 follow_redirect: true
478 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
483 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
484 [Accept: "application/xrd+xml,application/jrd+json"],
485 follow_redirect: true
490 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
495 "https://squeet.me/xrd/?uri=lain@squeet.me",
496 [Accept: "application/xrd+xml,application/jrd+json"],
497 follow_redirect: true
502 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
506 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
510 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
515 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
516 [Accept: "application/atom+xml"],
522 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
526 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
530 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
534 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
538 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
542 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
546 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
550 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
554 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
558 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
562 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
566 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
570 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
574 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
578 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
582 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
586 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
590 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
594 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
598 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
602 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
606 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
610 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
614 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
618 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
622 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
626 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
630 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
634 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
639 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
641 follow_redirect: true
647 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
651 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
655 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
660 "https://hubzilla.example.org/channel/kaniini",
661 [Accept: "application/activity+json"],
667 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
671 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
675 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
679 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
683 body: File.read!("test/fixtures/httpoison_mock/rye.json")
688 "https://mst3k.interlinked.me/users/luciferMysticus",
689 [Accept: "application/activity+json"],
695 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
699 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
703 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
708 "http://mastodon.example.org/@admin/99541947525187367",
709 [Accept: "application/activity+json"],
715 body: File.read!("test/fixtures/mastodon-note-object.json")
720 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
721 [Accept: "application/activity+json"],
727 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
731 def get("https://shitposter.club/notice/7369654", _, _) do
735 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
739 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
743 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
747 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
751 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
755 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
759 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
763 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
767 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
771 def get("https://peertube.moe/accounts/7even", _, _) do
775 body: File.read!("test/fixtures/httpoison_mock/7even.json")
779 def get(url, body, headers) do
781 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
786 def post(url, _body, _headers) do
787 {:error, "Not implemented the mock response for post #{inspect(url)}"}
790 def post(url, _body, _headers, _options) do
791 {:error, "Not implemented the mock response for post #{inspect(url)}"}