From 7756bd34858e4cfde722aba563ba35a69db40b4f Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Wed, 29 Jan 2025 10:57:12 +0100 Subject: [PATCH] Add unit test for l3 validation wf --- .../test_validate_l3_core_service.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/workflows/l3_core_service/test_validate_l3_core_service.py 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 000000000..9f226e11b --- /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 -- GitLab