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

Send a project closed event when project close

Ref #602
This commit is contained in:
Julien Duponchelle 2016-08-15 12:06:26 +02:00
parent 225e4f7528
commit 16c2305b33
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 12 additions and 0 deletions

View File

@ -126,6 +126,15 @@ Drawing has been deleted.
.. literalinclude:: api/notifications/drawing.deleted.json .. literalinclude:: api/notifications/drawing.deleted.json
project.closed
---------------
Project has been closed.
.. literalinclude:: api/notifications/project.closed.json
log.error log.error
--------- ---------

View File

@ -445,6 +445,7 @@ class Project:
yield from compute.post("/projects/{}/close".format(self._id)) yield from compute.post("/projects/{}/close".format(self._id))
self._cleanPictures() self._cleanPictures()
self._status = "closed" self._status = "closed"
self.controller.notification.emit("project.closed", self.__json__())
def _cleanPictures(self): def _cleanPictures(self):
""" """

View File

@ -332,8 +332,10 @@ def test_open_close(async_run, controller):
assert project.status == "closed" assert project.status == "closed"
async_run(project.open()) async_run(project.open())
assert project.status == "opened" assert project.status == "opened"
controller._notification = MagicMock()
async_run(project.close()) async_run(project.close())
assert project.status == "closed" assert project.status == "closed"
controller.notification.emit.assert_any_call("project.closed", project.__json__())
def test_is_running(project, async_run, node): def test_is_running(project, async_run, node):