X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fhttp%2Frequest_builder_test.exs;h=fab909905d133936d186bf0d754ffcb65043c01c;hb=5c4ff5c73ce41f252e99a3c5c445efcecaa43dfe;hp=27ca651bebb882bf8a9f9e4d222ad285aa390e74;hpb=514c899275a32e6ef63305f9424c50344d41b12e;p=akkoma
diff --git a/test/http/request_builder_test.exs b/test/http/request_builder_test.exs
index 27ca651be..fab909905 100644
--- a/test/http/request_builder_test.exs
+++ b/test/http/request_builder_test.exs
@@ -1,24 +1,21 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.HTTP.RequestBuilderTest do
- use ExUnit.Case, async: true
+ use ExUnit.Case
use Pleroma.Tests.Helpers
- alias Pleroma.Config
alias Pleroma.HTTP.Request
alias Pleroma.HTTP.RequestBuilder
describe "headers/2" do
- clear_config([:http, :send_user_agent])
-
test "don't send pleroma user agent" do
assert RequestBuilder.headers(%Request{}, []) == %Request{headers: []}
end
test "send pleroma user agent" do
- Config.put([:http, :send_user_agent], true)
- Config.put([:http, :user_agent], :default)
+ clear_config([:http, :send_user_agent], true)
+ clear_config([:http, :user_agent], :default)
assert RequestBuilder.headers(%Request{}, []) == %Request{
headers: [{"user-agent", Pleroma.Application.user_agent()}]
@@ -26,8 +23,8 @@ defmodule Pleroma.HTTP.RequestBuilderTest do
end
test "send custom user agent" do
- Config.put([:http, :send_user_agent], true)
- Config.put([:http, :user_agent], "totally-not-pleroma")
+ clear_config([:http, :send_user_agent], true)
+ clear_config([:http, :user_agent], "totally-not-pleroma")
assert RequestBuilder.headers(%Request{}, []) == %Request{
headers: [{"user-agent", "totally-not-pleroma"}]
@@ -35,23 +32,6 @@ defmodule Pleroma.HTTP.RequestBuilderTest do
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{