def test_delete_link_for_sanity(self): ''' Test deletion... ''' workflow.create_entity('/foo/src', self.src_entity, self.registry) workflow.delete_entity(self.link1, self.registry) self.assertFalse(self.link1 in self.src_entity.links) self.assertFalse(self.link1 in self.registry.get_resources())
def test_delete_resource_for_sanity(self): ''' Test deletion... ''' workflow.create_entity('/foo/src', self.src_entity, self.registry) workflow.delete_entity(self.src_entity, self.registry) # ensure that both the resource and it's links are removed... self.assertFalse(self.src_entity in self.registry.get_resources()) self.assertFalse(self.link1 in self.registry.get_resources())
def delete(self, key): # delete try: entity = self.registry.get_resource(key) workflow.delete_entity(entity, self.registry) self.response(200, self.registry.get_default_type(), None) except AttributeError as attr: raise HTTPError(400, str(attr)) except KeyError as key: raise HTTPError(404, str(key))
def delete(self, key): if key == '' or key[-1] != '/': key += '/' if len(self.parse_entities()) == 0: # delete entities entities = workflow.get_entities_under_path(key, self.registry) for entity in entities: workflow.delete_entity(entity, self.registry) self.response(200, self.registry.get_default_type(), None) elif len(self.parse_entities()) > 0: # remove from collection try: mixin = self.registry.get_category(key) entities = self.parse_entities() workflow.delete_from_collection(mixin, entities, self.registry) self.response(200, self.registry.get_default_type(), None) except AttributeError as attr: raise HTTPError(400, str(attr))