Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PASSWORD RELATED/password-validator/PASSWORD_VALIDATOR.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def passwordValidator():
if ' ' in userPassword:
message = 'Invalid Password..your password shouldn\'t contain space(s)'
return message
if not any(i in string.ascii_letters for i in userPassword):
if not any(i in string.ascii_uppercase for i in userPassword):
message = 'Invalid Password..your password should contain at least '
message += 'an uppercase letter and a lowercase letter'
return message
Expand Down
16 changes: 16 additions & 0 deletions PASSWORD RELATED/password-validator/test_password_validator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest
from unittest.mock import patch


class TestPasswordValidator(unittest.TestCase):

def test_password_must_contain_uppercase(self):
with patch("builtins.input", return_value="abcdef1!"):
from PASSWORD_VALIDATOR import passwordValidator
result = passwordValidator()

self.assertIn("Invalid Password", result)


if __name__ == "__main__":
unittest.main()
Loading