diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index ab36ee67..ee1e3d65 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -202,6 +202,7 @@ class Project: @asyncio.coroutine def delete(self): + yield from self.close() for compute in self._project_created_on_compute: yield from compute.delete("/projects/{}".format(self._id)) shutil.rmtree(self.path, ignore_errors=True) diff --git a/tests/controller/test_project.py b/tests/controller/test_project.py index 14fa4d7d..cca26ae8 100644 --- a/tests/controller/test_project.py +++ b/tests/controller/test_project.py @@ -218,3 +218,10 @@ def test_deleteLink(async_run, project, controller): async_run(project.delete_link(link.id)) controller.notification.emit.assert_any_call("link.deleted", link.__json__()) assert len(project._links) == 0 + + +def test_delete(async_run, project, controller): + assert os.path.exists(project.path) + async_run(project.delete()) + assert not os.path.exists(project.path) +