1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.HTTP.AdapterHelperTest do
6 use ExUnit.Case, async: true
8 alias Pleroma.HTTP.AdapterHelper
10 describe "format_proxy/1" do
12 assert AdapterHelper.format_proxy(nil) == nil
16 assert AdapterHelper.format_proxy("127.0.0.1:8123") == {{127, 0, 0, 1}, 8123}
19 test "localhost with port" do
20 assert AdapterHelper.format_proxy("localhost:8123") == {'localhost', 8123}
24 assert AdapterHelper.format_proxy({:socks4, :localhost, 9050}) ==
25 {:socks4, 'localhost', 9050}