mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 06:21:15 +02:00
Refactor VPCS script file loading
This allow to support moving the project on disk
This commit is contained in:
1 parent
869405738e
commit
41a8872819
4 files changed
+22
-30
No files matched your search
@@ -34,7 +34,6 @@ def test_vpcs_create(server, project):
|
||||
assert response.route == "/{project_id}/vpcs/vms"
|
||||
assert response.json["name"] == "PC TEST 1"
|
||||
assert response.json["project_id"] == project.id
|
||||
assert response.json["script_file"] is None
|
||||
|
||||
|
||||
def test_vpcs_get(server, project, vm):
|
||||
|
||||
@@ -134,7 +134,7 @@ def test_port_remove_nio_binding(vm):
|
||||
def test_update_startup_script(vm):
|
||||
content = "echo GNS3 VPCS\nip 192.168.1.2\n"
|
||||
vm.startup_script = content
|
||||
filepath = os.path.join(vm.working_dir, 'startup.vpcs')
|
||||
filepath = os.path.join(vm.working_dir, 'startup.vpc')
|
||||
assert os.path.exists(filepath)
|
||||
with open(filepath) as f:
|
||||
assert f.read() == content
|
||||
@@ -143,7 +143,7 @@ def test_update_startup_script(vm):
|
||||
def test_update_startup_script(vm):
|
||||
content = "echo GNS3 VPCS\nip 192.168.1.2\n"
|
||||
vm.startup_script = content
|
||||
filepath = os.path.join(vm.working_dir, 'startup.vpcs')
|
||||
filepath = os.path.join(vm.working_dir, 'startup.vpc')
|
||||
assert os.path.exists(filepath)
|
||||
with open(filepath) as f:
|
||||
assert f.read() == content
|
||||
@@ -192,11 +192,10 @@ def test_change_console_port(vm, port_manager):
|
||||
|
||||
|
||||
def test_change_name(vm, tmpdir):
|
||||
path = os.path.join(str(tmpdir), 'startup.vpcs')
|
||||
path = os.path.join(vm.working_dir, 'startup.vpc')
|
||||
vm.name = "world"
|
||||
with open(path, 'w+') as f:
|
||||
f.write("name world")
|
||||
vm._script_file = path
|
||||
vm.name = "hello"
|
||||
assert vm.name == "hello"
|
||||
with open(path) as f:
|
||||
|
||||
Reference in new issue
Block a user