diff --git a/test/workflows/l3_core_service/test_validate_l3_core_service.py b/test/workflows/l3_core_service/test_validate_l3_core_service.py new file mode 100644 index 0000000000000000000000000000000000000000..9f226e11b8dcfb13f5c82e58b8035b3b694f14d1 --- /dev/null +++ b/test/workflows/l3_core_service/test_validate_l3_core_service.py @@ -0,0 +1,38 @@ +from unittest.mock import patch + +import pytest + +from gso.products.product_types.l3_core_service import L3CoreService, L3CoreServiceType +from test.workflows import assert_complete, assert_lso_success, extract_state, run_workflow + + +@pytest.mark.workflow() +@patch("gso.services.lso_client._send_request") +@pytest.mark.parametrize( + "l3_core_service_type", + [ + L3CoreServiceType.GEANT_IP, + L3CoreServiceType.IAS, + L3CoreServiceType.GWS, + L3CoreServiceType.LHCONE, + L3CoreServiceType.COPERNICUS, + ], +) +def test_validate_l3_core_service( + mock_lso_interaction, l3_core_service_subscription_factory, faker, l3_core_service_type +): + subscription_id = str( + l3_core_service_subscription_factory(l3_core_service_type=l3_core_service_type).subscription_id + ) + initial_l3_core_service_data = [{"subscription_id": subscription_id}] + result, process_stat, step_log = run_workflow("validate_l3_core_service", initial_l3_core_service_data) + result, step_log = assert_lso_success(result, process_stat, step_log) + result, _ = assert_lso_success(result, process_stat, step_log) + assert_complete(result) + + state = extract_state(result) + subscription_id = state["subscription_id"] + subscription = L3CoreService.from_subscription(subscription_id) + assert subscription.status == "active" + assert subscription.insync is True + assert mock_lso_interaction.call_count == 2