Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

[WIP] Pre-build API testing #67

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
28 changes: 28 additions & 0 deletions tests/test_extractors.py
Original file line number Diff line number Diff line change
@@ -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
Loading