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