Merge branch 'bugfix/log_non_implemented_mocks' into 'develop'

HttpRequestMock: Log non-implemented mock responses

Closes #1088

See merge request pleroma/pleroma!1416
This commit is contained in:
rinpatch 2019-08-25 08:09:18 +00:00
commit 5853d9c843

View File

@ -17,9 +17,12 @@ defmodule HttpRequestMock do
with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
res res
else else
{_, _r} = error -> error ->
# Logger.warn(r) with {:error, message} <- error do
error Logger.warn(message)
end
{_, _r} = error
end end
end end
@ -970,7 +973,7 @@ defmodule HttpRequestMock do
def get(url, query, body, headers) do def get(url, query, body, headers) do
{:error, {:error,
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{ "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
inspect(headers) inspect(headers)
}"} }"}
end end
@ -1032,7 +1035,10 @@ defmodule HttpRequestMock do
}} }}
end end
def post(url, _query, _body, _headers) do def post(url, query, body, headers) do
{:error, "Not implemented the mock response for post #{inspect(url)}"} {:error,
"Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{
inspect(headers)
}"}
end end
end end