summaryrefslogtreecommitdiff
path: root/test/captcha_test.exs
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2019-12-19 12:16:33 -0600
committerMark Felder <feld@FreeBSD.org>2019-12-19 12:16:33 -0600
commit50638525db6bf7d59c4a5820848c9f6773cc49e1 (patch)
tree6d94f34ddd482d57178107076a7e2f44698a3e43 /test/captcha_test.exs
parentdf469b4468168cf072e73df73e0fdde2bbab1da5 (diff)
parent38ad407395e838ddf1c11922806adc080af44d36 (diff)
downloadpleroma-50638525db6bf7d59c4a5820848c9f6773cc49e1.tar.gz
pleroma-50638525db6bf7d59c4a5820848c9f6773cc49e1.zip
Merge branch 'develop' into config/benchmark
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