user_agent_mock --> request_mock

This commit is contained in:
Alex Gleason 2021-02-24 21:37:30 -06:00 committed by lain
parent 1dc5794e29
commit 7ebbe11e75

View File

@ -18,7 +18,7 @@ defmodule Pleroma.ReverseProxyTest do
setup :verify_on_exit! setup :verify_on_exit!
defp user_agent_mock(invokes) do defp request_mock(invokes) do
ClientMock ClientMock
|> expect(:request, fn :get, url, headers, _body, _opts -> |> expect(:request, fn :get, url, headers, _body, _opts ->
Registry.register(ClientMock, url, 0) Registry.register(ClientMock, url, 0)
@ -45,7 +45,7 @@ defmodule Pleroma.ReverseProxyTest do
describe "reverse proxy" do describe "reverse proxy" do
test "do not track successful request", %{conn: conn} do test "do not track successful request", %{conn: conn} do
user_agent_mock(2) request_mock(2)
url = "/success" url = "/success"
conn = ReverseProxy.call(conn, url) conn = ReverseProxy.call(conn, url)
@ -56,7 +56,7 @@ defmodule Pleroma.ReverseProxyTest do
end end
test "use Pleroma's user agent in the request; don't pass the client's", %{conn: conn} do test "use Pleroma's user agent in the request; don't pass the client's", %{conn: conn} do
user_agent_mock(2) request_mock(2)
conn = conn =
conn conn
@ -110,7 +110,7 @@ defmodule Pleroma.ReverseProxyTest do
describe "max_body" do describe "max_body" do
test "length returns error if content-length more than option", %{conn: conn} do test "length returns error if content-length more than option", %{conn: conn} do
user_agent_mock(0) request_mock(0)
assert capture_log(fn -> assert capture_log(fn ->
ReverseProxy.call(conn, "/huge-file", max_body_length: 4) ReverseProxy.call(conn, "/huge-file", max_body_length: 4)