mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-19 04:47:54 +00:00
Send notification when snasphot is restored
Ref https://github.com/GNS3/gns3-gui/issues/1417
This commit is contained in:
parent
0226bb663f
commit
39db35c3ff
@ -142,6 +142,12 @@ Project has been closed.
|
|||||||
.. literalinclude:: api/notifications/project.closed.json
|
.. literalinclude:: api/notifications/project.closed.json
|
||||||
|
|
||||||
|
|
||||||
|
snapshot.restored
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Snapshot has been restored
|
||||||
|
|
||||||
|
.. literalinclude:: api/notifications/project.snapshot_restored.json
|
||||||
|
|
||||||
log.error
|
log.error
|
||||||
---------
|
---------
|
||||||
|
@ -79,6 +79,7 @@ class Snapshot:
|
|||||||
yield from self._project.delete_on_computes()
|
yield from self._project.delete_on_computes()
|
||||||
# We don't send close notif to clients because the close / open dance is purely internal
|
# We don't send close notif to clients because the close / open dance is purely internal
|
||||||
yield from self._project.close(ignore_notification=True)
|
yield from self._project.close(ignore_notification=True)
|
||||||
|
self._project.controller.notification.emit("snapshot.restored", self.__json__())
|
||||||
shutil.rmtree(os.path.join(self._project.path, "project-files"))
|
shutil.rmtree(os.path.join(self._project.path, "project-files"))
|
||||||
with open(self._path, "rb") as f:
|
with open(self._path, "rb") as f:
|
||||||
project = yield from import_project(self._project.controller, self._project.id, f, location=self._project.path)
|
project = yield from import_project(self._project.controller, self._project.id, f, location=self._project.path)
|
||||||
|
@ -94,6 +94,7 @@ def test_restore(project, controller, async_run):
|
|||||||
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
|
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
|
||||||
async_run(snapshot.restore())
|
async_run(snapshot.restore())
|
||||||
|
|
||||||
|
assert "snapshot.restored" in [c[0][0] for c in controller.notification.emit.call_args_list]
|
||||||
# project.closed notification should not be send when restoring snapshots
|
# project.closed notification should not be send when restoring snapshots
|
||||||
assert "project.closed" not in [c[0][0] for c in controller.notification.emit.call_args_list]
|
assert "project.closed" not in [c[0][0] for c in controller.notification.emit.call_args_list]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user