This repository was archived by the owner on Jul 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_random_cli.py
More file actions
executable file
·37 lines (31 loc) · 1.4 KB
/
test_random_cli.py
File metadata and controls
executable file
·37 lines (31 loc) · 1.4 KB
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
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
import random_cli
import string
class TestRandomCli:
def test_random_alphanumeric_string__len(self):
for i in range(10):
result = random_cli.random_alphanumeric_string(64)
assert len(result) == 64, \
'random_alphanumeric_string does not return correct length.'
def test_random_alphanumeric_string__alphanumeric(self):
for i in range(10):
alphanumeric = string.ascii_letters + string.digits
result = random_cli.random_alphanumeric_string(64)
for char in result:
assert char in alphanumeric, \
"{} is not alphanumeric.".format(char)
def test_random_hex_string__hex(self):
for i in range(10):
result = random_cli.random_hex_string(64)
for char in result:
assert char in string.hexdigits, \
"{} is not hexdigits".format(char)
def test_random_printable_string__printable__len(self):
for i in range(10):
printable = string.ascii_letters + string.digits
printable += string.punctuation
result = random_cli.random_printable_string(64)
assert len(result) == 64, \
'random_printable_string does not return correct length.'
for char in result:
assert char in printable, "{} is not printable.".format(char)