Merge 2.1 into 2.2 branch

This commit is contained in:
grossmj committed 2018-03-12 13:38:50 +07:00
1 parent 2a5f3221b9
commit 658aa4bae9
69 files changed
+846 -448

No files matched your search

+49 -1
View File
@@ -510,7 +510,9 @@ def test_load_appliances(controller):
"Qemu": {
"vms": [
{
"name": "Test"
"name": "Test",
"node_type": "qemu",
"category": "router"
}
]
}
@@ -538,6 +540,52 @@ def test_load_appliances(controller):
assert cloud_uuid == appliance.id
def test_load_appliances_deprecated_features_default_symbol(controller):
controller._settings = {
"Qemu": {
"vms": [
{
"name": "Test",
"node_type": "qemu",
"category": "router",
"default_symbol": ":/symbols/iosv_virl.normal.svg",
"hover_symbol": ":/symbols/iosv_virl.selected.svg",
}
]
}
}
controller.load_appliances()
appliances = dict([(a.name, a) for a in controller.appliances.values()])
assert appliances["Test"].__json__()["symbol"] == ":/symbols/computer.svg"
assert "default_symbol" not in appliances["Test"].data.keys()
assert "hover_symbol" not in appliances["Test"].data.keys()
def test_load_appliances_deprecated_features_default_symbol_with_symbol(controller):
controller._settings = {
"Qemu": {
"vms": [
{
"name": "Test",
"node_type": "qemu",
"category": "router",
"default_symbol": ":/symbols/iosv_virl.normal.svg",
"hover_symbol": ":/symbols/iosv_virl.selected.svg",
"symbol": ":/symbols/my-symbol.svg"
}
]
}
}
controller.load_appliances()
appliances = dict([(a.name, a) for a in controller.appliances.values()])
assert appliances["Test"].__json__()["symbol"] == ":/symbols/my-symbol.svg"
assert "default_symbol" not in appliances["Test"].data.keys()
assert "hover_symbol" not in appliances["Test"].data.keys()
def test_autoidlepc(controller, async_run):
controller._computes["local"] = AsyncioMagicMock()
node_mock = AsyncioMagicMock()
+2 -2
View File
@@ -517,8 +517,8 @@ def test_get_port(node):
assert port.port_number == 0
port = node.get_port(1, 0)
assert port.adapter_number == 1
with pytest.raises(aiohttp.web.HTTPNotFound):
port = node.get_port(42, 0)
port = node.get_port(42, 0)
assert port is None
def test_parse_node_response(node, async_run):
-21
View File
@@ -646,27 +646,6 @@ def test_node_name(project, async_run):
assert node.name == "R3"
def test_add_iou_node_and_check_if_gets_application_id(project, async_run):
compute = MagicMock()
compute.id = "local"
response = MagicMock()
response.json = {"console": 2048}
compute.post = AsyncioMagicMock(return_value=response)
# tests if get_next_application_id is called
with patch('gns3server.controller.project.get_next_application_id', return_value=222) as mocked_get_app_id:
node = async_run(project.add_node(
compute, "test", None, node_type="iou", properties={"startup_config": "test.cfg"}))
assert mocked_get_app_id.called
assert node.properties['application_id'] == 222
# tests if we can send property and it will be used
node = async_run(project.add_node(
compute, "test", None, node_type="iou", application_id=333, properties={"startup_config": "test.cfg"}))
assert mocked_get_app_id.called
assert node.properties['application_id'] == 333
def test_duplicate_node(project, async_run):
compute = MagicMock()
compute.id = "local"