SIENTIAPDE-1174
Refactor test assertions in test_opc_manager.py for improved readability - Updated the assertion syntax for notification calls in the test_check_opc_listenning_error_notification_and_retry function to use dictionary literals for clarity.
This commit is contained in:
@@ -511,21 +511,21 @@ def test_check_opc_listenning_error_notification_and_retry(metrics, opc_manager)
|
|||||||
assert opc_manager.send_notification.call_count == 2
|
assert opc_manager.send_notification.call_count == 2
|
||||||
calls = opc_manager.send_notification.call_args_list
|
calls = opc_manager.send_notification.call_args_list
|
||||||
# First call: 5 cycles warning
|
# First call: 5 cycles warning
|
||||||
assert calls[0].kwargs == dict(
|
assert calls[0].kwargs == {
|
||||||
notification_id=f"OPC_LISTENNING_STOPPED__{opc_manager.name}",
|
"notification_id": f"OPC_LISTENNING_STOPPED__{opc_manager.name}",
|
||||||
message=f"15 cycles without receive from OPC {opc_manager.name}. Tags: {json.dumps(opc_manager.nodes)}",
|
"message": f"15 cycles without receive from OPC {opc_manager.name}. Tags: {json.dumps(opc_manager.nodes)}",
|
||||||
block="opc_manager",
|
"block": "opc_manager",
|
||||||
level=NotificationLevel.ERROR,
|
"level": NotificationLevel.ERROR,
|
||||||
metadata=metadata["metadata"],
|
"metadata": metadata["metadata"],
|
||||||
)
|
}
|
||||||
# Second call: 15 cycles retry
|
# Second call: 15 cycles retry
|
||||||
assert calls[1].kwargs == dict(
|
assert calls[1].kwargs == {
|
||||||
notification_id=f"OPC_CONNECTION_RETRY__{opc_manager.name}",
|
"notification_id": f"OPC_CONNECTION_RETRY__{opc_manager.name}",
|
||||||
message=f"Retrying to connect to server {opc_manager.name}",
|
"message": f"Retrying to connect to server {opc_manager.name}",
|
||||||
block="opc_manager",
|
"block": "opc_manager",
|
||||||
level=NotificationLevel.ERROR,
|
"level": NotificationLevel.ERROR,
|
||||||
metadata=metadata["metadata"],
|
"metadata": metadata["metadata"],
|
||||||
)
|
}
|
||||||
assert result is True
|
assert result is True
|
||||||
|
|
||||||
metrics.OPC_CYCLES_WITHOUT_DATA.labels.assert_called_once_with(
|
metrics.OPC_CYCLES_WITHOUT_DATA.labels.assert_called_once_with(
|
||||||
|
|||||||
Reference in New Issue
Block a user