A multipurpose python flask API server and administration SPA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

  1. import pytest
  2. from server import errors
  3. from server.service import authentication_service
  4. def test_validate_password_strength_good_password():
  5. proposed_good_password = 'AazZ1001'
  6. assert proposed_good_password == authentication_service\
  7. .validate_password_strength(proposed_good_password)
  8. def test_validate_password_strength_too_short():
  9. proposed_good_password = 'AazZ100'
  10. with pytest.raises(errors.ValidationError) as error_info:
  11. authentication_service.validate_password_strength(
  12. proposed_good_password)
  13. def test_validate_password_strength_missing_uppercase():
  14. proposed_good_password = 'aazz1001'
  15. with pytest.raises(errors.ValidationError) as error_info:
  16. authentication_service.validate_password_strength(
  17. proposed_good_password)
  18. def test_validate_password_strength_missing_lowercase():
  19. proposed_good_password = 'AAZZ1001'
  20. with pytest.raises(errors.ValidationError) as error_info:
  21. authentication_service.validate_password_strength(
  22. proposed_good_password)
  23. def test_validate_password_strength_missing_numbers():
  24. proposed_good_password = 'AAZZZZAA'
  25. with pytest.raises(errors.ValidationError) as error_info:
  26. authentication_service.validate_password_strength(
  27. proposed_good_password)