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.AdapterHelper.HackneyTest do
6 use ExUnit.Case, async: true
7 use Pleroma.Tests.Helpers
9 alias Pleroma.HTTP.AdapterHelper.Hackney
12 uri = URI.parse("http://domain.com")
16 describe "options/2" do
17 setup do: clear_config([:http, :adapter], a: 1, b: 2)
19 test "add proxy and opts from config", %{uri: uri} do
20 opts = Hackney.options([proxy: "localhost:8123"], uri)
24 assert opts[:proxy] == "localhost:8123"
27 test "respect connection opts and no proxy", %{uri: uri} do
28 opts = Hackney.options([a: 2, b: 1], uri)
32 refute Keyword.has_key?(opts, :proxy)