1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Add a test

This commit is contained in:
Julien Duponchelle 2016-05-26 13:43:35 +02:00
parent fbc04e083b
commit df654b40ff
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 8 additions and 0 deletions

View File

@ -202,6 +202,7 @@ class Project:
@asyncio.coroutine @asyncio.coroutine
def delete(self): def delete(self):
yield from self.close()
for compute in self._project_created_on_compute: for compute in self._project_created_on_compute:
yield from compute.delete("/projects/{}".format(self._id)) yield from compute.delete("/projects/{}".format(self._id))
shutil.rmtree(self.path, ignore_errors=True) shutil.rmtree(self.path, ignore_errors=True)

View File

@ -218,3 +218,10 @@ def test_deleteLink(async_run, project, controller):
async_run(project.delete_link(link.id)) async_run(project.delete_link(link.id))
controller.notification.emit.assert_any_call("link.deleted", link.__json__()) controller.notification.emit.assert_any_call("link.deleted", link.__json__())
assert len(project._links) == 0 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)