mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Remove generic controller settings API endpoint.
This commit is contained in:
1 parent
cebb56387a
commit
98f04365b7
15 files changed
+120
-118
No files matched your search
+1
-1
@@ -201,7 +201,7 @@ def controller(tmpdir, controller_config_path):
|
||||
Controller._instance = None
|
||||
controller = Controller.instance()
|
||||
controller._config_file = controller_config_path
|
||||
controller._settings = {}
|
||||
controller._config_loaded = True
|
||||
return controller
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ def test_save(controller, controller_config_path):
|
||||
data = json.load(f)
|
||||
assert data["computes"] == []
|
||||
assert data["version"] == __version__
|
||||
assert data["settings"] == {}
|
||||
assert data["iou_license"] == controller.iou_license
|
||||
assert data["gns3vm"] == controller.gns3vm.__json__()
|
||||
|
||||
|
||||
@@ -53,12 +53,10 @@ def test_load_controller_settings(controller, controller_config_path, async_run)
|
||||
"compute_id": "test1"
|
||||
}
|
||||
]
|
||||
data["settings"] = {"IOU": {"test": True}}
|
||||
data["gns3vm"] = {"vmname": "Test VM"}
|
||||
with open(controller_config_path, "w+") as f:
|
||||
json.dump(data, f)
|
||||
assert len(async_run(controller._load_controller_settings())) == 1
|
||||
assert controller.settings["IOU"]
|
||||
assert controller.gns3vm.settings["vmname"] == "Test VM"
|
||||
|
||||
|
||||
@@ -199,13 +197,6 @@ def test_import_remote_gns3vm_1_x(controller, controller_config_path, async_run)
|
||||
assert controller.gns3vm.settings["vmname"] == "http://127.0.0.1:3081"
|
||||
|
||||
|
||||
def test_settings(controller):
|
||||
controller._notification = MagicMock()
|
||||
controller.settings = {"a": 1}
|
||||
controller._notification.controller_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):
|
||||
controller.save()
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ def test_symbol(node, symbols_dir):
|
||||
assert node.height == 71
|
||||
assert node.label["x"] is None
|
||||
assert node.label["y"] == -40
|
||||
assert node.label["style"] == "font-size: 10;font-familly: Verdana"
|
||||
assert node.label["style"] == None#"font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;"
|
||||
|
||||
shutil.copy(os.path.join("gns3server", "symbols", "cloud.svg"), os.path.join(symbols_dir, "cloud2.svg"))
|
||||
node.symbol = "cloud2.svg"
|
||||
@@ -298,7 +298,7 @@ def test_label_with_default_label_font(node):
|
||||
|
||||
node._label = None
|
||||
node.symbol = ":/symbols/dslam.svg"
|
||||
assert node.label["style"] == "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #ff0000;fill-opacity: 1.0;"
|
||||
assert node.label["style"] == None #"font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #ff0000;fill-opacity: 1.0;"
|
||||
|
||||
|
||||
def test_update(node, compute, project, async_run, controller):
|
||||
@@ -405,9 +405,9 @@ def test_start_iou(compute, project, async_run, controller):
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
async_run(node.start())
|
||||
|
||||
controller.settings["IOU"] = {"iourc_content": "aa"}
|
||||
controller._iou_license_settings = {"license_check": True, "iourc_content": "aa"}
|
||||
async_run(node.start())
|
||||
compute.post.assert_called_with("/projects/{}/iou/nodes/{}/start".format(node.project.id, node.id), timeout=240, data={"iourc_content": "aa"})
|
||||
compute.post.assert_called_with("/projects/{}/iou/nodes/{}/start".format(node.project.id, node.id), timeout=240, data={"license_check": True, "iourc_content": "aa"})
|
||||
|
||||
|
||||
def test_stop(node, compute, project, async_run):
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
This test suite check /version endpoint
|
||||
It's also used for unittest the HTTP implementation.
|
||||
"""
|
||||
|
||||
from gns3server.config import Config
|
||||
|
||||
|
||||
def test_settings(http_controller):
|
||||
query = {"test": True}
|
||||
response = http_controller.post('/settings', query, example=True)
|
||||
assert response.status == 201
|
||||
response = http_controller.get('/settings', example=True)
|
||||
assert response.status == 200
|
||||
assert response.json["test"] is True
|
||||
assert response.json["modification_uuid"] is not None
|
||||
Reference in new issue
Block a user