Merge branch 'ogg-theora-detection' into 'develop'
[akkoma] / test / support / httpoison_mock.ex
1 defmodule HTTPoisonMock do
2 alias HTTPoison.Response
3
4 def get(url, body \\ [], headers \\ [])
5
6 def get("https://prismo.news/@mxb", _, _) do
7 {:ok,
8 %Response{
9 status_code: 200,
10 body: File.read!("test/fixtures/httpoison_mock/https___prismo.news__mxb.json")
11 }}
12 end
13
14 def get("https://osada.macgirvin.com/channel/mike", _, _) do
15 {:ok,
16 %Response{
17 status_code: 200,
18 body:
19 File.read!("test/fixtures/httpoison_mock/https___osada.macgirvin.com_channel_mike.json")
20 }}
21 end
22
23 def get(
24 "https://osada.macgirvin.com/.well-known/webfinger?resource=acct:mike@osada.macgirvin.com",
25 _,
26 _
27 ) do
28 {:ok,
29 %Response{
30 status_code: 200,
31 body: File.read!("test/fixtures/httpoison_mock/mike@osada.macgirvin.com.json")
32 }}
33 end
34
35 def get("https://info.pleroma.site/activity.json", _, _) do
36 {:ok,
37 %Response{
38 status_code: 200,
39 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity.json")
40 }}
41 end
42
43 def get("https://info.pleroma.site/activity2.json", _, _) do
44 {:ok,
45 %Response{
46 status_code: 200,
47 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity2.json")
48 }}
49 end
50
51 def get("https://info.pleroma.site/activity3.json", _, _) do
52 {:ok,
53 %Response{
54 status_code: 200,
55 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity3.json")
56 }}
57 end
58
59 def get("https://info.pleroma.site/activity4.json", _, _) do
60 {:ok,
61 %Response{
62 status_code: 200,
63 body: File.read!("test/fixtures/httpoison_mock/https__info.pleroma.site_activity4.json")
64 }}
65 end
66
67 def get("https://info.pleroma.site/actor.json", _, _) do
68 {:ok,
69 %Response{
70 status_code: 200,
71 body: File.read!("test/fixtures/httpoison_mock/https___info.pleroma.site_actor.json")
72 }}
73 end
74
75 def get("https://puckipedia.com/", [Accept: "application/activity+json"], _) do
76 {:ok,
77 %Response{
78 status_code: 200,
79 body: File.read!("test/fixtures/httpoison_mock/puckipedia.com.json")
80 }}
81 end
82
83 def get(
84 "https://gerzilla.de/.well-known/webfinger?resource=acct:kaniini@gerzilla.de",
85 [Accept: "application/xrd+xml,application/jrd+json"],
86 follow_redirect: true
87 ) do
88 {:ok,
89 %Response{
90 status_code: 200,
91 body: File.read!("test/fixtures/httpoison_mock/kaniini@gerzilla.de.json")
92 }}
93 end
94
95 def get(
96 "https://framatube.org/.well-known/webfinger?resource=acct:framasoft@framatube.org",
97 [Accept: "application/xrd+xml,application/jrd+json"],
98 follow_redirect: true
99 ) do
100 {:ok,
101 %Response{
102 status_code: 200,
103 body: File.read!("test/fixtures/httpoison_mock/framasoft@framatube.org.json")
104 }}
105 end
106
107 def get(
108 "https://gnusocial.de/.well-known/webfinger?resource=acct:winterdienst@gnusocial.de",
109 [Accept: "application/xrd+xml,application/jrd+json"],
110 follow_redirect: true
111 ) do
112 {:ok,
113 %Response{
114 status_code: 200,
115 body: File.read!("test/fixtures/httpoison_mock/winterdienst_webfinger.json")
116 }}
117 end
118
119 def get(
120 "https://social.heldscal.la/.well-known/webfinger",
121 [Accept: "application/xrd+xml,application/jrd+json"],
122 params: [resource: "nonexistant@social.heldscal.la"],
123 follow_redirect: true
124 ) do
125 {:ok,
126 %Response{
127 status_code: 500,
128 body: File.read!("test/fixtures/httpoison_mock/nonexistant@social.heldscal.la.xml")
129 }}
130 end
131
132 def get(
133 "https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la",
134 [Accept: "application/xrd+xml,application/jrd+json"],
135 follow_redirect: true
136 ) do
137 {:ok,
138 %Response{
139 status_code: 200,
140 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
141 }}
142 end
143
144 def get(
145 "https://social.heldscal.la/.well-known/webfinger",
146 [Accept: "application/xrd+xml,application/jrd+json"],
147 params: [resource: "shp@social.heldscal.la"],
148 follow_redirect: true
149 ) do
150 {:ok,
151 %Response{
152 status_code: 200,
153 body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml")
154 }}
155 end
156
157 def get(
158 "https://social.heldscal.la/.well-known/webfinger",
159 [Accept: "application/xrd+xml,application/jrd+json"],
160 params: [resource: "https://social.heldscal.la/user/23211"],
161 follow_redirect: true
162 ) do
163 {:ok,
164 %Response{
165 status_code: 200,
166 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
167 }}
168 end
169
170 def get(
171 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211",
172 [Accept: "application/xrd+xml,application/jrd+json"],
173 follow_redirect: true
174 ) do
175 {:ok,
176 %Response{
177 status_code: 200,
178 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")
179 }}
180 end
181
182 def get(
183 "https://social.heldscal.la/.well-known/webfinger",
184 [Accept: "application/xrd+xml,application/jrd+json"],
185 params: [resource: "https://social.heldscal.la/user/29191"],
186 follow_redirect: true
187 ) do
188 {:ok,
189 %Response{
190 status_code: 200,
191 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
192 }}
193 end
194
195 def get(
196 "https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191",
197 [Accept: "application/xrd+xml,application/jrd+json"],
198 follow_redirect: true
199 ) do
200 {:ok,
201 %Response{
202 status_code: 200,
203 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml")
204 }}
205 end
206
207 def get(
208 "https://mastodon.social/.well-known/webfinger",
209 [Accept: "application/xrd+xml,application/jrd+json"],
210 params: [resource: "https://mastodon.social/users/lambadalambda"],
211 follow_redirect: true
212 ) do
213 {:ok,
214 %Response{
215 status_code: 200,
216 body:
217 File.read!(
218 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
219 )
220 }}
221 end
222
223 def get(
224 "https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda",
225 [Accept: "application/xrd+xml,application/jrd+json"],
226 follow_redirect: true
227 ) do
228 {:ok,
229 %Response{
230 status_code: 200,
231 body:
232 File.read!(
233 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml"
234 )
235 }}
236 end
237
238 def get(
239 "https://shitposter.club/.well-known/webfinger",
240 [Accept: "application/xrd+xml,application/jrd+json"],
241 params: [resource: "https://shitposter.club/user/1"],
242 follow_redirect: true
243 ) do
244 {:ok,
245 %Response{
246 status_code: 200,
247 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
248 }}
249 end
250
251 def get(
252 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1",
253 [Accept: "application/xrd+xml,application/jrd+json"],
254 follow_redirect: true
255 ) do
256 {:ok,
257 %Response{
258 status_code: 200,
259 body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml")
260 }}
261 end
262
263 def get(
264 "https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/5381",
265 [Accept: "application/xrd+xml,application/jrd+json"],
266 follow_redirect: true
267 ) do
268 {:ok,
269 %Response{
270 status_code: 200,
271 body: File.read!("test/fixtures/httpoison_mock/spc_5381_xrd.xml")
272 }}
273 end
274
275 def get(
276 "http://gs.example.org/.well-known/webfinger",
277 [Accept: "application/xrd+xml,application/jrd+json"],
278 params: [resource: "http://gs.example.org:4040/index.php/user/1"],
279 follow_redirect: true
280 ) do
281 {:ok,
282 %Response{
283 status_code: 200,
284 body:
285 File.read!(
286 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
287 )
288 }}
289 end
290
291 def get(
292 "http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1",
293 [Accept: "application/xrd+xml,application/jrd+json"],
294 follow_redirect: true
295 ) do
296 {:ok,
297 %Response{
298 status_code: 200,
299 body:
300 File.read!(
301 "test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml"
302 )
303 }}
304 end
305
306 def get(
307 "https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330",
308 [Accept: "application/xrd+xml,application/jrd+json"],
309 follow_redirect: true
310 ) do
311 {:ok,
312 %Response{
313 status_code: 200,
314 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml")
315 }}
316 end
317
318 def get(
319 "https://pleroma.soykaf.com/.well-known/webfinger",
320 [Accept: "application/xrd+xml,application/jrd+json"],
321 params: [resource: "https://pleroma.soykaf.com/users/lain"],
322 follow_redirect: true
323 ) do
324 {:ok,
325 %Response{
326 status_code: 200,
327 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
328 }}
329 end
330
331 def get(
332 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain",
333 [Accept: "application/xrd+xml,application/jrd+json"],
334 follow_redirect: true
335 ) do
336 {:ok,
337 %Response{
338 status_code: 200,
339 body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml")
340 }}
341 end
342
343 def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do
344 {:ok,
345 %Response{
346 status_code: 200,
347 body:
348 File.read!(
349 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_29191.atom.xml"
350 )
351 }}
352 end
353
354 def get("https://shitposter.club/api/statuses/user_timeline/5381.atom", _body, _headers) do
355 {:ok,
356 %Response{
357 status_code: 200,
358 body: File.read!("test/fixtures/httpoison_mock/spc_5381.atom")
359 }}
360 end
361
362 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _body, _headers) do
363 {:ok,
364 %Response{
365 status_code: 200,
366 body:
367 File.read!(
368 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
369 )
370 }}
371 end
372
373 def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do
374 {:ok,
375 %Response{
376 status_code: 200,
377 body:
378 File.read!(
379 "test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.atom"
380 )
381 }}
382 end
383
384 def get(
385 "https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom",
386 _body,
387 _headers
388 ) do
389 {:ok,
390 %Response{
391 status_code: 200,
392 body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml")
393 }}
394 end
395
396 def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do
397 {:ok,
398 %Response{
399 status_code: 200,
400 body:
401 File.read!(
402 "test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain_feed.atom.xml"
403 )
404 }}
405 end
406
407 def get("https://social.sakamoto.gq/users/eal/feed.atom", _body, _headers) do
408 {:ok,
409 %Response{
410 status_code: 200,
411 body: File.read!("test/fixtures/httpoison_mock/sakamoto_eal_feed.atom")
412 }}
413 end
414
415 def get("http://gs.example.org/index.php/api/statuses/user_timeline/1.atom", _body, _headers) do
416 {:ok,
417 %Response{
418 status_code: 200,
419 body:
420 File.read!(
421 "test/fixtures/httpoison_mock/http__gs.example.org_index.php_api_statuses_user_timeline_1.atom.xml"
422 )
423 }}
424 end
425
426 def get("https://shitposter.club/notice/2827873", _body, _headers) do
427 {:ok,
428 %Response{
429 status_code: 200,
430 body:
431 File.read!("test/fixtures/httpoison_mock/https___shitposter.club_notice_2827873.html")
432 }}
433 end
434
435 def get("https://shitposter.club/api/statuses/show/2827873.atom", _body, _headers) do
436 {:ok,
437 %Response{
438 status_code: 200,
439 body:
440 File.read!(
441 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_show_2827873.atom.xml"
442 )
443 }}
444 end
445
446 def get("https://shitposter.club/api/statuses/user_timeline/1.atom", _body, _headers) do
447 {:ok,
448 %Response{
449 status_code: 200,
450 body:
451 File.read!(
452 "test/fixtures/httpoison_mock/https___shitposter.club_api_statuses_user_timeline_1.atom.xml"
453 )
454 }}
455 end
456
457 def post(
458 "https://social.heldscal.la/main/push/hub",
459 {:form, _data},
460 "Content-type": "application/x-www-form-urlencoded"
461 ) do
462 {:ok,
463 %Response{
464 status_code: 202
465 }}
466 end
467
468 def get("http://mastodon.example.org/users/admin/statuses/100787282858396771", _, _) do
469 {:ok,
470 %Response{
471 status_code: 200,
472 body:
473 File.read!(
474 "test/fixtures/httpoison_mock/http___mastodon.example.org_users_admin_status_1234.json"
475 )
476 }}
477 end
478
479 def get(
480 "https://pawoo.net/.well-known/webfinger",
481 [Accept: "application/xrd+xml,application/jrd+json"],
482 params: [resource: "https://pawoo.net/users/pekorino"],
483 follow_redirect: true
484 ) do
485 {:ok,
486 %Response{
487 status_code: 200,
488 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
489 }}
490 end
491
492 def get(
493 "https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino",
494 [Accept: "application/xrd+xml,application/jrd+json"],
495 follow_redirect: true
496 ) do
497 {:ok,
498 %Response{
499 status_code: 200,
500 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml")
501 }}
502 end
503
504 def get("https://pawoo.net/users/pekorino.atom", _, _) do
505 {:ok,
506 %Response{
507 status_code: 200,
508 body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.atom")
509 }}
510 end
511
512 def get(
513 "https://mamot.fr/.well-known/webfinger",
514 [Accept: "application/xrd+xml,application/jrd+json"],
515 params: [resource: "https://mamot.fr/users/Skruyb"],
516 follow_redirect: true
517 ) do
518 {:ok,
519 %Response{
520 status_code: 200,
521 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
522 }}
523 end
524
525 def get(
526 "https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb",
527 [Accept: "application/xrd+xml,application/jrd+json"],
528 follow_redirect: true
529 ) do
530 {:ok,
531 %Response{
532 status_code: 200,
533 body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom")
534 }}
535 end
536
537 def get(
538 "https://social.sakamoto.gq/.well-known/webfinger",
539 [Accept: "application/xrd+xml,application/jrd+json"],
540 params: [resource: "https://social.sakamoto.gq/users/eal"],
541 follow_redirect: true
542 ) do
543 {:ok,
544 %Response{
545 status_code: 200,
546 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
547 }}
548 end
549
550 def get(
551 "https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal",
552 [Accept: "application/xrd+xml,application/jrd+json"],
553 follow_redirect: true
554 ) do
555 {:ok,
556 %Response{
557 status_code: 200,
558 body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml")
559 }}
560 end
561
562 def get(
563 "https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/shp",
564 [Accept: "application/xrd+xml,application/jrd+json"],
565 follow_redirect: true
566 ) do
567 {:ok,
568 %Response{
569 status_code: 200,
570 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.webfigner")
571 }}
572 end
573
574 def get(
575 "https://squeet.me/xrd/?uri=lain@squeet.me",
576 [Accept: "application/xrd+xml,application/jrd+json"],
577 follow_redirect: true
578 ) do
579 {:ok,
580 %Response{
581 status_code: 200,
582 body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml")
583 }}
584 end
585
586 def get("https://mamot.fr/users/Skruyb.atom", _, _) do
587 {:ok,
588 %Response{
589 status_code: 200,
590 body: File.read!("test/fixtures/httpoison_mock/https___mamot.fr_users_Skruyb.atom")
591 }}
592 end
593
594 def get(
595 "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056",
596 [Accept: "application/atom+xml"],
597 _
598 ) do
599 {:ok,
600 %Response{
601 status_code: 200,
602 body: File.read!("test/fixtures/httpoison_mock/sakamoto.atom")
603 }}
604 end
605
606 def get("https://pleroma.soykaf.com/users/shp/feed.atom", _, _) do
607 {:ok,
608 %Response{
609 status_code: 200,
610 body: File.read!("test/fixtures/httpoison_mock/shp@pleroma.soykaf.com.feed")
611 }}
612 end
613
614 def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect: true) do
615 {:ok,
616 %Response{
617 status_code: 200,
618 body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")
619 }}
620 end
621
622 def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
623 {:ok,
624 %Response{
625 status_code: 200,
626 body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
627 }}
628 end
629
630 def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
631 {:ok,
632 %Response{
633 status_code: 200,
634 body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta")
635 }}
636 end
637
638 def get("http://mastodon.social/.well-known/host-meta", [], follow_redirect: true) do
639 {:ok,
640 %Response{
641 status_code: 200,
642 body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta")
643 }}
644 end
645
646 def get("http://shitposter.club/.well-known/host-meta", [], follow_redirect: true) do
647 {:ok,
648 %Response{
649 status_code: 200,
650 body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta")
651 }}
652 end
653
654 def get("http://pleroma.soykaf.com/.well-known/host-meta", [], follow_redirect: true) do
655 {:ok,
656 %Response{
657 status_code: 200,
658 body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta")
659 }}
660 end
661
662 def get("http://social.sakamoto.gq/.well-known/host-meta", [], follow_redirect: true) do
663 {:ok,
664 %Response{
665 status_code: 200,
666 body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta")
667 }}
668 end
669
670 def get("http://gs.example.org/.well-known/host-meta", [], follow_redirect: true) do
671 {:ok,
672 %Response{
673 status_code: 200,
674 body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta")
675 }}
676 end
677
678 def get("http://pawoo.net/.well-known/host-meta", [], follow_redirect: true) do
679 {:ok,
680 %Response{
681 status_code: 200,
682 body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta")
683 }}
684 end
685
686 def get("http://mamot.fr/.well-known/host-meta", [], follow_redirect: true) do
687 {:ok,
688 %Response{
689 status_code: 200,
690 body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta")
691 }}
692 end
693
694 def get("http://mastodon.xyz/.well-known/host-meta", [], follow_redirect: true) do
695 {:ok,
696 %Response{
697 status_code: 200,
698 body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta")
699 }}
700 end
701
702 def get("http://social.wxcafe.net/.well-known/host-meta", [], follow_redirect: true) do
703 {:ok,
704 %Response{
705 status_code: 200,
706 body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta")
707 }}
708 end
709
710 def get("http://squeet.me/.well-known/host-meta", [], follow_redirect: true) do
711 {:ok,
712 %Response{
713 status_code: 200,
714 body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta")
715 }}
716 end
717
718 def get(
719 "http://social.stopwatchingus-heidelberg.de/.well-known/host-meta",
720 [],
721 follow_redirect: true
722 ) do
723 {:ok,
724 %Response{
725 status_code: 200,
726 body:
727 File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta")
728 }}
729 end
730
731 def get("http://mastodon.example.org/users/admin", [Accept: "application/activity+json"], _) do
732 {:ok,
733 %Response{
734 status_code: 200,
735 body: File.read!("test/fixtures/httpoison_mock/admin@mastdon.example.org.json")
736 }}
737 end
738
739 def get(
740 "https://hubzilla.example.org/channel/kaniini",
741 [Accept: "application/activity+json"],
742 _
743 ) do
744 {:ok,
745 %Response{
746 status_code: 200,
747 body: File.read!("test/fixtures/httpoison_mock/kaniini@hubzilla.example.org.json")
748 }}
749 end
750
751 def get("https://masto.quad.moe/users/_HellPie", [Accept: "application/activity+json"], _) do
752 {:ok,
753 %Response{
754 status_code: 200,
755 body: File.read!("test/fixtures/httpoison_mock/hellpie.json")
756 }}
757 end
758
759 def get("https://niu.moe/users/rye", [Accept: "application/activity+json"], _) do
760 {:ok,
761 %Response{
762 status_code: 200,
763 body: File.read!("test/fixtures/httpoison_mock/rye.json")
764 }}
765 end
766
767 def get("https://n1u.moe/users/rye", [Accept: "application/activity+json"], _) do
768 {:ok,
769 %Response{
770 status_code: 200,
771 body: File.read!("test/fixtures/httpoison_mock/rye.json")
772 }}
773 end
774
775 def get(
776 "https://mst3k.interlinked.me/users/luciferMysticus",
777 [Accept: "application/activity+json"],
778 _
779 ) do
780 {:ok,
781 %Response{
782 status_code: 200,
783 body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json")
784 }}
785 end
786
787 def get("https://mstdn.io/users/mayuutann", [Accept: "application/activity+json"], _) do
788 {:ok,
789 %Response{
790 status_code: 200,
791 body: File.read!("test/fixtures/httpoison_mock/mayumayu.json")
792 }}
793 end
794
795 def get(
796 "http://mastodon.example.org/@admin/99541947525187367",
797 [Accept: "application/activity+json"],
798 _
799 ) do
800 {:ok,
801 %Response{
802 status_code: 200,
803 body: File.read!("test/fixtures/mastodon-note-object.json")
804 }}
805 end
806
807 def get(
808 "https://mstdn.io/users/mayuutann/statuses/99568293732299394",
809 [Accept: "application/activity+json"],
810 _
811 ) do
812 {:ok,
813 %Response{
814 status_code: 200,
815 body: File.read!("test/fixtures/httpoison_mock/mayumayupost.json")
816 }}
817 end
818
819 def get("https://shitposter.club/notice/7369654", _, _) do
820 {:ok,
821 %Response{
822 status_code: 200,
823 body: File.read!("test/fixtures/httpoison_mock/7369654.html")
824 }}
825 end
826
827 def get("https://shitposter.club/api/statuses/show/7369654.atom", _body, _headers) do
828 {:ok,
829 %Response{
830 status_code: 200,
831 body: File.read!("test/fixtures/httpoison_mock/7369654.atom")
832 }}
833 end
834
835 def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/", _, _) do
836 {:ok,
837 %Response{
838 status_code: 200,
839 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-article.json")
840 }}
841 end
842
843 def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _) do
844 {:ok,
845 %Response{
846 status_code: 200,
847 body: File.read!("test/fixtures/httpoison_mock/baptiste.gelex.xyz-user.json")
848 }}
849 end
850
851 def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _) do
852 {:ok,
853 %Response{
854 status_code: 200,
855 body: File.read!("test/fixtures/httpoison_mock/peertube.moe-vid.json")
856 }}
857 end
858
859 def get("https://peertube.moe/accounts/7even", _, _) do
860 {:ok,
861 %Response{
862 status_code: 200,
863 body: File.read!("test/fixtures/httpoison_mock/7even.json")
864 }}
865 end
866
867 def get(url, body, headers) do
868 {:error,
869 "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{
870 inspect(headers)
871 }"}
872 end
873
874 def post(url, _body, _headers) do
875 {:error, "Not implemented the mock response for post #{inspect(url)}"}
876 end
877
878 def post(url, _body, _headers, _options) do
879 {:error, "Not implemented the mock response for post #{inspect(url)}"}
880 end
881 end