Files
certificate-system/backend/tests/test_captcha.py
2026-06-06 19:32:24 +08:00

10 lines
372 B
Python

from app.services.captcha import make_captcha, verify_captcha
def test_captcha_can_only_be_used_once():
captcha = make_captcha()
captcha_id = captcha["captcha_id"]
# The real code is intentionally not exposed. This test locks in one-time consumption behavior.
assert not verify_captcha(captcha_id, "bad")
assert not verify_captcha(captcha_id, "bad")