Beispiel #1
0
 def testKeyczarCrypterEncryptDecryptHandlesEmptyNone(self):
     location = 'castle://aargh'
     kz_crypter = keyczar.Crypter(location)
     self.assertEqual('', kz_crypter.encrypt(''))
     self.assertEqual('', kz_crypter.encrypt(None))
     self.assertEqual('', kz_crypter.decrypt(''))
     self.assertEqual('', kz_crypter.decrypt(None))
Beispiel #2
0
 def testKeyczarCrypterWithUnencryptedReader(self):
     """"""
     location = 'bar://baz'
     kz_crypter = keyczar.Crypter(location)
     self.assertEqual(location, kz_crypter.keyset_location)
     self.assertIsNone(kz_crypter.encrypting_keyset_location)
     self.assertIsInstance(kz_crypter.crypter, mocks.MockKeyczarCrypter)
     self.assertIsInstance(kz_crypter.crypter.reader,
                           mocks.MockKeyczarReader)
     self.assertEqual(location, kz_crypter.crypter.reader.location)
Beispiel #3
0
 def testKeyczarCrypterWithEncryptedReader(self):
     """"""
     location = 'foo://baz'
     encrypting_location = 'castle://aaargh'
     kz_crypter = keyczar.Crypter(location, encrypting_location)
     self.assertEqual(location, kz_crypter.keyset_location)
     self.assertEqual(encrypting_location,
                      kz_crypter.encrypting_keyset_location)
     self.assertIsInstance(kz_crypter.crypter, mocks.MockKeyczarCrypter)
     self.assertIsInstance(kz_crypter.crypter.reader,
                           mocks.MockKeyczarEncryptedReader)
     self.assertEqual(location, kz_crypter.crypter.reader._reader.location)
     self.assertEqual(encrypting_location,
                      kz_crypter.crypter.reader._crypter.reader.location)