1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
4 def get(url, body \\ [], headers \\ [])
7 "http://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
8 [Accept: "application/xrd+xml,application/jrd+json"],
14 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
19 "http://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
20 [Accept: "application/xrd+xml,application/jrd+json"],
26 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
31 "https://social.heldscal.la/.well-known/webfinger",
32 [Accept: "application/xrd+xml,application/jrd+json"],
33 params: [resource: "nonexistant@social.heldscal.la"],
39 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
44 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
45 [Accept: "application/xrd+xml,application/jrd+json"],
51 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
56 "https://social.heldscal.la/.well-known/webfinger",
57 [Accept: "application/xrd+xml,application/jrd+json"],
58 params: [resource: "shp@social.heldscal.la"],
64 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
69 "https://social.heldscal.la/.well-known/webfinger",
70 [Accept: "application/xrd+xml,application/jrd+json"],
71 params: [resource: "https://social.heldscal.la/user/23211"],
77 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
82 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
83 [Accept: "application/xrd+xml,application/jrd+json"],
89 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
94 "https://social.heldscal.la/.well-known/webfinger",
95 [Accept: "application/xrd+xml,application/jrd+json"],
96 params: [resource: "https://social.heldscal.la/user/29191"],
102 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
107 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
108 [Accept: "application/xrd+xml,application/jrd+json"],
109 follow_redirect: true
114 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
119 "https://mastodon.social/.well-known/webfinger",
120 [Accept: "application/xrd+xml,application/jrd+json"],
121 params: [resource: "https://mastodon.social/users/lambadalambda"],
122 follow_redirect: true
129 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
135 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
136 [Accept: "application/xrd+xml,application/jrd+json"],
137 follow_redirect: true
144 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
150 "https://shitposter.club/.well-known/webfinger",
151 [Accept: "application/xrd+xml,application/jrd+json"],
152 params: [resource: "https://shitposter.club/user/1"],
153 follow_redirect: true
158 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
163 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
164 [Accept: "application/xrd+xml,application/jrd+json"],
165 follow_redirect: true
170 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
175 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
176 [Accept: "application/xrd+xml,application/jrd+json"],
177 follow_redirect: true
182 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
187 "http://gs.example.org/.well-known/webfinger",
188 [Accept: "application/xrd+xml,application/jrd+json"],
189 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
190 follow_redirect: true
197 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
203 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
204 [Accept: "application/xrd+xml,application/jrd+json"],
205 follow_redirect: true
212 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
218 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
219 [Accept: "application/xrd+xml,application/jrd+json"],
220 follow_redirect: true
225 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
230 "https://pleroma.soykaf.com/.well-known/webfinger",
231 [Accept: "application/xrd+xml,application/jrd+json"],
232 params: [resource: "https://pleroma.soykaf.com/users/lain"],
233 follow_redirect: true
238 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
243 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
244 [Accept: "application/xrd+xml,application/jrd+json"],
245 follow_redirect: true
250 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
254 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
260 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
265 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
269 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
273 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
279 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
284 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
290 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
296 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
303 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
307 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
313 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
318 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
322 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
326 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
332 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
337 def get("https://shitposter.club/notice/2827873", _body, _headers) do
342 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
346 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
352 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
357 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
363 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
369 "https://social.heldscal.la/main/push/hub",
371 "Content-type": "application/x-www-form-urlencoded"
380 "https://pawoo.net/.well-known/webfinger",
381 [Accept: "application/xrd+xml,application/jrd+json"],
382 params: [resource: "https://pawoo.net/users/pekorino"],
383 follow_redirect: true
388 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
393 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
394 [Accept: "application/xrd+xml,application/jrd+json"],
395 follow_redirect: true
400 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
404 def get("https://pawoo.net/users/pekorino.atom", _, _) do
408 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
413 "https://mamot.fr/.well-known/webfinger",
414 [Accept: "application/xrd+xml,application/jrd+json"],
415 params: [resource: "https://mamot.fr/users/Skruyb"],
416 follow_redirect: true
421 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
426 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
427 [Accept: "application/xrd+xml,application/jrd+json"],
428 follow_redirect: true
433 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
438 "https://social.sakamoto.gq/.well-known/webfinger",
439 [Accept: "application/xrd+xml,application/jrd+json"],
440 params: [resource: "https://social.sakamoto.gq/users/eal"],
441 follow_redirect: true
446 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
451 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
452 [Accept: "application/xrd+xml,application/jrd+json"],
453 follow_redirect: true
458 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
463 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
464 [Accept: "application/xrd+xml,application/jrd+json"],
465 follow_redirect: true
470 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
475 "https://squeet.me/xrd/?uri=lain@squeet.me",
476 [Accept: "application/xrd+xml,application/jrd+json"],
477 follow_redirect: true
482 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
486 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
490 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
495 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
496 [Accept: "application/atom+xml"],
502 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
506 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
510 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
514 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
518 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
522 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
526 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
530 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
534 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
538 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
542 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
546 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
550 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
554 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
558 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
562 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
566 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
570 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
574 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
578 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
582 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
586 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
590 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
594 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
598 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
602 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
606 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
611 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
613 follow_redirect: true
619 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
623 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
627 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
631 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
635 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
639 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
643 body: File.read!("test/fixtures/httpoison_mock/rye.json")
648 "https://mst3k.interlinked.me/users/luciferMysticus",
649 [Accept: "application/activity+json"],
655 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
659 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
663 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
668 "http://mastodon.example.org/@admin/99541947525187367",
669 [Accept: "application/activity+json"],
675 body: File.read!("test/fixtures/mastodon-note-object.json")
680 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
681 [Accept: "application/activity+json"],
687 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
691 def get("https://shitposter.club/notice/7369654", _, _) do
695 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
699 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
703 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
707 def get(url, body, headers) do
709 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
714 def post(url, _body, _headers) do
715 {:error, "Not implemented the mock response for post #{inspect(url)}"}
718 def post(url, _body, _headers, _options) do
719 {:error, "Not implemented the mock response for post #{inspect(url)}"}