diff options
author | Mark Felder <feld@feld.me> | 2021-12-29 18:33:53 +0000 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2022-06-07 17:50:50 +0000 |
commit | d49c3e24a05128c730c5c976c7e1111a5e580a82 (patch) | |
tree | 63aef6d181f683e26d8ac842249e40b716c5e601 /test | |
parent | 75f912c63f9a18e37f8ddbd403755b878467435a (diff) | |
download | pleroma-d49c3e24a05128c730c5c976c7e1111a5e580a82.tar.gz |
Finch everywhere
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/config/deprecation_warnings_test.exs | 44 | ||||
-rw-r--r-- | test/pleroma/reverse_proxy_test.exs | 38 | ||||
-rw-r--r-- | test/test_helper.exs | 3 |
3 files changed, 0 insertions, 85 deletions
diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index 202ec4b90..809f24213 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -280,50 +280,6 @@ defmodule Pleroma.Config.DeprecationWarningsTest do "Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket." end - describe "check_gun_pool_options/0" do - test "await_up_timeout" do - config = Config.get(:connections_pool) - clear_config(:connections_pool, Keyword.put(config, :await_up_timeout, 5_000)) - - assert capture_log(fn -> - DeprecationWarnings.check_gun_pool_options() - end) =~ - "Your config is using old setting `config :pleroma, :connections_pool, await_up_timeout`." - end - - test "pool timeout" do - old_config = [ - federation: [ - size: 50, - max_waiting: 10, - timeout: 10_000 - ], - media: [ - size: 50, - max_waiting: 10, - timeout: 10_000 - ], - upload: [ - size: 25, - max_waiting: 5, - timeout: 15_000 - ], - default: [ - size: 10, - max_waiting: 2, - timeout: 5_000 - ] - ] - - clear_config(:pools, old_config) - - assert capture_log(fn -> - DeprecationWarnings.check_gun_pool_options() - end) =~ - "Your config is using old setting name `timeout` instead of `recv_timeout` in pool settings" - end - end - test "check_old_chat_shoutbox/0" do clear_config([:instance, :chat_limit], 1_000) clear_config([:chat, :enabled], true) diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index 0bd4db8d1..54e860b6c 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -8,44 +8,10 @@ defmodule Pleroma.ReverseProxyTest do import Mox alias Pleroma.ReverseProxy - alias Pleroma.ReverseProxy.ClientMock alias Plug.Conn - setup_all do - {:ok, _} = Registry.start_link(keys: :unique, name: ClientMock) - :ok - end - - setup :verify_on_exit! - - defp request_mock(invokes) do - ClientMock - |> expect(:request, fn :get, url, headers, _body, _opts -> - Registry.register(ClientMock, url, 0) - body = headers |> Enum.into(%{}) |> Jason.encode!() - - {:ok, 200, - [ - {"content-type", "application/json"}, - {"content-length", byte_size(body) |> to_string()} - ], %{url: url, body: body}} - end) - |> expect(:stream_body, invokes, fn %{url: url, body: body} = client -> - case Registry.lookup(ClientMock, url) do - [{_, 0}] -> - Registry.update_value(ClientMock, url, &(&1 + 1)) - {:ok, body, client} - - [{_, 1}] -> - Registry.unregister(ClientMock, url) - :done - end - end) - end - describe "reverse proxy" do test "do not track successful request", %{conn: conn} do - request_mock(2) url = "/success" conn = ReverseProxy.call(conn, url) @@ -56,8 +22,6 @@ defmodule Pleroma.ReverseProxyTest do end test "use Pleroma's user agent in the request; don't pass the client's", %{conn: conn} do - request_mock(2) - conn = conn |> Plug.Conn.put_req_header("user-agent", "fake/1.0") @@ -110,8 +74,6 @@ defmodule Pleroma.ReverseProxyTest do describe "max_body" do test "length returns error if content-length more than option", %{conn: conn} do - request_mock(0) - assert capture_log(fn -> ReverseProxy.call(conn, "/huge-file", max_body_length: 4) end) =~ diff --git a/test/test_helper.exs b/test/test_helper.exs index 60a61484f..d2016ff53 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -7,9 +7,6 @@ ExUnit.start(exclude: [:federated, :erratic] ++ os_exclude) Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, :manual) -Mox.defmock(Pleroma.ReverseProxy.ClientMock, for: Pleroma.ReverseProxy.Client) -Mox.defmock(Pleroma.GunMock, for: Pleroma.Gun) - {:ok, _} = Application.ensure_all_started(:ex_machina) ExUnit.after_suite(fn _results -> |