mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
4 files changed
+79
-1
No files matched your search
@@ -37,6 +37,7 @@ def test_save(controller, controller_config_path):
|
||||
data = json.load(f)
|
||||
assert data["computes"] == []
|
||||
assert data["version"] == __version__
|
||||
assert data["settings"] == {}
|
||||
|
||||
|
||||
def test_load(controller, controller_config_path, async_run):
|
||||
@@ -53,10 +54,12 @@ def test_load(controller, controller_config_path, async_run):
|
||||
"compute_id": "test1"
|
||||
}
|
||||
]
|
||||
data["settings"] = {"IOU": True}
|
||||
with open(controller_config_path, "w+") as f:
|
||||
json.dump(data, f)
|
||||
async_run(controller.load())
|
||||
assert len(controller.computes) == 1
|
||||
assert controller.settings["IOU"]
|
||||
assert controller.computes["test1"].__json__() == {
|
||||
"compute_id": "test1",
|
||||
"connected": False,
|
||||
@@ -68,6 +71,12 @@ def test_load(controller, controller_config_path, async_run):
|
||||
}
|
||||
|
||||
|
||||
def test_settings(controller):
|
||||
controller._notification = MagicMock()
|
||||
controller.settings = {"a": 1}
|
||||
controller._notification.emit.assert_called_with("settings.updated", {"a": 1})
|
||||
|
||||
|
||||
def test_load_projects(controller, projects_dir, async_run):
|
||||
controller.save()
|
||||
|
||||
@@ -270,4 +279,3 @@ def test_load_project(controller, async_run, tmpdir):
|
||||
with asyncio_patch("gns3server.controller.Controller.add_project") as mock_add_project:
|
||||
project = async_run(controller.load_project(str(tmpdir / "test.gns3")))
|
||||
assert not mock_add_project.called
|
||||
|
||||
Reference in new issue
Block a user