Beispiel #1
0
def test_should_only_encrypt_alphabetic_chars():
    assert encrypt('Z a 1123 nico', 1) == 'A b 1123 ojdp'
Beispiel #2
0
def test_A_should_be_encrypted_to_B_when_key_1():
    assert encrypt('A', 1) == 'B'
Beispiel #3
0
def test_Z_should_be_encrypted_to_A_when_key_1():
    assert encrypt('Z', 1) == 'A'
Beispiel #4
0
def test_ab_should_be_encrypted_to_bc_when_the_key_1():
    assert encrypt('ab', 1) == 'bc'
Beispiel #5
0
def test_z_should_be_encrypted_to_a_when_key_1():
    assert encrypt('z', 1) == 'a'
Beispiel #6
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
Beispiel #7
0
def test_a_should_be_encrypted_to_b_when_key_1():
    assert encrypt('a', 1) == 'b'
Beispiel #8
0
def test_should_only_encrypt_alphabetic_chars():
    assert encrypt('Z a 1123 nico', 1) == 'A b 1123 ojdp'
Beispiel #9
0
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.'
Beispiel #10
0
def test_A_should_be_encrypted_to_B_when_key_1():
    assert encrypt('A', 1) == 'B'
Beispiel #11
0
def test_Z_should_be_encrypted_to_A_when_key_1():
    assert encrypt('Z', 1) == 'A'
Beispiel #12
0
def test_z_should_be_encrypted_to_a_when_key_1():
    assert encrypt('z', 1) == 'a'
Beispiel #13
0
def test_ab_should_be_encrypted_to_bc_when_the_key_1():
    assert encrypt('ab', 1) == 'bc'
Beispiel #14
0
def test_a_should_be_encrypted_to_b_when_key_1():
    assert encrypt('a', 1) == 'b'
Beispiel #15
0
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.'
Beispiel #16
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
Beispiel #17
0
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.'
Beispiel #18
0
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.'