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