From 8b019270213d6593f1ebca456b10378178d4c15e Mon Sep 17 00:00:00 2001 From: rashidakanchwala Date: Thu, 31 Oct 2024 10:24:23 +0000 Subject: [PATCH] make simple tests Signed-off-by: rashidakanchwala --- package/tests/conftest.py | 23 ++++++++----------- .../test_api/test_rest/test_responses.py | 12 ++++++---- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/package/tests/conftest.py b/package/tests/conftest.py index 4c50749b9..e10ece696 100644 --- a/package/tests/conftest.py +++ b/package/tests/conftest.py @@ -221,6 +221,7 @@ def example_pipeline_with_node_namespaces(): inputs=["raw_transaction_data", "cleaned_transaction_data"], outputs="validated_transaction_data", name="validation_node", + tags=["validation"], ), node( func=lambda validated_data, enrichment_data: ( @@ -381,9 +382,8 @@ def edge_case_example_pipelines( @pytest.fixture -def edge_case_example_pipelines_with_tags( - example_pipeline_with_dataset_as_input_and_output, - example_pipeline_with_dataset_as_input_to_outer_namespace, +def example_pipelines_with_additional_tags( + example_pipeline_with_node_namespaces ): """ Fixture to mock the use cases mentioned in @@ -391,15 +391,10 @@ def edge_case_example_pipelines_with_tags( """ pipelines_dict = { - "customer_pipeline": example_pipeline_with_dataset_as_input_and_output, - "car_pipeline": example_pipeline_with_dataset_as_input_to_outer_namespace, + "pipeline": example_pipeline_with_node_namespaces, + "pipeline_with_tags": pipeline(example_pipeline_with_node_namespaces, tags=["tag1", "tag2"]), } - - pipelines_dict["__default__"] = pipeline( - sum(pipeline for pipeline in pipelines_dict.values()), - tags=["default_tag1", "default_tag2"], - ) - + yield pipelines_dict @@ -562,9 +557,9 @@ def example_api_for_edge_case_pipelines( @pytest.fixture -def example_api_for_edge_case_pipelines_with_tags( +def example_api_for_pipelines_with_additional_tags( data_access_manager: DataAccessManager, - edge_case_example_pipelines_with_tags: Dict[str, Pipeline], + example_pipelines_with_additional_tags: Dict[str, Pipeline], example_catalog: DataCatalog, session_store: BaseSessionStore, mocker, @@ -581,7 +576,7 @@ def example_api_for_edge_case_pipelines_with_tags( populate_data( data_access_manager, example_catalog, - edge_case_example_pipelines_with_tags, + example_pipelines_with_additional_tags, session_store, {}, ) diff --git a/package/tests/test_api/test_rest/test_responses.py b/package/tests/test_api/test_rest/test_responses.py index 10df37799..4523ad45a 100644 --- a/package/tests/test_api/test_rest/test_responses.py +++ b/package/tests/test_api/test_rest/test_responses.py @@ -594,15 +594,17 @@ def test_endpoint_main_for_edge_case_pipelines( actual_modular_pipelines_tree, expected_modular_pipeline_tree_for_edge_cases ) - def test_endpoint_main_for_edge_case_pipelines_with_tags( + def test_endpoint_main_for_pipelines_with_additional_tags( self, - example_api_for_edge_case_pipelines_with_tags, + example_api_for_pipelines_with_additional_tags, ): expected_tags = [ - {"id": "default_tag1", "name": "default_tag1"}, - {"id": "default_tag2", "name": "default_tag2"}, + {"id": "tag1", "name": "tag1"}, + {"id": "tag2", "name": "tag2"}, + {"id": "validation", "name": "validation"}, + ] - client = TestClient(example_api_for_edge_case_pipelines_with_tags) + client = TestClient(example_api_for_pipelines_with_additional_tags) response = client.get("/api/main") actual_tags = response.json()["tags"] assert actual_tags == expected_tags