diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-17 09:24:08 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-17 09:24:08 +0300 |
commit | a879c396bb3a07929d4821ef2c29610808962c6d (patch) | |
tree | c0e64cdda3a4ab59d2fbdd25db65d8d795dba6c6 /test/captcha_test.exs | |
parent | 22fc271e23a5dd1570ea7429b563f6edc42613c4 (diff) | |
parent | 804b961d3c8e0034c7b6057a164126e5d01a084b (diff) | |
download | pleroma-a879c396bb3a07929d4821ef2c29610808962c6d.tar.gz pleroma-a879c396bb3a07929d4821ef2c29610808962c6d.zip |
Merge branch 'develop' into feature/tag_feed
Diffstat (limited to 'test/captcha_test.exs')
-rw-r--r-- | test/captcha_test.exs | 18 |
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 |