-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathtest_atbash.py
22 lines (19 loc) · 983 Bytes
/
test_atbash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from atbash import atbash_encrypt, atbash_decrypt, atbash_wrapper
def test_atbash_encrypt():
assert callable(atbash_encrypt)
assert isinstance(atbash_encrypt('hello'), str)
assert atbash_encrypt('HELLO') == 'SVOOL'
assert atbash_encrypt('hello') == 'SVOOL'
def test_atbash_decrypt():
assert callable(atbash_decrypt)
assert isinstance(atbash_decrypt('hello'), str)
assert atbash_decrypt('SVOOL') == 'HELLO'
assert atbash_decrypt('svool') == 'HELLO'
def test_atbash_wrapper():
assert callable(atbash_wrapper)
assert isinstance(atbash_wrapper('hello', method='encrypt'), str)
assert atbash_wrapper('hello', method='encrypt') == 'SVOOL'
assert atbash_wrapper('HELLO', method='encrypt') == 'SVOOL'
assert atbash_wrapper('SVOOL', method='decrypt') == 'HELLO'
assert atbash_wrapper('svool', method='decrypt') == 'HELLO'
assert atbash_wrapper('svool', method='blargh') == "method should be either 'decrypt' or 'encrypt'"