X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fhttp%2Fconnection_test.exs;h=7c94a50b242a6701652254770d8e4ed0ff05ab9c;hb=59cf78e41236a527b21befaadd329e882a62b40a;hp=25a2bac1c0b6464d7d99bb10665d1df4d8c02e60;hpb=b2eb1124d115beda0907121c3c6f10783b34f352;p=akkoma diff --git a/test/http/connection_test.exs b/test/http/connection_test.exs index 25a2bac1c..7c94a50b2 100644 --- a/test/http/connection_test.exs +++ b/test/http/connection_test.exs @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.ConnectionTest do - use ExUnit.Case, async: true + use ExUnit.Case use Pleroma.Tests.Helpers import ExUnit.CaptureLog @@ -82,7 +82,7 @@ defmodule Pleroma.HTTP.ConnectionTest do end describe "options/3" do - clear_config([:http, :proxy_url]) + setup do: clear_config([:http, :proxy_url]) test "without proxy_url in config" do Config.delete([:http, :proxy_url]) @@ -113,4 +113,23 @@ defmodule Pleroma.HTTP.ConnectionTest do assert opts[:proxy] == {'example.com', 4321} end end + + describe "format_host/1" do + test "with domain" do + assert Connection.format_host("example.com") == 'example.com' + end + + test "with idna domain" do + assert Connection.format_host("ですexample.com") == 'xn--example-183fne.com' + end + + test "with ipv4" do + assert Connection.format_host("127.0.0.1") == '127.0.0.1' + end + + test "with ipv6" do + assert Connection.format_host("2a03:2880:f10c:83:face:b00c:0:25de") == + '2a03:2880:f10c:83:face:b00c:0:25de' + end + end end