Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test_verify_otp_with_wrong_otp(
- dependency_patched_user_repository,
- client: TestClient,
- user_email: str,
- user_password: str,
- mocker: MockFixture,
- ):
- user = UserSchemaFactory(
- email=user_email,
- password=get_password_hash(user_password),
- )
- dependency_patched_user_repository.return_value.get_by_email.return_value = user
- user_otp = "123456"
- mocker.patch("services.auth.check_auth_attempts", return_value=None)
- mocker.patch("services.redis_in_memory_service.redis_service.get")
- mocker.patch("services.redis_in_memory_service.redis_service.delete")
- mocker.patch("services.redis_in_memory_service.redis_service.set")
- mocker.patch("services.otp.otp_service.get", return_value=user_otp)
- response = client.post(
- url=VERIFY_OTP_URL,
- json={"email": user_email, "otp": user_otp},
- )
- assert response.status_code == status.HTTP_400_BAD_REQUEST
- assert response.json() == {
- "detail": "Wrong OTP",
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement