Example #1
0
def test_a_should_be_decrypted_to_z_when_key_1():
    assert decrypt('a', 1) == 'z'
Example #2
0
def test_b_should_be_decrypted_to_a_when_key_1():
    assert decrypt('b', 1) == 'a'
Example #3
0
def test_bc_should_be_decrypted_to_ab_when_key_1():
    assert decrypt('bc', 1) == 'ab'
Example #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
Example #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
Example #6
0
def test_B_should_be_decrypted_to_A_when_key_1():
    assert decrypt('B', 1) == 'A'
Example #7
0
def test_should_only_decrypt_alphabetic_chars():
    assert decrypt('A b 1123 ojdp', 1) == 'Z a 1123 nico'
Example #8
0
def test_B_should_be_decrypted_to_A_when_key_1():
    assert decrypt('B', 1) == 'A'
Example #9
0
def test_A_should_be_decrypted_to_Z_when_key_1():
    assert decrypt('A', 1) == 'Z'
Example #10
0
def test_b_should_be_decrypted_to_z_when_key_2():
    assert decrypt('b', 2) == 'z'
Example #11
0
def test_ef_should_be_decrypted_to_xy_when_key_7():
    assert decrypt('ef', 7) == 'xy'
Example #12
0
def test_a_should_be_decrypted_to_z_when_key_1():
    assert decrypt('a', 1) == 'z'
Example #13
0
def test_bc_should_be_decrypted_to_ab_when_key_1():
    assert decrypt('bc', 1) == 'ab'
Example #14
0
def test_b_should_be_decrypted_to_a_when_key_1():
    assert decrypt('b', 1) == 'a'
Example #15
0
def test_b_should_be_decrypted_to_z_when_key_2():
    assert decrypt('b', 2) == 'z'
Example #16
0
def test_should_only_decrypt_alphabetic_chars():
    assert decrypt('A b 1123 ojdp', 1) == 'Z a 1123 nico'
Example #17
0
def test_ef_should_be_decrypted_to_xy_when_key_7():
    assert decrypt('ef', 7) == 'xy'
Example #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.'
Example #19
0
def test_A_should_be_decrypted_to_Z_when_key_1():
    assert decrypt('A', 1) == 'Z'
Example #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.'
Example #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.'
Example #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.'