commit: 5853d9c8437a4c4a4e62dedaffbee5a01489cd9f
parent 90986667cedb20b316ae4e160729d78d692d0c0e
Author: rinpatch <rinpatch@sdf.org>
Date: Sun, 25 Aug 2019 08:09:18 +0000
Merge branch 'bugfix/log_non_implemented_mocks' into 'develop'
HttpRequestMock: Log non-implemented mock responses
Closes #1088
See merge request pleroma/pleroma!1416
Diffstat:
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
@@ -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