# 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.RequestBuilderTest do
alias Pleroma.HTTP.RequestBuilder
describe "headers/2" do
- clear_config([:http, :send_user_agent])
- clear_config([:http, :user_agent])
+ setup do: clear_config([:http, :send_user_agent])
+ setup do: clear_config([:http, :user_agent])
test "don't send pleroma user agent" do
assert RequestBuilder.headers(%Request{}, []) == %Request{headers: []}
end
end
- describe "add_optional_params/3" do
- test "don't add if keyword is empty" do
- assert RequestBuilder.add_optional_params(%{}, %{}, []) == %{}
- end
-
- test "add query parameter" do
- assert RequestBuilder.add_optional_params(
- %Request{},
- %{query: :query, body: :body, another: :val},
- [
- {:query, "param1=val1¶m2=val2"},
- {:body, "some body"}
- ]
- ) == %Request{query: "param1=val1¶m2=val2", body: "some body"}
- end
- end
-
describe "add_param/4" do
test "add file parameter" do
%Request{