def test_delete(self): hostname = "cds1.example.com" cluster_id = "unit_test_cluster" c = self.cds_manager.create(hostname=hostname, cluster_id=cluster_id) from pulp_cds.api.models.cds import CDS found = CDS.objects(hostname=hostname) self.assertEquals(found[0], c) self.cds_manager.delete(hostname) found = CDS.objects(hostname=hostname) self.assertEquals(len(found), 0)
def update(self, hostname, **params): c = self.get(hostname) if not c: raise MissingResource("No CDS with hostname: '%s'" % hostname) for k in params.keys(): c[k] = params[k] c.save() cdses = CDS.objects(hostname=hostname) return cdses[0]
def get_all(self): return CDS.objects()
def get(self, hostname): c = CDS.objects(hostname=hostname) if len(c) < 1: return None return c[0]