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