mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-17 14:58:13 +00:00
Send node.updated notif only if object changed
This commit is contained in:
@ -186,16 +186,25 @@ def test_update_properties(node, compute, project, async_run, controller):
|
||||
controller._notification.emit.assert_called_with("node.updated", node_notif)
|
||||
|
||||
|
||||
def test_update_only_controller(node, compute, project, async_run):
|
||||
|
||||
def test_update_only_controller(node, controller, compute, project, async_run):
|
||||
"""
|
||||
When updating property used only on controller we don't need to
|
||||
call the compute
|
||||
"""
|
||||
compute.put = AsyncioMagicMock()
|
||||
controller._notification = AsyncioMagicMock()
|
||||
|
||||
async_run(node.update(x=42))
|
||||
assert not compute.put.called
|
||||
assert node.x == 42
|
||||
controller._notification.emit.assert_called_with("node.updated", node.__json__())
|
||||
|
||||
# If nothing change a second notif should not be send
|
||||
controller._notification = AsyncioMagicMock()
|
||||
async_run(node.update(x=42))
|
||||
assert not controller._notification.emit.called
|
||||
|
||||
|
||||
|
||||
def test_update_no_changes(node, compute, project, async_run):
|
||||
|
Reference in New Issue
Block a user