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

Add a modification uuid to settings returned by the server

Ref #1949
This commit is contained in:
Julien Duponchelle 2017-03-21 13:35:02 +01:00
parent 73c31b4b87
commit cc6f4c0510
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 6 additions and 2 deletions

View File

@ -18,6 +18,7 @@
import os import os
import sys import sys
import json import json
import uuid
import socket import socket
import asyncio import asyncio
import aiohttp import aiohttp
@ -253,6 +254,7 @@ class Controller:
@settings.setter @settings.setter
def settings(self, val): def settings(self, val):
self._settings = val self._settings = val
self._settings["modification_uuid"] = str(uuid.uuid4()) # We add a modification id to the settings it's help the gui to detect changes
self.save() self.save()
self.notification.emit("settings.updated", val) self.notification.emit("settings.updated", val)

View File

@ -195,7 +195,8 @@ def test_import_remote_gns3vm_1_x(controller, controller_config_path, async_run)
def test_settings(controller): def test_settings(controller):
controller._notification = MagicMock() controller._notification = MagicMock()
controller.settings = {"a": 1} controller.settings = {"a": 1}
controller._notification.emit.assert_called_with("settings.updated", {"a": 1}) controller._notification.emit.assert_called_with("settings.updated", controller.settings)
assert controller.settings["modification_uuid"] is not None
def test_load_projects(controller, projects_dir, async_run): def test_load_projects(controller, projects_dir, async_run):

View File

@ -29,4 +29,5 @@ def test_settings(http_controller):
assert response.status == 201 assert response.status == 201
response = http_controller.get('/settings', example=True) response = http_controller.get('/settings', example=True)
assert response.status == 200 assert response.status == 200
assert response.json == query assert response.json["test"] is True
assert response.json["modification_uuid"] is not None