Merge branch 'bugfix/log_non_implemented_mocks' into 'develop'

HttpRequestMock: Log non-implemented mock responses

Closes #1088

See merge request pleroma/pleroma!1416
develop
rinpatch 2019-08-25 08:09:18 +00:00
commit 5853d9c843
1 changed files with 12 additions and 6 deletions

View File

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