def test_delete_object(self): # delete an object at a key obj = self.objs["embedded"] get(obj["path"] + "/a1").status(200) delete(obj["path"] + "/a1").status(200) get(obj["path"] + "/a1").status(404) get(obj["path"] + "/a2").status(200) # delete an object in an array obj = self.objs["complex"] _id = obj["response"].body["sections"][0]["_id"] _id2 = obj["response"].body["sections"][1]["_id"] get(obj["path"] + "/sections/" + _id).status(200) delete(obj["path"] + "/sections/" + _id).status(200) get(obj["path"] + "/sections/" + _id).status(404) get(obj["path"] + "/sections/" + _id2).status(200)
def tearDown(self): for obj in self.objs: try: delete(obj["path"]) except: pass
def test_delete_value(self): obj = self.objs["simple"] get(obj["path"] + "/name").status(200) delete(obj["path"] + "/name").status(200) get(obj["path"] + "/name").status(404) get(obj["path"] + "/nums").status(200)
def test_delete_array(self): obj = self.objs["complex"] get(obj["path"] + "/sections").status(200) delete(obj["path"] + "/sections").status(200) get(obj["path"] + "/sections").status(404)
def test_delete_document(self): obj = self.objs["embedded"] get(obj["path"]).status(200) delete(obj["path"]).status(200) get(obj["path"]).status(404)
def test_delete_collection(self): delete("/test").status(405)