Exemplo n.º 1
0
def result_page():
    """Returns result page with encoded or decoded
    message"""
    keyword = request.form['keyword']
    choice = request.form['choice']
    message = request.form['message']
    cipher = VigenereCipher(keyword)
    if choice == 'encode':
        result = cipher.encode(message)
    else:
        result = cipher.decode(message)
    if result is None:
        return render_template('exception.html')
    return render_template('result.html', result=result)
Exemplo n.º 2
0
 def test_encode_2(self):
     cipher = VigenereCipher("LeaRNinG")
     encoded = cipher.encode("LeaRNINGpyThON")
     assert encoded == "WIAIAQAMACTYBV"
Exemplo n.º 3
0
 def test_encode(self):
     cipher = VigenereCipher("TRAIN")
     encoded = cipher.encode("ENCODEDINPYTHON")
     self.assertEqual(encoded, "XECWQXUIVCRKHWA")
def test_encode():
    cipher = VigenereCipher('TRAIN')
    encoded = cipher.encode('ENCODEDINPYTHON')
    assert encoded == 'XECWQXUIVCRKHWA'
def test_encode_character():
    cipher = VigenereCipher('TRAIN')
    encoded = cipher.encode('E')
    assert encoded == 'X'
Exemplo n.º 6
0
 def test_encode_lowercase(self):
     cipher = VigenereCipher("TRain")
     encoded = cipher.encode("encoded in Python")
     self.assertTrue(encoded == "XECWQXUIVCRKHWA")
def test_encode_lowercase():
	cipher = VigenereCipher("TRain")
	encoded = cipher.encode("encoded in Python")
	assert encoded == "XECWQXUIVCRKHWA"
Exemplo n.º 8
0
def test_encode_lowercase(valid_cipher):
    cipher = VigenereCipher("TRain")
    assert cipher.encode("encoded in Python") == "XECWQXUIVCRKHWA"
Exemplo n.º 9
0
 def test_encode_character():
     cipher = VigenereCipher("TRAIN")
     encoded = cipher.encode("E")
     assert encoded == "X"
def test_encode_lowercase():
    chip = VigenereCipher("TRAIN")
    encoded = chip.encode("encoded in python")
    assert "XECWQXUIVCRKHWA" == encoded
def test_encode():
    chip = VigenereCipher("TRAIN")
    encoded = chip.encode("ENCODED IN PYTHON")
    assert "XECWQXUIVCRKHWA" == encoded
def test_encode_character():
    chip = VigenereCipher("TRAIN")
    encoded = chip.encode("E")
    assert "X" == encoded
def test_encode_charecter():
	cipher = VigenereCipher("TRAIN")
	encoded = cipher.encode("E")
	assert encoded == "X"
def test_encode():
	cipher = VigenereCipher("TRAIN")
	encoded = cipher.encode("ENCODEDINPYTHON")
	assert encoded == "XECWQXUIVCRKHWA"
Exemplo n.º 15
0
 def test_encode_character(self):
     cipher = VigenereCipher("TRAIN")
     encoded = cipher.encode("E")
     self.assertTrue(encoded == "X")
Exemplo n.º 16
0
 def test_encode_lowercase():
     cipher = VigenereCipher("TRain")
     encoded = cipher.encode("encoded in Python")
     assert encoded == "XECWQXUIVCRKHWA"
Exemplo n.º 17
0
 def test_encode_spaces(self):
     cipher = VigenereCipher("TRAIN")
     encoded = cipher.encode("ENCODED IN PYTHON")
     self.assertTrue(encoded == "XECWQXUIVCRKHWA")
def test_encode_lowercase():
    cipher = VigenereCipher('TRain')
    encoded = cipher.encode('encoded in Python')
    assert encoded == 'XECWQXUIVCRKHWA'
Exemplo n.º 19
0
 def test_encode_1(self):
     cipher = VigenereCipher("TRAIN")
     encoded = cipher.encode("ENCODEDINPYTHON")
     assert encoded == "XECWQXUIVCRKHWA"
Exemplo n.º 20
0
def test_encode_lowercase(valid_cipher):
    cipher = VigenereCipher("TRain")
    assert cipher.encode("encoded in Python") == "XECWQXUIVCRKHWA"