def test_key_not_found(self):
        other_key = Crypter.generate_key_string()
        other_crypter = Crypter(other_key)
        encryptedText = self.crypter.encrypt(TEXT)
        encryptedTextOther = other_crypter.encrypt(TEXT)
        self.assertEqual(self.crypter.decrypt(encryptedText), TEXT)
        self.assertEqual(other_crypter.decrypt(encryptedTextOther), TEXT)

        self.assertRaises(errors.KeyNotFoundError, self.crypter.decrypt, encryptedTextOther)
Ejemplo n.º 2
0
    def test_key_not_found(self):
        other_key = Crypter.generate_key_string()
        other_crypter = Crypter(other_key)
        encryptedText = self.crypter.encrypt(TEXT)
        encryptedTextOther = other_crypter.encrypt(TEXT)
        self.assertEqual(self.crypter.decrypt(encryptedText), TEXT)
        self.assertEqual(other_crypter.decrypt(encryptedTextOther), TEXT)

        self.assertRaises(errors.KeyNotFoundError, self.crypter.decrypt,
                          encryptedTextOther)
class CrypterUnitTests(TestCase):
    def setUp(self):
        self.key = Crypter.generate_key_string()
        self.crypter = Crypter(self.key)

    def tearDown(self):
        pass

    def test_crypting(self):
        encryptedText = self.crypter.encrypt(TEXT)
        decryptedText = self.crypter.decrypt(encryptedText)
        self.assertEqual(decryptedText, TEXT)
        self.assertNotEqual(encryptedText, TEXT)

    def test_key_not_found(self):
        other_key = Crypter.generate_key_string()
        other_crypter = Crypter(other_key)
        encryptedText = self.crypter.encrypt(TEXT)
        encryptedTextOther = other_crypter.encrypt(TEXT)
        self.assertEqual(self.crypter.decrypt(encryptedText), TEXT)
        self.assertEqual(other_crypter.decrypt(encryptedTextOther), TEXT)

        self.assertRaises(errors.KeyNotFoundError, self.crypter.decrypt, encryptedTextOther)
Ejemplo n.º 4
0
class CrypterUnitTests(TestCase):
    def setUp(self):
        self.key = Crypter.generate_key_string()
        self.crypter = Crypter(self.key)

    def tearDown(self):
        pass

    def test_crypting(self):
        encryptedText = self.crypter.encrypt(TEXT)
        decryptedText = self.crypter.decrypt(encryptedText)
        self.assertEqual(decryptedText, TEXT)
        self.assertNotEqual(encryptedText, TEXT)

    def test_key_not_found(self):
        other_key = Crypter.generate_key_string()
        other_crypter = Crypter(other_key)
        encryptedText = self.crypter.encrypt(TEXT)
        encryptedTextOther = other_crypter.encrypt(TEXT)
        self.assertEqual(self.crypter.decrypt(encryptedText), TEXT)
        self.assertEqual(other_crypter.decrypt(encryptedTextOther), TEXT)

        self.assertRaises(errors.KeyNotFoundError, self.crypter.decrypt,
                          encryptedTextOther)