mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-11 16:41:04 +00:00
In the export rename the .gns3 to project.gns3
This commit is contained in:
parent
bd71f0cf4c
commit
3b04f556b3
@ -534,5 +534,9 @@ class Project:
|
|||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
path = os.path.join(root, file)
|
path = os.path.join(root, file)
|
||||||
z.write(path, os.path.relpath(path, self._path))
|
# We rename the .gns3 project.gns3 to avoid the task to the client to guess the file name
|
||||||
|
if file.endswith(".gns3"):
|
||||||
|
z.write(path, "project.gns3")
|
||||||
|
else:
|
||||||
|
z.write(path, os.path.relpath(path, self._path))
|
||||||
return z
|
return z
|
||||||
|
@ -265,6 +265,11 @@ def test_export(tmpdir):
|
|||||||
project = Project()
|
project = Project()
|
||||||
path = project.path
|
path = project.path
|
||||||
os.makedirs(os.path.join(path, "vm-1", "dynamips"))
|
os.makedirs(os.path.join(path, "vm-1", "dynamips"))
|
||||||
|
|
||||||
|
# The .gns3 should be renamed project.gns3 in order to simplify import
|
||||||
|
with open(os.path.join(path, "test.gns3"), 'w+') as f:
|
||||||
|
f.write("{}")
|
||||||
|
|
||||||
with open(os.path.join(path, "vm-1", "dynamips", "test"), 'w+') as f:
|
with open(os.path.join(path, "vm-1", "dynamips", "test"), 'w+') as f:
|
||||||
f.write("HELLO")
|
f.write("HELLO")
|
||||||
with open(os.path.join(path, "vm-1", "dynamips", "test_log.txt"), 'w+') as f:
|
with open(os.path.join(path, "vm-1", "dynamips", "test_log.txt"), 'w+') as f:
|
||||||
@ -284,5 +289,7 @@ def test_export(tmpdir):
|
|||||||
content = myfile.read()
|
content = myfile.read()
|
||||||
assert content == b"HELLO"
|
assert content == b"HELLO"
|
||||||
|
|
||||||
|
assert 'test.gns3' not in myzip.namelist()
|
||||||
|
assert 'project.gns3' in myzip.namelist()
|
||||||
assert 'project-files/snapshots/test' not in myzip.namelist()
|
assert 'project-files/snapshots/test' not in myzip.namelist()
|
||||||
assert 'vm-1/dynamips/test_log.txt' not in myzip.namelist()
|
assert 'vm-1/dynamips/test_log.txt' not in myzip.namelist()
|
||||||
|
Loading…
Reference in New Issue
Block a user