From e8537208bd9af701cbfc788ca307b8352306a36b Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Sat, 15 Dec 2018 22:38:39 +0300 Subject: [PATCH] Add a captcha mock for tests --- config/test.exs | 5 +++++ test/support/captcha_mock.ex | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/support/captcha_mock.ex diff --git a/config/test.exs b/config/test.exs index 5c6acfead..f5348bd46 100644 --- a/config/test.exs +++ b/config/test.exs @@ -6,6 +6,11 @@ http: [port: 4001], server: false +# Disable captha for tests +config :pleroma, Pleroma.Captcha, + enabled: true, + method: Pleroma.Captcha.Mock # A fake captcha service for tests + # Print only warnings and errors during test config :logger, level: :warn diff --git a/test/support/captcha_mock.ex b/test/support/captcha_mock.ex new file mode 100644 index 000000000..9d79f2e95 --- /dev/null +++ b/test/support/captcha_mock.ex @@ -0,0 +1,10 @@ +defmodule Pleroma.Captcha.Mock do + alias Pleroma.Captcha.Service + @behaviour Service + + @impl Service + def new(), do: %{type: :mock} + + @impl Service + def validate(_token, _captcha), do: true +end