You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
941 B
36 lines
941 B
5 years ago
|
# Pleroma: A lightweight social networking server
|
||
5 years ago
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||
5 years ago
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
5 years ago
|
defmodule Pleroma.HTTP.AdapterHelper.HackneyTest do
|
||
5 years ago
|
use ExUnit.Case, async: true
|
||
5 years ago
|
use Pleroma.Tests.Helpers
|
||
|
|
||
5 years ago
|
alias Pleroma.HTTP.AdapterHelper.Hackney
|
||
5 years ago
|
|
||
|
setup_all do
|
||
|
uri = URI.parse("http://domain.com")
|
||
|
{:ok, uri: uri}
|
||
|
end
|
||
|
|
||
|
describe "options/2" do
|
||
5 years ago
|
setup do: clear_config([:http, :adapter], a: 1, b: 2)
|
||
5 years ago
|
|
||
|
test "add proxy and opts from config", %{uri: uri} do
|
||
5 years ago
|
opts = Hackney.options([proxy: "localhost:8123"], uri)
|
||
5 years ago
|
|
||
|
assert opts[:a] == 1
|
||
|
assert opts[:b] == 2
|
||
|
assert opts[:proxy] == "localhost:8123"
|
||
|
end
|
||
|
|
||
|
test "respect connection opts and no proxy", %{uri: uri} do
|
||
|
opts = Hackney.options([a: 2, b: 1], uri)
|
||
|
|
||
|
assert opts[:a] == 2
|
||
|
assert opts[:b] == 1
|
||
|
refute Keyword.has_key?(opts, :proxy)
|
||
|
end
|
||
|
end
|
||
|
end
|