1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix tests

This commit is contained in:
Julien Duponchelle 2015-05-04 21:29:28 +02:00
parent c4054cf810
commit ee2dada88b

View File

@ -260,24 +260,23 @@ def test_control_vm_expect_text(vm, loop, running_subprocess_mock):
def test_build_command(vm, loop, fake_qemu_binary, port_manager): def test_build_command(vm, loop, fake_qemu_binary, port_manager):
os.environ["DISPLAY"] = "0:0" os.environ["DISPLAY"] = "0:0"
with patch("gns3server.modules.qemu.qemu_vm.QemuVM._get_random_mac", return_value="00:00:ab:7e:b5:00"): with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process: cmd = loop.run_until_complete(asyncio.async(vm._build_command()))
cmd = loop.run_until_complete(asyncio.async(vm._build_command())) assert cmd == [
assert cmd == [ fake_qemu_binary,
fake_qemu_binary, "-name",
"-name", "test",
"test", "-m",
"-m", "256",
"256", "-hda",
"-hda", os.path.join(vm.working_dir, "flash.qcow2"),
os.path.join(vm.working_dir, "flash.qcow2"), "-serial",
"-serial", "telnet:127.0.0.1:{},server,nowait".format(vm.console),
"telnet:127.0.0.1:{},server,nowait".format(vm.console), "-device",
"-device", "e1000,mac=00:00:ab:0e:0f:00,netdev=gns3-0",
"e1000,mac=00:00:ab:7e:b5:00,netdev=gns3-0", "-netdev",
"-netdev", "user,id=gns3-0"
"user,id=gns3-0" ]
]
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_build_command_without_display(vm, loop, fake_qemu_binary): def test_build_command_without_display(vm, loop, fake_qemu_binary):