Skip to content

Commit

Permalink
test case filter logic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ieaves committed Mar 12, 2024
1 parent 9a5392b commit 4729f48
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions grai-integrations/source-cube/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from typing import Optional

from grai_source_cube.api import MetaResponseSchema
from grai_source_cube.base import CubeIntegration
from pytest_cases import parametrize_with_cases


Expand All @@ -8,28 +11,34 @@ class IntegrationCases:
"""

@staticmethod
def case_cube_core(local_integration):
def case_cube_core(local_integration) -> Optional[CubeIntegration]:
return local_integration

@staticmethod
def case_cube_cloud(mock_integration):
def case_cube_cloud(mock_integration) -> Optional[CubeIntegration]:
return mock_integration

@staticmethod
def case_mock_api(cloud_integration):
def case_mock_api(cloud_integration) -> Optional[CubeIntegration]:
return cloud_integration


@parametrize_with_cases("test_integration", cases=IntegrationCases, filter=lambda x: x is not None)
@parametrize_with_cases("test_integration", cases=IntegrationCases)
def test_connector_ready_endpoint(test_integration):
if test_integration is None:
return
assert test_integration.connector.ready().status_code == 200


@parametrize_with_cases("test_integration", cases=IntegrationCases, filter=lambda x: x is not None)
@parametrize_with_cases("test_integration", cases=IntegrationCases)
def test_integration_ready_endpoint(test_integration):
if test_integration is None:
return
assert test_integration.ready() is True


@parametrize_with_cases("test_integration", cases=IntegrationCases, filter=lambda x: x is not None)
@parametrize_with_cases("test_integration", cases=IntegrationCases)
def test_api_meta_endpoint(test_integration):
if test_integration is None:
return
assert isinstance(test_integration.connector.meta(), MetaResponseSchema)

0 comments on commit 4729f48

Please sign in to comment.