request.tests.test_gds_push_serviceΒΆ

Tests for GDS Push service.

ClassesΒΆ

TestGdsPushService

Test cases for GdsPushService.

TestGdsPushServiceAdditionalCoverage

Additional test cases to reach 70% coverage.

FunctionsΒΆ

mock_ca_with_crl()

Create a mock CA with CRL.

mock_domain(mock_ca_with_crl)

Create a mock domain.

mock_truststore()

Create a mock truststore.

mock_server_certificate(mock_truststore)

Create a mock server certificate in the truststore.

mock_opc_device(mock_domain, mock_truststore, ...)

Create a mock OPC UA device with proper configuration.

mock_domain_credential(mock_opc_device, mock_domain)

Create a mock domain credential for the device.

Module ContentsΒΆ

request.tests.test_gds_push_service.mock_ca_with_crl()[source]ΒΆ

Create a mock CA with CRL.

request.tests.test_gds_push_service.mock_domain(mock_ca_with_crl)[source]ΒΆ

Create a mock domain.

request.tests.test_gds_push_service.mock_truststore()[source]ΒΆ

Create a mock truststore.

request.tests.test_gds_push_service.mock_server_certificate(mock_truststore)[source]ΒΆ

Create a mock server certificate in the truststore.

request.tests.test_gds_push_service.mock_opc_device(mock_domain, mock_truststore, mock_server_certificate)[source]ΒΆ

Create a mock OPC UA device with proper configuration.

request.tests.test_gds_push_service.mock_domain_credential(mock_opc_device, mock_domain)[source]ΒΆ

Create a mock domain credential for the device.

class request.tests.test_gds_push_service.TestGdsPushService[source]ΒΆ

Test cases for GdsPushService.

test_init_insecure_mode(mock_opc_device)[source]ΒΆ

Test initialization in insecure mode.

test_init_secure_mode(mock_opc_device, mock_domain_credential, mock_truststore)[source]ΒΆ

Test initialization in secure mode.

test_init_device_missing_ip(mock_domain, mock_truststore)[source]ΒΆ

Test initialization with device missing IP address.

test_init_device_missing_port(mock_domain, mock_truststore)[source]ΒΆ

Test initialization with device missing OPC server port.

test_init_device_no_onboarding_config(mock_domain)[source]ΒΆ

Test initialization with device missing onboarding config.

test_init_device_empty_truststore(mock_domain)[source]ΒΆ

Test initialization with empty OPC truststore.

test_init_no_domain_credential(mock_domain, mock_truststore)[source]ΒΆ

Test initialization when no domain credential exists.

async test_build_ca_chain(mock_sync_to_async, mock_opc_device, mock_ca_with_crl)[source]ΒΆ

Test building CA certificate chain.

async test_discover_server_success(mock_client_class, mock_opc_device)[source]ΒΆ

Test successful server discovery.

async test_discover_server_connection_failure(mock_client_class, mock_opc_device)[source]ΒΆ

Test server discovery with connection failure.

test_analyze_endpoints(mock_opc_device)[source]ΒΆ

Test endpoint analysis.

async test_update_trustlist_success(mock_sync_to_async, mock_client_class, mock_opc_device, mock_domain_credential, mock_ca_with_crl)[source]ΒΆ

Test successful trustlist update.

async test_update_trustlist_connection_failure(mock_client_class, mock_opc_device, mock_domain_credential)[source]ΒΆ

Test trustlist update with connection failure.

test_validate_client_certificate_valid(mock_opc_device)[source]ΒΆ

Test client certificate validation with valid certificate.

test_validate_client_certificate_expired(mock_opc_device)[source]ΒΆ

Test client certificate validation with expired certificate.

test_validate_client_certificate_missing_key_usage(mock_opc_device)[source]ΒΆ

Test client certificate validation with missing key usage.

test_extract_application_uri_success(mock_opc_device)[source]ΒΆ

Test successful application URI extraction.

test_extract_application_uri_missing(mock_opc_device)[source]ΒΆ

Test application URI extraction with missing URI.

test_verify_certificate_key_match_success(mock_opc_device)[source]ΒΆ

Test successful certificate and key match verification.

test_verify_certificate_key_match_failure(mock_opc_device)[source]ΒΆ

Test certificate and key match verification with mismatch.

async test_update_server_certificate_success(mock_client_class, mock_opc_device, mock_domain_credential, mock_ca_with_crl)[source]ΒΆ

Test successful server certificate update.

async test_update_server_certificate_no_groups(mock_client_class, mock_opc_device, mock_domain_credential)[source]ΒΆ

Test server certificate update with no certificate groups found.

async test_discover_certificate_groups_success(mock_opc_device)[source]ΒΆ

Test successful certificate groups discovery.

async test_update_single_certificate_success(mock_opc_device, mock_domain_credential)[source]ΒΆ

Test successful single certificate update.

async test_get_client_credentials_no_credential(mock_opc_device, mock_domain_credential)[source]ΒΆ

Test client credentials retrieval with no domain credential.

async test_discover_trustlist_nodes_success(mock_opc_device)[source]ΒΆ

Test successful trustlist nodes discovery.

async test_update_single_trustlist_success(mock_opc_device)[source]ΒΆ

Test successful single trustlist update.

async test_update_truststore_no_truststore_configured(mock_opc_device)[source]ΒΆ

Test truststore update with no truststore configured.

test_raise_gds_push_error(mock_opc_device)[source]ΒΆ

Test GdsPushError raising.

async test_update_server_certificate_connection_error(mock_opc_device, mock_domain_credential)[source]ΒΆ

Test server certificate update with connection error.

async test_validate_client_certificate_raises_error(mock_opc_device)[source]ΒΆ

Test certificate validation raises error for invalid certificate.

async test_discover_certificate_groups_empty(mock_opc_device)[source]ΒΆ

Test certificate groups discovery with no groups.

async test_analyze_endpoints_with_none_policy(mock_opc_device)[source]ΒΆ

Test endpoint analysis with None security policy.

async test_update_single_trustlist_open_failure(mock_opc_device)[source]ΒΆ

Test trustlist update with open failure.

async test_analyze_endpoints_with_secure_policy(mock_opc_device)[source]ΒΆ

Test endpoint analysis with secure policy.

async test_discover_server_with_endpoint_url(mock_opc_device)[source]ΒΆ

Test server discovery with endpoint URL.

async test_update_single_trustlist_close_and_update_false(mock_opc_device)[source]ΒΆ

Test trustlist update when CloseAndUpdate returns False.

class request.tests.test_gds_push_service.TestGdsPushServiceAdditionalCoverage[source]ΒΆ

Additional test cases to reach 70% coverage.

test_create_insecure_client(mock_opc_device)[source]ΒΆ

Test creating insecure OPC UA client.

async test_gather_server_info(mock_opc_device)[source]ΒΆ

Test gathering server information.

async test_discover_trustlist_nodes(mock_opc_device)[source]ΒΆ

Test discovering trustlist nodes.

test_raise_gds_push_error(mock_opc_device)[source]ΒΆ

Test raising GDS push error.

async test_build_ca_chain_no_domain(mock_opc_device)[source]ΒΆ

Test building CA chain with no domain.

test_validate_client_certificate_missing_san(mock_opc_device)[source]ΒΆ

Test validating client certificate with missing SAN.

test_extract_application_uri_no_san(mock_opc_device)[source]ΒΆ

Test extracting application URI with no SAN.

test_get_server_truststore_no_config(mock_opc_device)[source]ΒΆ

Test getting server truststore with no onboarding config.