-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
43 lines (31 loc) · 943 Bytes
/
test.py
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
38
39
40
41
42
43
from vigenere import encrypt, decrypt
def test_encryption_1():
key = 'snake'
plaintext = 'meet me at elephant lake '
expected = 'FSFERXOUPQXDILSMZBVJ'
assert encrypt(plaintext, key) == expected
def test_encryption_2():
key = 'abc'
plaintext = 'cbacbacba'
expected = 'DDDDDDDDD'
assert encrypt(plaintext, key) == expected
def test_encryption_none():
key = ''
plaintext = 'example'
expected = None
assert encrypt(plaintext, key) == expected
def test_decryption_1():
key = 'snake'
encrypted = 'FSFERXOUPQXDILSMZBVJ'
expected = 'MEETMEATELEPHANTLAKE'
assert decrypt(encrypted, key) == expected
def test_decryption_2():
key = 'zyx'
encrypted = 'aaaaaaaaa'
expected = 'ABCABCABC'
assert decrypt(encrypted, key) == expected
def test_decryption_none():
key = 'example'
encrypted = ''
expected = None
assert decrypt(encrypted, key) == expected