def test_invalid_second_parameter(self): """ The method checks the generation of an exception when the second parameter is incorrect. """ with self.assertRaises(ValueError): crypto_wrapper.encrypt(DATA, None)
def test_invalid_first_parameter(self): """ The method checks the generation of an exception when the first parameter is incorrect. """ key = crypto_wrapper.generate_key() with self.assertRaises(ValueError): crypto_wrapper.encrypt(None, key)
def test_encrypted_data_type(self): """ The method checks the type of encrypted data """ key = crypto_wrapper.generate_key() encrypted_data = crypto_wrapper.encrypt(DATA, key) self.assertEquals(type(encrypted_data), type(b''))
def test_encrypt_is_not_empty(self): """ The method checks the presence of encrypted data. """ key = crypto_wrapper.generate_key() encrypted_data = crypto_wrapper.encrypt(DATA, key) self.assertTrue(encrypted_data)
def test_correct_decryption(self): """ The method checks the correctness of the decryption. """ key = crypto_wrapper.generate_key() encrypted_data = crypto_wrapper.encrypt(DATA, key) decrypted_data = crypto_wrapper.decrypt(encrypted_data, key) self.assertEquals(DATA, decrypted_data)
def test_invalid_second_parameter(self): """ The method checks the generation of an exception when the second parameter is incorrect. """ key = crypto_wrapper.generate_key() encrypted_data = crypto_wrapper.encrypt(DATA, key) with self.assertRaises(ValueError): crypto_wrapper.decrypt(encrypted_data, None)