SIENTIAPDE-1199

Update test for validate_connection method in OpcRepository to include detailed response structure

- Modified the test case to assert the response format when the connection is lost, ensuring it includes notification ID, message, block, and level attributes for better clarity in error handling.
This commit is contained in:
vitor-aignosi
2025-08-19 16:42:48 -03:00
parent ef32167f57
commit 89384d7783

View File

@@ -182,7 +182,12 @@ def test_validate_connection_lost_not_time_to_reconect(_mock_datetime, opc_repos
response = opc_repository.validate_connection() response = opc_repository.validate_connection()
opc_repository.try_connect.assert_not_called() opc_repository.try_connect.assert_not_called()
assert response == (False, {}) assert response == (False, {
"notification_id": f"OPC_CONNECTION_AWAITING_RECONNECTION_WINDOW_{opc_repository.id}",
"message": f"OPC server {opc_repository.id} is not connected, waiting for next reconnection window...",
"block": "opc_repository",
"level": NotificationLevel.WARNING
})
@patch('laborious.utils.repository.opc_repository.hasattr', return_value=True) @patch('laborious.utils.repository.opc_repository.hasattr', return_value=True)