def test_encryption(self):
     keys = self._setup_keys(b'ENCRYPT')
     # what you put in is what you get out
     for data in [b'data', b'1234567890123456', b'\x00\xFF' * 13
                  ] + [six.int2byte(x % 256) * x for x in range(768)]:
         crypt = memcache_crypt.encrypt_data(keys['ENCRYPTION'], data)
         decrypt = memcache_crypt.decrypt_data(keys['ENCRYPTION'], crypt)
         self.assertEqual(data, decrypt)
         self.assertRaises(memcache_crypt.DecryptError,
                           memcache_crypt.decrypt_data, keys['ENCRYPTION'],
                           crypt[:-1])
 def test_encryption(self):
     keys = self._setup_keys(b'ENCRYPT')
     # what you put in is what you get out
     for data in [b'data', b'1234567890123456', b'\x00\xFF' * 13
                  ] + [six.int2byte(x % 256) * x for x in range(768)]:
         crypt = memcache_crypt.encrypt_data(keys['ENCRYPTION'], data)
         decrypt = memcache_crypt.decrypt_data(keys['ENCRYPTION'], crypt)
         self.assertEqual(data, decrypt)
         self.assertRaises(memcache_crypt.DecryptError,
                           memcache_crypt.decrypt_data,
                           keys['ENCRYPTION'], crypt[:-1])