mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
parent
add546158f
commit
1b530bde3f
@ -60,6 +60,7 @@ class Controller:
|
|||||||
Save the controller configuration on disk
|
Save the controller configuration on disk
|
||||||
"""
|
"""
|
||||||
data = {"computes": [{"host": c.host,
|
data = {"computes": [{"host": c.host,
|
||||||
|
"name": c.name,
|
||||||
"port": c.port,
|
"port": c.port,
|
||||||
"protocol": c.protocol,
|
"protocol": c.protocol,
|
||||||
"user": c.user,
|
"user": c.user,
|
||||||
|
@ -123,6 +123,7 @@ class Compute:
|
|||||||
self._session.close()
|
self._session.close()
|
||||||
self._connected = False
|
self._connected = False
|
||||||
self._controller.notification.emit("compute.updated", self.__json__())
|
self._controller.notification.emit("compute.updated", self.__json__())
|
||||||
|
self._controller.save()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def close(self):
|
def close(self):
|
||||||
|
@ -223,6 +223,7 @@ def test_close(compute, async_run):
|
|||||||
|
|
||||||
def test_update(compute, controller, async_run):
|
def test_update(compute, controller, async_run):
|
||||||
compute._controller._notification = MagicMock()
|
compute._controller._notification = MagicMock()
|
||||||
|
compute._controller.save = MagicMock()
|
||||||
compute.name = "Test"
|
compute.name = "Test"
|
||||||
compute.host = "example.org"
|
compute.host = "example.org"
|
||||||
compute._connected = True
|
compute._connected = True
|
||||||
@ -231,6 +232,7 @@ def test_update(compute, controller, async_run):
|
|||||||
assert compute.host == "example.org"
|
assert compute.host == "example.org"
|
||||||
controller.notification.emit.assert_called_with("compute.updated", compute.__json__())
|
controller.notification.emit.assert_called_with("compute.updated", compute.__json__())
|
||||||
assert compute.connected is False
|
assert compute.connected is False
|
||||||
|
assert compute._controller.save.called
|
||||||
|
|
||||||
|
|
||||||
def test_forward_get(compute, async_run):
|
def test_forward_get(compute, async_run):
|
||||||
|
@ -102,13 +102,14 @@ def test_deleteCompute(controller, controller_config_path, async_run):
|
|||||||
|
|
||||||
|
|
||||||
def test_addComputeConfigFile(controller, controller_config_path, async_run):
|
def test_addComputeConfigFile(controller, controller_config_path, async_run):
|
||||||
async_run(controller.add_compute(compute_id="test1"))
|
async_run(controller.add_compute(compute_id="test1", name="Test"))
|
||||||
assert len(controller.computes) == 1
|
assert len(controller.computes) == 1
|
||||||
with open(controller_config_path) as f:
|
with open(controller_config_path) as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
assert data["computes"] == [
|
assert data["computes"] == [
|
||||||
{
|
{
|
||||||
'compute_id': 'test1',
|
'compute_id': 'test1',
|
||||||
|
'name': 'Test',
|
||||||
'host': 'localhost',
|
'host': 'localhost',
|
||||||
'port': 3080,
|
'port': 3080,
|
||||||
'protocol': 'http',
|
'protocol': 'http',
|
||||||
|
Loading…
Reference in New Issue
Block a user