aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-11-05 16:14:26 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-11-05 17:05:08 +0300
commit122e487274f3bf5dde33a0ed417fd75e4ca114cb (patch)
treef4ed43151ba98595e9c3634f148961d5b1a8eec9
parent8afc5d72ad5c458c995d32aa598d654b7c17e2c3 (diff)
downloadpleroma-122e487274f3bf5dde33a0ed417fd75e4ca114cb.tar.gz
fix test
-rw-r--r--test/pleroma/web/mastodon_api/registration_user_test.exs15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/pleroma/web/mastodon_api/registration_user_test.exs b/test/pleroma/web/mastodon_api/registration_user_test.exs
index 5121bdafe..cb1c53ffc 100644
--- a/test/pleroma/web/mastodon_api/registration_user_test.exs
+++ b/test/pleroma/web/mastodon_api/registration_user_test.exs
@@ -653,10 +653,9 @@ defmodule Pleroma.Web.MastodonAPI.RegistrationUserTest do
|> json_response_and_validate_schema(:bad_request)
end
- test "returns an error if captcha is invalid and invite token invalid", %{conn: conn} do
+ test "returns an error if captcha is valid and invite token invalid", %{conn: conn} do
clear_config([:instance, :registrations_open], false)
-
- # invite = insert(:user_invite_token, %{invite_type: "one_time"})
+ %{token: token, answer_data: answer_data} = Pleroma.Captcha.new()
params = %{
username: "lain",
@@ -664,19 +663,21 @@ defmodule Pleroma.Web.MastodonAPI.RegistrationUserTest do
password: "PlzDontHackLain",
agreement: true,
token: "invite.token",
- captcha_solution: "cofe",
- captcha_token: "cofe",
- captcha_answer_data: "cofe"
+ captcha_solution: Pleroma.Captcha.Mock.solution(),
+ captcha_token: token,
+ captcha_answer_data: answer_data
}
assert %{
"error" => "Please review the submission",
- "fields" => %{"captcha" => ["Invalid answer data"]},
+ "fields" => %{"invite" => ["Invalid token"]},
"identifier" => "review_submission"
} ==
conn
|> post("/api/v1/accounts", params)
|> json_response_and_validate_schema(:bad_request)
+
+ Cachex.del(:used_captcha_cache, token)
end
end