|
|
|
@ -243,12 +243,12 @@ def test_update_startup_script(vm):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_update_startup_script_h(vm):
|
|
|
|
|
content = "setname %h\n"
|
|
|
|
|
content = "set pcname %h\n"
|
|
|
|
|
vm.name = "pc1"
|
|
|
|
|
vm.startup_script = content
|
|
|
|
|
assert os.path.exists(vm.script_file)
|
|
|
|
|
with open(vm.script_file) as f:
|
|
|
|
|
assert f.read() == "setname pc1\n"
|
|
|
|
|
assert f.read() == "set pcname pc1\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_startup_script(vm):
|
|
|
|
@ -275,11 +275,18 @@ def test_change_name(vm, tmpdir):
|
|
|
|
|
path = os.path.join(vm.working_dir, 'startup.vpc')
|
|
|
|
|
vm.name = "world"
|
|
|
|
|
with open(path, 'w+') as f:
|
|
|
|
|
f.write("name world")
|
|
|
|
|
f.write("set pcname world")
|
|
|
|
|
vm.name = "hello"
|
|
|
|
|
assert vm.name == "hello"
|
|
|
|
|
with open(path) as f:
|
|
|
|
|
assert f.read() == "name hello"
|
|
|
|
|
assert f.read() == "set pcname hello"
|
|
|
|
|
# Support when the name is not sync with config
|
|
|
|
|
with open(path, 'w+') as f:
|
|
|
|
|
f.write("set pcname alpha")
|
|
|
|
|
vm.name = "beta"
|
|
|
|
|
assert vm.name == "beta"
|
|
|
|
|
with open(path) as f:
|
|
|
|
|
assert f.read() == "set pcname beta"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_close(vm, port_manager, loop):
|
|
|
|
|