mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
refactor: ruff autofixes
This commit is contained in:
455 files changed
+12322
-14762
No files matched your search
@@ -76,12 +76,14 @@ def test_vboxmanage_path(manager, config, tmpdir):
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_vms(manager):
|
||||
|
||||
vm_list = ['"Windows 8.1" {27b4d095-ff5f-4ac4-bb9d-5f2c7861c1f1}',
|
||||
'"Carriage',
|
||||
'Return" {27b4d095-ff5f-4ac4-bb9d-5f2c7861c3f3}',
|
||||
'',
|
||||
'"<inaccessible>" {42b4d095-ff5f-4ac4-bb9d-5f2c7861c1f1}',
|
||||
'"Linux Microcore 4.7.1" {ccd8c50b-c172-457d-99fa-dd69371ede0e}']
|
||||
vm_list = [
|
||||
'"Windows 8.1" {27b4d095-ff5f-4ac4-bb9d-5f2c7861c1f1}',
|
||||
'"Carriage',
|
||||
'Return" {27b4d095-ff5f-4ac4-bb9d-5f2c7861c3f3}',
|
||||
"",
|
||||
'"<inaccessible>" {42b4d095-ff5f-4ac4-bb9d-5f2c7861c1f1}',
|
||||
'"Linux Microcore 4.7.1" {ccd8c50b-c172-457d-99fa-dd69371ede0e}',
|
||||
]
|
||||
|
||||
async def execute_mock(cmd, args):
|
||||
if cmd == "list":
|
||||
@@ -96,7 +98,4 @@ async def test_list_vms(manager):
|
||||
with asyncio_patch("gns3server.compute.virtualbox.VirtualBox.execute") as mock:
|
||||
mock.side_effect = execute_mock
|
||||
vms = await manager.list_vms()
|
||||
assert vms == [
|
||||
{"vmname": "Windows 8.1", "ram": 512},
|
||||
{"vmname": "Linux Microcore 4.7.1", "ram": 256}
|
||||
]
|
||||
assert vms == [{"vmname": "Windows 8.1", "ram": 512}, {"vmname": "Linux Microcore 4.7.1", "ram": 256}]
|
||||
@@ -99,7 +99,9 @@ async def test_vm_invalid_virtualbox_api_version(compute_project, manager):
|
||||
@pytest.mark.asyncio
|
||||
async def test_vm_adapter_add_nio_binding_adapter_not_exist(vm, manager, free_console_port):
|
||||
|
||||
nio = manager.create_nio({"type": "nio_udp", "lport": free_console_port, "rport": free_console_port, "rhost": "127.0.0.1"})
|
||||
nio = manager.create_nio(
|
||||
{"type": "nio_udp", "lport": free_console_port, "rport": free_console_port, "rhost": "127.0.0.1"}
|
||||
)
|
||||
with pytest.raises(VirtualBoxError):
|
||||
await vm.adapter_add_nio_binding(15, nio)
|
||||
|
||||
|
||||
Reference in new issue
Block a user