示例#1
0
 def test_credential_add_remove(self):
     cred11 = self._cred_test_obj(1, 1)
     cred = cdb.add_credential(
         cred11.cname, cred11.usr, cred11.pwd, cred11.ctype)
     self._assert_equal(cred, cred11)
     cred_id = cred.credential_id
     cred = cdb.remove_credential(cred_id)
     self._assert_equal(cred, cred11)
     cred = cdb.remove_credential(cred_id)
     self.assertIsNone(cred)
示例#2
0
 def test_credential_add_remove(self):
     cred11 = self._cred_test_obj(1, 1)
     cred = cdb.add_credential(cred11.tenant, cred11.cname, cred11.usr,
                               cred11.pwd)
     self._assert_equal(cred, cred11)
     cred_id = cred.credential_id
     cred = cdb.remove_credential(cred11.tenant, cred_id)
     self._assert_equal(cred, cred11)
     cred = cdb.remove_credential(cred11.tenant, cred_id)
     self.assertIsNone(cred)
示例#3
0
 def test_credential_add_dup(self):
     cred22 = self._cred_test_obj(2, 2)
     cred = cdb.add_credential(
         cred22.cname, cred22.usr, cred22.pwd, cred22.ctype)
     self._assert_equal(cred, cred22)
     cred_id = cred.credential_id
     with testtools.ExpectedException(c_exc.CredentialAlreadyExists):
         cdb.add_credential(
             cred22.cname, cred22.usr, cred22.pwd, cred22.ctype)
     cred = cdb.remove_credential(cred_id)
     self._assert_equal(cred, cred22)
     cred = cdb.remove_credential(cred_id)
     self.assertIsNone(cred)
示例#4
0
 def test_credential_add_dup(self):
     cred22 = self._cred_test_obj(2, 2)
     cred = cdb.add_credential(cred22.tenant, cred22.cname, cred22.usr,
                               cred22.pwd)
     self._assert_equal(cred, cred22)
     cred_id = cred.credential_id
     with testtools.ExpectedException(c_exc.CredentialAlreadyExists):
         cdb.add_credential(cred22.tenant, cred22.cname, cred22.usr,
                            cred22.pwd)
     cred = cdb.remove_credential(cred22.tenant, cred_id)
     self._assert_equal(cred, cred22)
     cred = cdb.remove_credential(cred22.tenant, cred_id)
     self.assertIsNone(cred)
示例#5
0
 def delete_credential(self, tenant_id, credential_id):
     """Delete a credential."""
     LOG.debug(_("delete_credential() called"))
     try:
         credential = cdb.get_credential(tenant_id, credential_id)
     except Exception:
         raise cexc.CredentialNotFound(tenant_id=tenant_id,
                                       credential_id=credential_id)
     credential = cdb.remove_credential(tenant_id, credential_id)
     return credential
示例#6
0
 def delete_credential(cred_name):
     """Delete a credential."""
     cdb.remove_credential(cred_name)
 def delete_credential(cred_name):
     """Delete a credential."""
     cdb.remove_credential(TENANT, cred_name)