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