1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.CaptchaTest do
10 alias Pleroma.Captcha.Kocaptcha
12 @ets_options [:ordered_set, :private, :named_table, {:read_concurrency, true}]
14 describe "Kocaptcha" do
16 ets_name = Kocaptcha.Ets
17 ^ets_name = :ets.new(ets_name, @ets_options)
20 %{method: :get, url: "https://captcha.kotobank.ch/new"} ->
22 md5: "63615261b77f5354fb8c4e4986477555",
23 token: "afa1815e14e29355e6c8f6b143a39fa2",
24 url: "/captchas/afa1815e14e29355e6c8f6b143a39fa2.png"
31 test "new and validate" do
33 assert new[:type] == :kocaptcha
34 assert new[:token] == "afa1815e14e29355e6c8f6b143a39fa2"
37 "https://captcha.kotobank.ch/captchas/afa1815e14e29355e6c8f6b143a39fa2.png"
39 assert Kocaptcha.validate(