def delete_type_confirmed(self): # requires CONFIG e = self.create_type("delete_type") u = entitydata_delete_confirm_url(coll_id="testcoll", type_id="_type") f = entitydata_delete_confirm_form_data(entity_id="delete_type") r = self.client.post(u, f) return r
def delete_user_confirmed(self): # requires ADMIN e = self.create_user("delete_user") u = entitydata_delete_confirm_url(coll_id="testcoll", type_id="_user") f = annalistuser_delete_confirm_form_data(user_id="delete_user") r = self.client.post(u, f) return r
def delete_data_confirmed(self): # requires DELETE e = self.create_data("delete_entity") u = entitydata_delete_confirm_url(coll_id="testcoll", type_id="Default_type") f = entitydata_delete_confirm_form_data(entity_id="delete_entity") r = self.client.post(u, f) return r
def test_post_confirmed_remove_entity_from_search(self): t = EntityData.create(self.testdata, "deleteentity", entitydata_create_values("deleteentity")) self.assertTrue(EntityData.exists(self.testdata, "deleteentity")) # Submit positive confirmation u = entitydata_delete_confirm_url("testcoll", "testtype") f = entitydata_delete_confirm_form_data("deleteentity", search="testcoll") r = self.client.post(u, f) self.assertEqual(r.status_code, 302) self.assertEqual(r.reason_phrase, "FOUND") self.assertEqual(r.content, "") self.assertMatch(r['location'], "^"+TestHostUri+ entitydata_list_all_url("testcoll") ) self.assertMatch(r['location'], r"info_head=.*&info_message=.*deleteentity.*testcoll.*$" ) self.assertIn("search=testcoll", r['location']) # Confirm deletion self.assertFalse(EntityData.exists(self.testcoll, "deleteentity")) return
def test_post_confirmed_remove_entity_from_search(self): t = EntityData.create(self.testdata, "deleteentity", entitydata_create_values("deleteentity")) self.assertTrue(EntityData.exists(self.testdata, "deleteentity")) # Submit positive confirmation u = entitydata_delete_confirm_url("testcoll", "testtype") f = entitydata_delete_confirm_form_data("deleteentity", search="testcoll") r = self.client.post(u, f) self.assertEqual(r.status_code, 302) self.assertEqual(r.reason_phrase, "FOUND") self.assertEqual(r.content, "") self.assertMatch(r['location'], "^"+TestHostUri+ entitydata_list_all_url("testcoll") ) self.assertMatch(r['location'], r"info_head=.*$" ) self.assertMatch(r['location'], r"info_message=.*deleteentity.*testcoll.*$" ) self.assertIn("search=testcoll", r['location']) # Confirm deletion self.assertFalse(EntityData.exists(self.testcoll, "deleteentity")) return