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