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