diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-03-03 15:44:13 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-03-03 16:42:03 +0300 |
commit | e605e79df9761cef3d9f93c489dd4618c6b70eda (patch) | |
tree | c27aaa0ce0291869545682c38081f0116144ff6f /test/http/adapter | |
parent | ee8071f0d5a8a53f6a9ae635d6ea57ce8576e21b (diff) | |
download | pleroma-e605e79df9761cef3d9f93c489dd4618c6b70eda.tar.gz pleroma-e605e79df9761cef3d9f93c489dd4618c6b70eda.zip |
simplification of formatting host method
case for format_proxy method
Diffstat (limited to 'test/http/adapter')
-rw-r--r-- | test/http/adapter/gun_test.exs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/http/adapter/gun_test.exs b/test/http/adapter/gun_test.exs index a8dcbae04..a05471ac6 100644 --- a/test/http/adapter/gun_test.exs +++ b/test/http/adapter/gun_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.Adapter.GunTest do @@ -264,4 +264,23 @@ defmodule Pleroma.HTTP.Adapter.GunTest do } = Connections.get_state(:gun_connections) end end + + describe "format_host/1" do + test "with domain" do + assert Gun.format_host("example.com") == 'example.com' + end + + test "with idna domain" do + assert Gun.format_host("ですexample.com") == 'xn--example-183fne.com' + end + + test "with ipv4" do + assert Gun.format_host("127.0.0.1") == '127.0.0.1' + end + + test "with ipv6" do + assert Gun.format_host("2a03:2880:f10c:83:face:b00c:0:25de") == + '2a03:2880:f10c:83:face:b00c:0:25de' + end + end end |