Switch formatting checks to Elixir 1.15

This commit is contained in:
Haelwenn (lanodan) Monnier 2024-05-31 07:19:48 +02:00 committed by Mark Felder
commit cb91dab75f
26 changed files with 94 additions and 68 deletions

View file

@ -55,23 +55,23 @@ defmodule Pleroma.HTTP.AdapterHelper.GunTest do
uri = URI.parse("https://some-domain.com")
opts = Gun.options([receive_conn: false], uri)
assert opts[:proxy] == {'localhost', 8123}
assert opts[:proxy] == {~c"localhost", 8123}
end
test "parses tuple proxy scheme host and port" do
clear_config([:http, :proxy_url], {:socks, 'localhost', 1234})
clear_config([:http, :proxy_url], {:socks, ~c"localhost", 1234})
uri = URI.parse("https://some-domain.com")
opts = Gun.options([receive_conn: false], uri)
assert opts[:proxy] == {:socks, 'localhost', 1234}
assert opts[:proxy] == {:socks, ~c"localhost", 1234}
end
test "passed opts have more weight than defaults" do
clear_config([:http, :proxy_url], {:socks5, 'localhost', 1234})
clear_config([:http, :proxy_url], {:socks5, ~c"localhost", 1234})
uri = URI.parse("https://some-domain.com")
opts = Gun.options([receive_conn: false, proxy: {'example.com', 4321}], uri)
opts = Gun.options([receive_conn: false, proxy: {~c"example.com", 4321}], uri)
assert opts[:proxy] == {'example.com', 4321}
assert opts[:proxy] == {~c"example.com", 4321}
end
end
end

View file

@ -17,12 +17,12 @@ defmodule Pleroma.HTTP.AdapterHelperTest do
end
test "localhost with port" do
assert AdapterHelper.format_proxy("localhost:8123") == {'localhost', 8123}
assert AdapterHelper.format_proxy("localhost:8123") == {~c"localhost", 8123}
end
test "tuple" do
assert AdapterHelper.format_proxy({:socks4, :localhost, 9050}) ==
{:socks4, 'localhost', 9050}
{:socks4, ~c"localhost", 9050}
end
end
end