示例#1
0
 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''))
示例#2
0
 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)
示例#3
0
 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.decrypt(None, key)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 def test_key_type(self):
     """
     The method checks the type of encryption key
     """
     key = crypto_wrapper.generate_key()
     self.assertEquals(type(key), type(b''))
示例#7
0
 def test_key_is_not_empty(self):
     """
     The method checks the presence of a value in the generated key.
     """
     key = crypto_wrapper.generate_key()
     self.assertTrue(key)