def testMetadata(self): """Should be able to add/remove/has metadata""" c = CatalogType("name") p = Metadata("key", "type", "value") self.assertFalse(c.hasMetadata(p)) c.addMetadata(p) self.assertRaises(DuplicateError, c.addMetadata, p) self.assertTrue(c.hasMetadata(p)) c.removeMetadata(p) self.assertFalse(c.hasMetadata(p)) self.assertRaises(NotFoundError, c.removeMetadata, p) c.addMetadata(p) c.clearMetadata() self.assertFalse(c.hasMetadata(p))
def testPFN(self): "Should be able to add/remove/has PFNs" c = CatalogType("name") p = PFN("url", "site") self.assertFalse(c.hasPFN(p)) c.addPFN(p) self.assertRaises(DuplicateError, c.addPFN, p) self.assertTrue(c.hasPFN(p)) c.removePFN(p) self.assertFalse(c.hasPFN(p)) self.assertRaises(NotFoundError, c.removePFN, p) c.addPFN(p) c.clearPFNs() self.assertFalse(c.hasPFN(p))
def testProfile(self): """Should be able to add/remove/has profiles""" c = CatalogType("name") p = Profile("ns", "name", "value") self.assertFalse(c.hasProfile(p)) c.addProfile(p) self.assertRaises(DuplicateError, c.addProfile, p) self.assertTrue(c.hasProfile(p)) c.removeProfile(p) self.assertFalse(c.hasProfile(p)) self.assertRaises(NotFoundError, c.removeProfile, p) c.addProfile(p) c.clearProfiles() self.assertFalse(c.hasProfile(p))