def test_load_1_2(local_server, project, fake_bin): uuid = uuid4() iou_device = IOUDevice(IOU(), local_server, project) nio_node = { "description": "IOU device", "id": 1, "ports": [ { "slot_number": 0, "id": 1, "name": "Hyper Ethernet0/0", "port_number": 0}, ], "properties": { "name": "IOU 1", "path": fake_bin, "initial_config": "/tmp" }, "server_id": 1, "type": "IOUDevice", "vm_id": uuid } with patch("gns3.modules.iou.iou_device.IOUDevice.setup") as mock: iou_device.load(nio_node) assert mock.called (path, name, vm_id, settings), kwargs = mock.call_args assert path == fake_bin assert name == "IOU 1" assert settings == {"initial_config": "/tmp"} assert vm_id == uuid iou_device.updated_signal.emit() assert iou_device._ports[0].name() == "Hyper Ethernet0/0"
def test_load(local_server, project, fake_bin): uuid = uuid4() iou_device = IOUDevice(IOU(), local_server, project) nio_node = { "description": "IOU device", "id": 1, "ports": [ { "adapter_number": 0, "id": 1, "name": "Hyper Ethernet0/0", "port_number": 0 }, ], "properties": { "name": "IOU 1", "path": fake_bin, "startup_config": "/tmp", "ethernet_adapters": 1, "serial_adapters": 0, }, "server_id": 1, "type": "IOUDevice", "vm_id": uuid } with patch("gns3.modules.iou.iou_device.IOUDevice.setup") as mock: iou_device.load(nio_node) iou_device._addAdapters(1, 0) assert mock.called (path, name, vm_id, settings), kwargs = mock.call_args assert path == fake_bin assert name == "IOU 1" assert settings == { "ethernet_adapters": 1, "serial_adapters": 0, "startup_config": "/tmp" } assert vm_id == uuid iou_device.loaded_signal.emit() assert iou_device._ports[0].name() == "Hyper Ethernet0/0"