Skip to content

Commit

Permalink
moving files, adding unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mclacore committed Jul 22, 2024
1 parent a93173d commit a9d36b7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions src/test_password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import unittest
from password import PasswordGenerator


class PasswordTests(unittest.TestCase):
def test_length(self):
gen_pass = PasswordGenerator()
test_pass = gen_pass.generate_password(8, 0, 0)
test_case = "abcd1234"
self.assertEqual(len(test_case), len(test_pass))

def test_numbers(self):
gen_pass = PasswordGenerator()
test_pass = gen_pass.generate_password(8, 1, 0)
self.assertRegex(test_pass, r'[a-zA-Z0-9]{8}')

def test_symbols(self):
gen_pass = PasswordGenerator()
test_pass = gen_pass.generate_password(8, 0, 1)
self.assertRegex(test_pass, r'\D{8}')


if __name__ == '__main__':
unittest.main()
File renamed without changes.
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python3 -m unittest discover -s src

0 comments on commit a9d36b7

Please sign in to comment.