1 defmodule HttpRequestMock do
11 with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
22 def get(url, query \\ [], body \\ [], headers \\ [])
24 def get("https://social.heldscal.la/api/statuses/user_timeline/23211.atom", _, _, _) do
28 "test/fixtures/httpoison_mock/https___social.heldscal.la_api_statuses_user_timeline_23211.atom.xml"
32 def get("https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211", _, _, _) do
35 body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml")}}
38 def get("http://social.heldscal.la/.well-known/host-meta", _, _, _) do
39 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")}}
42 def get("https://social.heldscal.la/.well-known/host-meta", _, _, _) do
43 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta")}}
46 def get("https://mastodon.social/users/lambadalambda.atom", _, _, _) do
47 {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.atom")}}
50 def get("https://social.heldscal.la/user/23211", _, _, [Accept: "application/activity+json"]) do
52 Tesla.Mock.json(%{"id" => "https://social.heldscal.la/user/23211"}, status: 200)
56 def get(url, query, body, headers) do
58 "Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{
67 def post(url, query \\ [], body \\ [], headers \\ [])
69 def post("http://example.org/needs_refresh", _, _, _) do
77 def post(url, _query, _body, _headers) do
78 {:error, "Not implemented the mock response for post #{inspect(url)}"}