Strip user from compute in topology and return project filename

pull/638/head
Julien Duponchelle 8 years ago
parent c4d619ce3c
commit aa5988788d
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -238,8 +238,7 @@ class Compute:
"name": self._name,
"protocol": self._protocol,
"host": self._host,
"port": self._port,
"user": self._user
"port": self._port
}
return {
"compute_id": self._id,

@ -322,12 +322,14 @@ class Project:
raise aiohttp.web.HTTPInternalServerError(text="Could not create project directory: {}".format(e))
return path
def _topology_file(self):
def _filename(self):
if self.name is None:
filename = "untitled.gns3"
return "untitled.gns3"
else:
filename = self.name + ".gns3"
return os.path.join(self.path, filename)
return self.name + ".gns3"
def _topology_file(self):
return os.path.join(self.path, self._filename())
@asyncio.coroutine
def open(self):
@ -371,5 +373,6 @@ class Project:
"name": self._name,
"project_id": self._id,
"path": self._path,
"filename": self._filename(),
"status": self._status
}

@ -82,6 +82,11 @@ PROJECT_OBJECT_SCHEMA = {
"type": ["string", "null"],
"minLength": 1
},
"filename": {
"description": "Project filename",
"type": ["string", "null"],
"minLength": 1
},
"status": {
"description": "Project status Read only",
"enum": ["opened", "closed"]

@ -211,7 +211,6 @@ def test_json(compute):
"protocol": "https",
"host": "example.com",
"port": 84,
"user": "test",
}

@ -43,7 +43,7 @@ def test_affect_uuid():
def test_json(tmpdir):
p = Project()
assert p.__json__() == {"name": p.name, "project_id": p.id, "path": p.path, "status": "opened"}
assert p.__json__() == {"name": p.name, "project_id": p.id, "path": p.path, "status": "opened", "filename": "untitled.gns3"}
def test_path(tmpdir):

Loading…
Cancel
Save