aboutsummaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-02-29 11:34:50 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-02-29 11:34:50 +0300
commit814b275af7748df6bd11dfc6be1b4efce8d5ae70 (patch)
treee18b30dfa6eb020e593dbe1cc0e649da3e6ed394 /test/support
parent6b012ddd69aec0f85c22ad91dbb76e05f2edaf58 (diff)
parentaad057a2d6baaa342f47f55d330f0731277dac06 (diff)
downloadpleroma-814b275af7748df6bd11dfc6be1b4efce8d5ae70.tar.gz
Merge branch 'develop' into gun
Diffstat (limited to 'test/support')
-rw-r--r--test/support/captcha_mock.ex15
-rw-r--r--test/support/oban_helpers.ex4
2 files changed, 16 insertions, 3 deletions
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 <https://pleroma.social/>
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# 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
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()