diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index c4ddb9b..c9ba589 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -58,6 +58,30 @@ jobs: run: | invoke validate-entries + test: + + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: true + + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dependencies + run: pip install .[test] + + - name: Run database ingestion tasks + run: | + pytest -vvv --durations=0 + build: runs-on: ubuntu-latest steps: diff --git a/tests/test_extractors.py b/tests/test_extractors.py new file mode 100644 index 0000000..8a92f00 --- /dev/null +++ b/tests/test_extractors.py @@ -0,0 +1,28 @@ +from pathlib import Path + +import pytest +from marda_extractors_api import extract + + +@pytest.fixture(scope="session") +def client(): + from fastapi.testclient import TestClient + + from marda_registry.app import api + + yield TestClient(app=api) + + +LFS_PATH = Path(__file__).parent.parent / "marda_registry" / "data" / "lfs" + + +@pytest.mark.parametrize("ft_id", [d.name for d in LFS_PATH.glob("*")]) +def test_files(ft_id, client): + ft_files = (LFS_PATH / ft_id).glob("*") + with client as cli: + response = cli.get(f"/filetypes/{ft_id}") + assert response.status_code == 200 + response = response.json() + assert response + supported_extractors = response.get("supported_extractors") + assert supported_extractors is not None