Beispiel #1
0
 def test_simple_without_invalidation(self):
     find_command=FindOrCreateSecrets()
     find_command.execute()
     RenewSecrets().execute()
     find_after_renew=FindOrCreateSecrets()
     find_after_renew.execute()
     self.assertEqual(2,len(find_after_renew.result))
     self.assertEqual(find_command.result[0],find_after_renew.result[1])
     RenewSecrets().execute()
     find_after_renew2=FindOrCreateSecrets()
     find_after_renew2.execute()
     self.assertEqual(2,len(find_after_renew2.result))
     self.assertEqual(find_after_renew.result[0],find_after_renew2.result[1])
     self.assertNotEqual(find_after_renew.result[1],find_after_renew2.result[0])
Beispiel #2
0
    def test_find_or_create(self):
        # Secret creation
        command = FindOrCreateSecrets()
        command.execute()
        sign_secrets = SignSecret.query().order(-SignSecret.creation).fetch()
        self.assertEqual(1, len(sign_secrets))

        # Last secret reuse

        command2 = FindOrCreateSecrets()
        command2.execute()
        sign_secrets = SignSecret.query().order(-SignSecret.creation).fetch()
        self.assertEqual(1, len(sign_secrets))
        self.assertIsNotNone(command.result)
        self.assertEqual(command.result, command2.result)
Beispiel #3
0
    def test_find_or_create(self):
        # Secret creation
        command=FindOrCreateSecrets()
        command.execute()
        sign_secrets= SignSecret.query().order(-SignSecret.creation).fetch()
        self.assertEqual(1,len(sign_secrets))

        # Last secret reuse

        command2=FindOrCreateSecrets()
        command2.execute()
        sign_secrets= SignSecret.query().order(-SignSecret.creation).fetch()
        self.assertEqual(1,len(sign_secrets))
        self.assertIsNotNone(command.result)
        self.assertEqual(command.result,command2.result)
Beispiel #4
0
 def __init__(self, name, signed, max_age):
     self.max_age = max_age
     self.name = name
     self.signed = signed
     self._find_secret = FindOrCreateSecrets()
     super(RetrieveDct, self).__init__([self._find_secret])
Beispiel #5
0
 def __init__(self, name, dct, **kwargs):
     self.name = name
     self.dct = dct
     self._find_secret = FindOrCreateSecrets()
     super(SignDct, self).__init__([self._find_secret], **kwargs)
Beispiel #6
0
 def test_simple_with_invalidation(self):
     find_command = FindOrCreateSecrets()
     find_command.execute()
     RevokeSecrets().execute()
     find_after_revoke = FindOrCreateSecrets()
     find_after_revoke.execute()
     self.assertEqual(2, len(find_after_revoke.result))
     self.assertNotEqual(find_command.result[0],
                         find_after_revoke.result[1])
     RevokeSecrets().execute()
     find_after_revoke2 = FindOrCreateSecrets()
     find_after_revoke2.execute()
     self.assertEqual(2, len(find_after_revoke2.result))
     self.assertNotEqual(find_after_revoke.result[1],
                         find_after_revoke2.result[0])
     self.assertNotEqual(find_after_revoke.result[0],
                         find_after_revoke2.result[0])
     self.assertNotEqual(find_after_revoke.result[0],
                         find_after_revoke2.result[1])
     self.assertNotEqual(find_after_revoke.result[1],
                         find_after_revoke2.result[1])