diff --git a/.github/workflows/internal-tests.yaml b/.github/workflows/internal-tests.yaml new file mode 100644 index 0000000..87ed820 --- /dev/null +++ b/.github/workflows/internal-tests.yaml @@ -0,0 +1,30 @@ +name: Internal tests + +on: + push: + branches: [ main ] + paths: + - 'src/openeo_test_suite/lib/**' + pull_request: + branches: [ main ] + paths: + - 'src/openeo_test_suite/lib/**' + +jobs: + internal-tests: + name: "Internal tests" + runs-on: ubuntu-latest + steps: + - name: Clone repo + uses: actions/checkout@v2 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + cache: 'pip' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install . + - name: "Internal tests" + run: pytest src/openeo_test_suite/lib/internal-tests/ diff --git a/src/openeo_test_suite/lib/internal-tests/README.md b/src/openeo_test_suite/lib/internal-tests/README.md new file mode 100644 index 0000000..3c9bb5d --- /dev/null +++ b/src/openeo_test_suite/lib/internal-tests/README.md @@ -0,0 +1,7 @@ + +# Internal tests + +This is an internal test suite for testing the internal +helpers and other reusable functionality defined in `openeo_test_suite.lib`. +It is not part of the official test suite, does not run against a real openEO backend +and should not be run by users of the main openEO test suite. diff --git a/src/openeo_test_suite/lib/internal-tests/test_backend_under_test.py b/src/openeo_test_suite/lib/internal-tests/test_backend_under_test.py new file mode 100644 index 0000000..f8a271b --- /dev/null +++ b/src/openeo_test_suite/lib/internal-tests/test_backend_under_test.py @@ -0,0 +1,24 @@ +from unittest import mock + +import pytest + +from openeo_test_suite.lib.backend_under_test import get_backend_url + + +def test_get_backend_url_default(request): + url = get_backend_url(config=request.config) + assert url is None + + +@pytest.mark.parametrize( + ["configured_url", "expected"], + [ + ("https://openeo.test", "https://openeo.test"), + ("openeo.test", "https://openeo.test"), + ], +) +def test_get_backend_url_mocked_config(configured_url, expected): + config = mock.Mock() + config.getoption.return_value = configured_url + url = get_backend_url(config=config, required=True) + assert url == expected