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

Send node.updated event and tests are green

Fix #524
This commit is contained in:
Julien Duponchelle 2016-05-16 21:12:32 +02:00
parent cb70cfecd7
commit a496aaab9e
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 7 additions and 7 deletions

View File

@ -105,9 +105,7 @@ class BaseNode:
def status(self, status):
self._node_status = status
if status in ("started", "stopped", "suspended"):
self.project.emit("node.{status}".format(status=status), {"node_id": self.id})
self.project.emit("node.updated", self) # FIXME: should we send this when we just start/stop/suspend a node?
self.project.emit("node.updated", self)
@property
def command_line(self):

View File

@ -121,14 +121,14 @@ class Project:
if compute not in self._project_created_on_compute:
# For a local server we send the project path
if compute.id == "local":
yield from compute.post("/projects", {
yield from compute.post("/projects", data={
"name": self._name,
"project_id": self._id,
"temporary": self._temporary,
"path": self._path
})
else:
yield from compute.post("/projects", {
yield from compute.post("/projects", data={
"name": self._name,
"project_id": self._id,
"temporary": self._temporary

View File

@ -90,7 +90,7 @@ def test_add_node_local(async_run):
node = async_run(project.add_node(compute, None, name="test", node_type="vpcs", properties={"startup_config": "test.cfg"}))
compute.post.assert_any_call('/projects', {
compute.post.assert_any_call('/projects', data={
"name": project._name,
"project_id": project._id,
"temporary": project._temporary,
@ -98,6 +98,7 @@ def test_add_node_local(async_run):
})
compute.post.assert_any_call('/projects/{}/vpcs/nodes'.format(project.id),
data={'node_id': node.id,
'console_type': 'telnet',
'startup_config': 'test.cfg',
'name': 'test'})
assert compute in project._project_created_on_compute
@ -117,13 +118,14 @@ def test_add_node_non_local(async_run):
node = async_run(project.add_node(compute, None, name="test", node_type="vpcs", properties={"startup_config": "test.cfg"}))
compute.post.assert_any_call('/projects', {
compute.post.assert_any_call('/projects', data={
"name": project._name,
"project_id": project._id,
"temporary": project._temporary
})
compute.post.assert_any_call('/projects/{}/vpcs/nodes'.format(project.id),
data={'node_id': node.id,
'console_type': 'telnet',
'startup_config': 'test.cfg',
'name': 'test'})
assert compute in project._project_created_on_compute