示例#1
0
def test_a_should_be_decrypted_to_z_when_key_1():
    assert decrypt('a', 1) == 'z'
示例#2
0
def test_b_should_be_decrypted_to_a_when_key_1():
    assert decrypt('b', 1) == 'a'
示例#3
0
def test_bc_should_be_decrypted_to_ab_when_key_1():
    assert decrypt('bc', 1) == 'ab'
示例#4
0
def test_decrypt_return_plain_text():
    plain_text = random_plain_text_generator()
    key = random.randint(1, 25)
    cipher_text = encrypt(message=plain_text, key=key)

    assert decrypt(cipher_text, key) == plain_text
示例#5
0
def test_decrypt_return_plain_text():
    plain_text = random_plain_text_generator()
    key = random.randint(1, 25)
    cipher_text = encrypt(message=plain_text, key=key)

    assert decrypt(cipher_text, key) == plain_text
示例#6
0
def test_B_should_be_decrypted_to_A_when_key_1():
    assert decrypt('B', 1) == 'A'
示例#7
0
def test_should_only_decrypt_alphabetic_chars():
    assert decrypt('A b 1123 ojdp', 1) == 'Z a 1123 nico'
示例#8
0
def test_B_should_be_decrypted_to_A_when_key_1():
    assert decrypt('B', 1) == 'A'
示例#9
0
def test_A_should_be_decrypted_to_Z_when_key_1():
    assert decrypt('A', 1) == 'Z'
示例#10
0
def test_b_should_be_decrypted_to_z_when_key_2():
    assert decrypt('b', 2) == 'z'
示例#11
0
def test_ef_should_be_decrypted_to_xy_when_key_7():
    assert decrypt('ef', 7) == 'xy'
示例#12
0
def test_a_should_be_decrypted_to_z_when_key_1():
    assert decrypt('a', 1) == 'z'
示例#13
0
def test_bc_should_be_decrypted_to_ab_when_key_1():
    assert decrypt('bc', 1) == 'ab'
示例#14
0
def test_b_should_be_decrypted_to_a_when_key_1():
    assert decrypt('b', 1) == 'a'
示例#15
0
def test_b_should_be_decrypted_to_z_when_key_2():
    assert decrypt('b', 2) == 'z'
示例#16
0
def test_should_only_decrypt_alphabetic_chars():
    assert decrypt('A b 1123 ojdp', 1) == 'Z a 1123 nico'
示例#17
0
def test_ef_should_be_decrypted_to_xy_when_key_7():
    assert decrypt('ef', 7) == 'xy'
示例#18
0
def test_decrypt_should_raise_exception_when_key_is_greater_than_25():
    key = random.randint(26, 100)
    with raises(ValueError) as exception:
        decrypt('a', key)
    assert str(
        exception.value) == 'Please use a valid integer key between 1 and 25.'
示例#19
0
def test_A_should_be_decrypted_to_Z_when_key_1():
    assert decrypt('A', 1) == 'Z'
示例#20
0
def test_decrypt_should_raise_exception_when_key_is_not_int():
    key = 'decrypt'
    with raises(ValueError) as exception:
        decrypt('a', key)
    assert str(exception.value) == 'Please use a valid integer key between 1 and 25.'
示例#21
0
def test_decrypt_should_raise_exception_when_key_is_greater_than_25():
    key = random.randint(26, 100)
    with raises(ValueError) as exception:
        decrypt('a', key)
    assert str(exception.value) == 'Please use a valid integer key between 1 and 25.'
示例#22
0
def test_decrypt_should_raise_exception_when_key_is_not_int():
    key = 'decrypt'
    with raises(ValueError) as exception:
        decrypt('a', key)
    assert str(
        exception.value) == 'Please use a valid integer key between 1 and 25.'