Advertisement
Mochinov

Untitled

Oct 18th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2. def test_verify_otp_with_wrong_otp(
  3. dependency_patched_user_repository,
  4. client: TestClient,
  5. user_email: str,
  6. user_password: str,
  7. mocker: MockFixture,
  8. ):
  9. user = UserSchemaFactory(
  10. email=user_email,
  11. password=get_password_hash(user_password),
  12. )
  13. dependency_patched_user_repository.return_value.get_by_email.return_value = user
  14. user_otp = "123456"
  15. mocker.patch("services.auth.check_auth_attempts", return_value=None)
  16. mocker.patch("services.redis_in_memory_service.redis_service.get")
  17. mocker.patch("services.redis_in_memory_service.redis_service.delete")
  18. mocker.patch("services.redis_in_memory_service.redis_service.set")
  19. mocker.patch("services.otp.otp_service.get", return_value=user_otp)
  20.  
  21. response = client.post(
  22. url=VERIFY_OTP_URL,
  23. json={"email": user_email, "otp": user_otp},
  24. )
  25.  
  26. assert response.status_code == status.HTTP_400_BAD_REQUEST
  27. assert response.json() == {
  28. "detail": "Wrong OTP",
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement