From 86e4d23acb640efea8cbc879ddbeadfa0e04f9c8 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 25 Jan 2020 10:47:30 +0300 Subject: [#1505] Background fetching of incoming activities' `replies` collections. --- test/support/oban_helpers.ex | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/support') diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex index 72792c064..0e3b654df 100644 --- a/test/support/oban_helpers.ex +++ b/test/support/oban_helpers.ex @@ -9,6 +9,10 @@ defmodule Pleroma.Tests.ObanHelpers do alias Pleroma.Repo + def wipe_all do + Repo.delete_all(Oban.Job) + end + def perform_all do Oban.Job |> Repo.all() -- cgit v1.2.3 From 4f8c3462a8821ffcf83f8b65edf48e55eff7080c Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 13 Feb 2020 21:55:47 +0300 Subject: Tweaks to `clear_config` calls in tests in order to prevent side effects on config during test suite execution. --- test/support/helpers.ex | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/support') diff --git a/test/support/helpers.ex b/test/support/helpers.ex index d36c29cef..db2f08c81 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -26,6 +26,7 @@ defmodule Pleroma.Tests.Helpers do end end + @doc "Stores initial config value and restores it after *all* test examples are executed." defmacro clear_config_all(config_path) do quote do clear_config_all(unquote(config_path)) do @@ -33,6 +34,11 @@ defmodule Pleroma.Tests.Helpers do end end + @doc """ + Stores initial config value and restores it after *all* test examples are executed. + Only use if *all* test examples should work with the same stubbed value + (*no* examples set a different value). + """ defmacro clear_config_all(config_path, do: yield) do quote do setup_all do -- cgit v1.2.3 From f9fe6a9e30c49374d3f7cd8414ed2fd8585970cd Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 24 Feb 2020 02:41:48 +0100 Subject: Captcha: return invalid when answer_data is nil --- test/support/captcha_mock.ex | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'test/support') diff --git a/test/support/captcha_mock.ex b/test/support/captcha_mock.ex index 65ca6b3bd..6dae94edf 100644 --- a/test/support/captcha_mock.ex +++ b/test/support/captcha_mock.ex @@ -1,5 +1,5 @@ # 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.Captcha.Mock do @@ -7,8 +7,17 @@ defmodule Pleroma.Captcha.Mock do @behaviour Service @impl Service - def new, do: %{type: :mock} + def new, + do: %{ + type: :mock, + token: "afa1815e14e29355e6c8f6b143a39fa2", + answer_data: "63615261b77f5354fb8c4e4986477555", + url: "https://example.org/captcha.png" + } @impl Service - def validate(_token, _captcha, _data), do: :ok + def validate(_token, captcha, captcha) when not is_nil(captcha), do: :ok + + def validate(_token, captcha, answer), + do: {:error, "Invalid CAPTCHA captcha: #{inspect(captcha)} ; answer: #{inspect(answer)}"} end -- cgit v1.2.3