Use Phoenix.ConnTest.redirected_to/2

This commit is contained in:
Mark Felder 2023-05-31 09:50:47 -04:00
parent d998a114e2
commit 46c799f528
3 changed files with 3 additions and 13 deletions

0
changelog.d/3899.skip Normal file
View File

View File

@ -77,14 +77,9 @@ test "it returns a 302 for invalid host", %{conn: conn} do
with_mock Pleroma.ReverseProxy, with_mock Pleroma.ReverseProxy,
call: fn _conn, _url, _opts -> %Conn{status: :success} end do call: fn _conn, _url, _opts -> %Conn{status: :success} end do
%{resp_headers: resp_headers, status: status} = get(conn, proxy_url) conn = get(conn, proxy_url)
assert status == 302 assert redirected_to(conn, 302) == expected_url
assert Enum.any?(
resp_headers,
&(&1 == {"location", expected_url})
)
end end
end end

View File

@ -64,11 +64,6 @@ test "denies access to media if wrong Host", %{
|> Map.put(:scheme, new_media_scheme) |> Map.put(:scheme, new_media_scheme)
|> URI.to_string() |> URI.to_string()
assert conn.status == 302 assert redirected_to(conn, 302) == expected_url
assert Enum.any?(
conn.resp_headers,
&(&1 == {"location", expected_url})
)
end end
end end