-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_project.py
More file actions
28 lines (19 loc) · 814 Bytes
/
test_project.py
File metadata and controls
28 lines (19 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from project import validateUserInput, generatePasswords, scrambleWord
def test_validateUserInput():
assert validateUserInput(["word1", "word2", "word3"]) == ["word1", "word2", "word3"]
assert validateUserInput(["word1", "word2"]) is None
assert validateUserInput([]) is None
def test_scrambleWord():
substitutions = {
"a": "@",
"b": "8",
"c": "(",
}
assert scrambleWord("abc", substitutions) == "@8("
assert scrambleWord("ABC", substitutions) == "@8("
assert scrambleWord("abcdef", substitutions) == "@8(def"
def test_generatePasswords():
words = ["foo", "bar", "buz", "qux"]
substitutions = {"a": "@", "b": "8", "e": "3", "o": "0", "t": "7", "z": "2"}
passwords = generatePasswords(words, substitutions)
assert len(passwords) == 3