def test_should_only_encrypt_alphabetic_chars(): assert encrypt('Z a 1123 nico', 1) == 'A b 1123 ojdp'
def test_A_should_be_encrypted_to_B_when_key_1(): assert encrypt('A', 1) == 'B'
def test_Z_should_be_encrypted_to_A_when_key_1(): assert encrypt('Z', 1) == 'A'
def test_ab_should_be_encrypted_to_bc_when_the_key_1(): assert encrypt('ab', 1) == 'bc'
def test_z_should_be_encrypted_to_a_when_key_1(): assert encrypt('z', 1) == 'a'
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
def test_a_should_be_encrypted_to_b_when_key_1(): assert encrypt('a', 1) == 'b'
def test_encrypt_should_raise_exception_when_key_is_greater_than_25(): key = random.randint(26, 100) with raises(ValueError) as exception: encrypt('a', key) assert str( exception.value) == 'Please use a valid integer key between 1 and 25.'
def test_encrypt_should_raise_exception_when_key_is_greater_than_25(): key = random.randint(26, 100) with raises(ValueError) as exception: encrypt('a', key) assert str(exception.value) == 'Please use a valid integer key between 1 and 25.'
def test_encrypt_should_raise_exception_when_key_is_not_int(): key = 'encrypt' with raises(ValueError) as exception: encrypt('a', key) assert str(exception.value) == 'Please use a valid integer key between 1 and 25.'
def test_encrypt_should_raise_exception_when_key_is_not_int(): key = 'encrypt' with raises(ValueError) as exception: encrypt('a', key) assert str( exception.value) == 'Please use a valid integer key between 1 and 25.'