X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fhttp%2Frequest_builder_test.exs;h=fab909905d133936d186bf0d754ffcb65043c01c;hb=5c4ff5c73ce41f252e99a3c5c445efcecaa43dfe;hp=70946a932ed1f4b2ac24da72488291c2fd7d174e;hpb=d9e4b77f8be8249b428a7ef1448c9a2161dee88a;p=akkoma
diff --git a/test/http/request_builder_test.exs b/test/http/request_builder_test.exs
index 70946a932..fab909905 100644
--- a/test/http/request_builder_test.exs
+++ b/test/http/request_builder_test.exs
@@ -1,25 +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])
- clear_config([:http, :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()}]
@@ -27,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"}]
@@ -36,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{