def tearDown(self) -> None: shutil.rmtree(self.tmpdir) delete_location(self.client, self.location_2) delete_location(self.client, self.location_1) delete_location(self.client, self.location_with_ext_id) delete_location(self.client, self.location_child_1) delete_location(self.client, self.location_child_2) for location_type in self.location_types_created: delete_location_type_with_locations(self.client, location_type)
def test_delete_location_documents(self) -> None: with tempfile.NamedTemporaryFile() as fp: fp.write(b"DATA") add_location_image(self.client, fp.name, self.location_1) with self.assertRaises(LocationCannotBeDeletedWithDependency): delete_location(self.client, self.location_1) docs = get_location_documents(self.client, self.location_1) self.assertEqual(len(docs), 1) for doc in docs: delete_document(self.client, doc)