1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def get(url, body \\ [], headers \\ [])
7 "https://puckipedia.com/",
8 [Accept: "application/activity+json"],
14 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
19 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
20 [Accept: "application/xrd+xml,application/jrd+json"],
26 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
31 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
32 [Accept: "application/xrd+xml,application/jrd+json"],
38 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
43 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
44 [Accept: "application/xrd+xml,application/jrd+json"],
50 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
55 "https://social.heldscal.la/.well-known/webfinger",
56 [Accept: "application/xrd+xml,application/jrd+json"],
57 params: [resource: "nonexistant@social.heldscal.la"],
63 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
68 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
69 [Accept: "application/xrd+xml,application/jrd+json"],
75 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
80 "https://social.heldscal.la/.well-known/webfinger",
81 [Accept: "application/xrd+xml,application/jrd+json"],
82 params: [resource: "shp@social.heldscal.la"],
88 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
93 "https://social.heldscal.la/.well-known/webfinger",
94 [Accept: "application/xrd+xml,application/jrd+json"],
95 params: [resource: "https://social.heldscal.la/user/23211"],
101 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
106 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
107 [Accept: "application/xrd+xml,application/jrd+json"],
108 follow_redirect: true
113 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
118 "https://social.heldscal.la/.well-known/webfinger",
119 [Accept: "application/xrd+xml,application/jrd+json"],
120 params: [resource: "https://social.heldscal.la/user/29191"],
121 follow_redirect: true
126 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
131 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
132 [Accept: "application/xrd+xml,application/jrd+json"],
133 follow_redirect: true
138 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
143 "https://mastodon.social/.well-known/webfinger",
144 [Accept: "application/xrd+xml,application/jrd+json"],
145 params: [resource: "https://mastodon.social/users/lambadalambda"],
146 follow_redirect: true
153 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
159 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
160 [Accept: "application/xrd+xml,application/jrd+json"],
161 follow_redirect: true
168 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
174 "https://shitposter.club/.well-known/webfinger",
175 [Accept: "application/xrd+xml,application/jrd+json"],
176 params: [resource: "https://shitposter.club/user/1"],
177 follow_redirect: true
182 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
187 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
188 [Accept: "application/xrd+xml,application/jrd+json"],
189 follow_redirect: true
194 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
199 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
200 [Accept: "application/xrd+xml,application/jrd+json"],
201 follow_redirect: true
206 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
211 "http://gs.example.org/.well-known/webfinger",
212 [Accept: "application/xrd+xml,application/jrd+json"],
213 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
214 follow_redirect: true
221 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
227 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
228 [Accept: "application/xrd+xml,application/jrd+json"],
229 follow_redirect: true
236 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
242 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
243 [Accept: "application/xrd+xml,application/jrd+json"],
244 follow_redirect: true
249 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
254 "https://pleroma.soykaf.com/.well-known/webfinger",
255 [Accept: "application/xrd+xml,application/jrd+json"],
256 params: [resource: "https://pleroma.soykaf.com/users/lain"],
257 follow_redirect: true
262 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
267 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
268 [Accept: "application/xrd+xml,application/jrd+json"],
269 follow_redirect: true
274 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
278 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
284 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
289 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
293 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
297 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
303 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
308 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
314 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
320 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
327 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
331 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
337 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
342 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
346 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
350 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
356 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
361 def get("https://shitposter.club/notice/2827873", _body, _headers) do
366 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
370 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
376 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
381 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
387 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
393 "https://social.heldscal.la/main/push/hub",
395 "Content-type": "application/x-www-form-urlencoded"
404 "https://pawoo.net/.well-known/webfinger",
405 [Accept: "application/xrd+xml,application/jrd+json"],
406 params: [resource: "https://pawoo.net/users/pekorino"],
407 follow_redirect: true
412 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
417 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
418 [Accept: "application/xrd+xml,application/jrd+json"],
419 follow_redirect: true
424 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
428 def get("https://pawoo.net/users/pekorino.atom", _, _) do
432 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
437 "https://mamot.fr/.well-known/webfinger",
438 [Accept: "application/xrd+xml,application/jrd+json"],
439 params: [resource: "https://mamot.fr/users/Skruyb"],
440 follow_redirect: true
445 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
450 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
451 [Accept: "application/xrd+xml,application/jrd+json"],
452 follow_redirect: true
457 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
462 "https://social.sakamoto.gq/.well-known/webfinger",
463 [Accept: "application/xrd+xml,application/jrd+json"],
464 params: [resource: "https://social.sakamoto.gq/users/eal"],
465 follow_redirect: true
470 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
475 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
476 [Accept: "application/xrd+xml,application/jrd+json"],
477 follow_redirect: true
482 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
487 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
488 [Accept: "application/xrd+xml,application/jrd+json"],
489 follow_redirect: true
494 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
499 "https://squeet.me/xrd/?uri=lain@squeet.me",
500 [Accept: "application/xrd+xml,application/jrd+json"],
501 follow_redirect: true
506 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
510 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
514 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
519 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
520 [Accept: "application/atom+xml"],
526 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
530 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
534 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
538 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
542 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
546 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
550 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
554 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
558 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
562 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
566 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
570 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
574 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
578 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
582 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
586 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
590 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
594 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
598 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
602 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
606 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
610 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
614 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
618 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
622 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
626 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
630 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
634 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
638 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
643 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
645 follow_redirect: true
651 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
655 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
659 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
664 "https://hubzilla.example.org/channel/kaniini",
665 [Accept: "application/activity+json"],
671 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
675 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
679 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
683 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
687 body: File.read!("test/fixtures/httpoison_mock/rye.json")
692 "https://mst3k.interlinked.me/users/luciferMysticus",
693 [Accept: "application/activity+json"],
699 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
703 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
707 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
712 "http://mastodon.example.org/@admin/99541947525187367",
713 [Accept: "application/activity+json"],
719 body: File.read!("test/fixtures/mastodon-note-object.json")
724 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
725 [Accept: "application/activity+json"],
731 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
735 def get("https://shitposter.club/notice/7369654", _, _) do
739 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
743 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
747 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
751 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
755 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
759 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
763 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
767 def get(url, body, headers) do
769 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
774 def post(url, _body, _headers) do
775 {:error, "Not implemented the mock response for post #{inspect(url)}"}
778 def post(url, _body, _headers, _options) do
779 {:error, "Not implemented the mock response for post #{inspect(url)}"}