SIENTIAPDE-1646
SIENTIAPDE-1646 Update dependencies and refactor OPC integration - Replaced `opcua` with `asyncua` in `requirements-local.txt` and `requirements.txt` to utilize the async capabilities. - Updated `values.yaml` to change the GitHub branch from `feature/SIENTIAPDE-1646` to `release/SIENTIAPDE-1646`. - Refactored `opc.py` and `opc_repository.py` to accommodate the new `asyncua` library, ensuring compatibility with the synchronous API. - Adjusted tests in `test_opc_repository.py` to reflect changes in the client implementation and maintain functionality.
This commit is contained in:
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
from unittest.mock import ANY, MagicMock, Mock, patch
|
||||
|
||||
import pytest
|
||||
from opcua.crypto import security_policies
|
||||
from asyncua.crypto import security_policies
|
||||
from sientia_do.notifications.models import NotificationLevel
|
||||
|
||||
from laborious.utils.repository.opc_repository import OpcRepository
|
||||
@@ -39,6 +39,7 @@ def opc_repository(mock_logger):
|
||||
def mock_client():
|
||||
with patch('laborious.utils.repository.opc_repository.Client') as mock:
|
||||
client_instance = MagicMock()
|
||||
client_instance.aio_obj = MagicMock()
|
||||
mock.return_value = client_instance
|
||||
yield client_instance
|
||||
|
||||
@@ -75,10 +76,11 @@ def test_set_security(opc_repository, mock_client):
|
||||
security_policies.SecurityPolicyBasic256,
|
||||
'/path/to/cert.pem',
|
||||
'/path/to/key.pem',
|
||||
None,
|
||||
'/path/to/server_cert.pem',
|
||||
)
|
||||
assert mock_client.secure_channel_timeout == 10000000
|
||||
assert mock_client.session_timeout == 10000000
|
||||
assert mock_client.aio_obj.secure_channel_timeout == 10000000
|
||||
assert mock_client.aio_obj.session_timeout == 10000000
|
||||
|
||||
|
||||
def test_set_security_missing_certificates(opc_repository):
|
||||
|
||||
Reference in New Issue
Block a user