logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

adapter_helper_test.exs (783B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.HTTP.AdapterHelperTest do
  5. use ExUnit.Case, async: true
  6. alias Pleroma.HTTP.AdapterHelper
  7. describe "format_proxy/1" do
  8. test "with nil" do
  9. assert AdapterHelper.format_proxy(nil) == nil
  10. end
  11. test "with string" do
  12. assert AdapterHelper.format_proxy("127.0.0.1:8123") == {{127, 0, 0, 1}, 8123}
  13. end
  14. test "localhost with port" do
  15. assert AdapterHelper.format_proxy("localhost:8123") == {'localhost', 8123}
  16. end
  17. test "tuple" do
  18. assert AdapterHelper.format_proxy({:socks4, :localhost, 9050}) ==
  19. {:socks4, 'localhost', 9050}
  20. end
  21. end
  22. end