refactor: ruff autofixes

This commit is contained in:
Mark Paronyan committed 2026-09-27 15:55:10 +03:00
1 parent 2ac637c662
commit a0450b6bce
455 files changed
+12322 -14762

No files matched your search

@@ -104,30 +104,20 @@ async def test_duplicate_node(manager, compute_project):
Duplicate dynamips do nothing it's manage outside the
filesystem
"""
with asyncio_patch('gns3server.compute.dynamips.nodes.c7200.C7200.create'):
source_node = await manager.create_node(
'R1',
compute_project.id,
str(uuid.uuid4()),
platform="c7200"
)
destination_node = await manager.create_node(
'R2',
compute_project.id,
str(uuid.uuid4()),
platform="c7200"
)
with asyncio_patch("gns3server.compute.dynamips.nodes.c7200.C7200.create"):
source_node = await manager.create_node("R1", compute_project.id, str(uuid.uuid4()), platform="c7200")
destination_node = await manager.create_node("R2", compute_project.id, str(uuid.uuid4()), platform="c7200")
destination_node._hypervisor = AsyncioMagicMock()
with open(os.path.join(source_node.working_dir, 'c3600_i1_nvram'), 'w+') as f:
with open(os.path.join(source_node.working_dir, "c3600_i1_nvram"), "w+") as f:
f.write("1")
with open(source_node.startup_config_path, 'w+') as f:
f.write('hostname R1\necho TEST')
with open(source_node.startup_config_path, "w+") as f:
f.write("hostname R1\necho TEST")
await manager.duplicate_node(source_node.id, destination_node.id)
assert not os.path.exists(os.path.join(destination_node.working_dir, 'c3600_i1_nvram'))
assert not os.path.exists(os.path.join(destination_node.working_dir, "c3600_i1_nvram"))
with open(destination_node.startup_config_path) as f:
content = f.read()
assert content == '!\nhostname R2\necho TEST'
assert content == "!\nhostname R2\necho TEST"
with pytest.raises(DynamipsError):
source_node.status = "started"
await manager.duplicate_node(source_node.id, destination_node.id)
@@ -28,10 +28,10 @@ def test_mac_command():
node.nios[0].name = "Ethernet0"
node.nios[1] = NIOUDP(55, "127.0.0.1", 56)
node.nios[1].name = "Ethernet1"
#node._hypervisor.send = AsyncioMagicMock(return_value=["0050.7966.6801 1 Ethernet0", "0050.7966.6802 1 Ethernet1"])
#console = EthernetSwitchConsole(node)
#assert async_run(console.mac()) == \
# node._hypervisor.send = AsyncioMagicMock(return_value=["0050.7966.6801 1 Ethernet0", "0050.7966.6802 1 Ethernet1"])
# console = EthernetSwitchConsole(node)
# assert async_run(console.mac()) == \
# "Port Mac VLAN\n" \
# "Ethernet0 00:50:79:66:68:01 1\n" \
# "Ethernet1 00:50:79:66:68:02 1\n"
#node._hypervisor.send.assert_called_with("ethsw show_mac_addr_table Test")
# node._hypervisor.send.assert_called_with("ethsw show_mac_addr_table Test")