removing try block in getting gun info
[akkoma] / test / http / connection_test.exs
index c1ff0cc21aaff52f74b09aa12d1fc8d3e9bb3f3d..d4db3798c716b80eb46b6fae06780b0c6b862fe2 100644 (file)
@@ -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.ConnectionTest do
@@ -10,7 +10,7 @@ defmodule Pleroma.HTTP.ConnectionTest do
   alias Pleroma.HTTP.Connection
 
   setup_all do
-    {:ok, _} = Registry.start_link(keys: :unique, name: Pleroma.Gun.API.Mock)
+    {:ok, _} = Registry.start_link(keys: :unique, name: Pleroma.GunMock)
     :ok
   end
 
@@ -51,31 +51,31 @@ defmodule Pleroma.HTTP.ConnectionTest do
   describe "parse_proxy/1 errors" do
     test "ip without port" do
       capture_log(fn ->
-        assert Connection.parse_proxy("127.0.0.1") == {:error, :error_parsing_proxy}
+        assert Connection.parse_proxy("127.0.0.1") == {:error, :invalid_proxy}
       end) =~ "parsing proxy fail \"127.0.0.1\""
     end
 
     test "host without port" do
       capture_log(fn ->
-        assert Connection.parse_proxy("localhost") == {:error, :error_parsing_proxy}
+        assert Connection.parse_proxy("localhost") == {:error, :invalid_proxy}
       end) =~ "parsing proxy fail \"localhost\""
     end
 
     test "host with bad port" do
       capture_log(fn ->
-        assert Connection.parse_proxy("localhost:port") == {:error, :error_parsing_port_in_proxy}
+        assert Connection.parse_proxy("localhost:port") == {:error, :invalid_proxy_port}
       end) =~ "parsing port in proxy fail \"localhost:port\""
     end
 
     test "ip with bad port" do
       capture_log(fn ->
-        assert Connection.parse_proxy("127.0.0.1:15.9") == {:error, :error_parsing_port_in_proxy}
+        assert Connection.parse_proxy("127.0.0.1:15.9") == {:error, :invalid_proxy_port}
       end) =~ "parsing port in proxy fail \"127.0.0.1:15.9\""
     end
 
     test "as tuple without port" do
       capture_log(fn ->
-        assert Connection.parse_proxy({:socks5, :localhost}) == {:error, :error_parsing_proxy}
+        assert Connection.parse_proxy({:socks5, :localhost}) == {:error, :invalid_proxy}
       end) =~ "parsing proxy fail {:socks5, :localhost}"
     end
 
@@ -124,7 +124,7 @@ defmodule Pleroma.HTTP.ConnectionTest do
       uri = URI.parse("https://some-domain.com")
 
       pid = Process.whereis(:federation)
-      :ok = Pleroma.Pool.Connections.open_conn(uri, :gun_connections, genserver_pid: pid)
+      :ok = Pleroma.Gun.Conn.open(uri, :gun_connections, genserver_pid: pid)
 
       opts = Connection.options(uri)
 
@@ -134,7 +134,6 @@ defmodule Pleroma.HTTP.ConnectionTest do
       assert tls_opts[:depth] == 20
       assert tls_opts[:reuse_sessions] == false
 
-      assert opts[:original] == "some-domain.com:443"
       assert opts[:close_conn] == false
       assert is_pid(opts[:conn])
     end