def test_decrypt_invalid_encrypted(self): # "stuff" is not decryptable. encrypted = bin_to_b64(b"stuff") with self.assertRaises(ValueError): decrypt_binary(encrypted, self.key)
def test_encrypt_and_decrypt_long(self): value = b"0" * 1_000_000 self.assertEqual( decrypt_binary(encrypt_binary(value, self.key), self.key), value)
def test_decrypt_invalid_base64(self): encrypted = encrypt_binary(b"stuff", self.key) with self.assertRaises(ValueError): decrypt_binary(encrypted[1:], self.key)
def test_encrypt_and_decrypt(self): self.assertEqual( decrypt_binary(encrypt_binary(b"stuff", self.key), self.key), b"stuff")
def test_encrypt_and_decrypt_empty(self): self.assertEqual( decrypt_binary(encrypt_binary(b"", self.key), self.key), b"")
def test_encrypt_and_decrypt_long(self): self.assertEqual( decrypt_binary(encrypt_binary(b"0" * 1000000, self.key), self.key), b"0" * 1000000)