summaryrefslogtreecommitdiff
path: root/test/captcha_test.exs
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-12-13 01:51:52 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-12-13 01:51:52 +0700
commit7528322f83d5bee92a030e2e626436dab327df9b (patch)
treed3a69eec557a563ce89246c886e9c31687c8debf /test/captcha_test.exs
parentc6f2735ffa1db7871bcb56c00b6d19e4de346d18 (diff)
parent2f31cef71f377cf660f818e7e204436f2070bd78 (diff)
downloadpleroma-7528322f83d5bee92a030e2e626436dab327df9b.tar.gz
pleroma-7528322f83d5bee92a030e2e626436dab327df9b.zip
Merge branch 'develop' into feature/custom-runtime-modules
Diffstat (limited to 'test/captcha_test.exs')
-rw-r--r--test/captcha_test.exs18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/captcha_test.exs b/test/captcha_test.exs
index 9f395d6b4..393c8219e 100644
--- a/test/captcha_test.exs
+++ b/test/captcha_test.exs
@@ -8,6 +8,7 @@ defmodule Pleroma.CaptchaTest do
import Tesla.Mock
alias Pleroma.Captcha.Kocaptcha
+ alias Pleroma.Captcha.Native
@ets_options [:ordered_set, :private, :named_table, {:read_concurrency, true}]
@@ -43,4 +44,21 @@ defmodule Pleroma.CaptchaTest do
) == :ok
end
end
+
+ describe "Native" do
+ test "new and validate" do
+ new = Native.new()
+
+ assert %{
+ answer_data: answer,
+ token: token,
+ type: :native,
+ url: "data:image/png;base64," <> _
+ } = new
+
+ assert is_binary(answer)
+ assert :ok = Native.validate(token, answer, answer)
+ assert {:error, "Invalid CAPTCHA"} == Native.validate(token, answer, answer <> "foobar")
+ end
+ end
end