Skip to content

Commit 97b62b6

Browse files
committed
feat: initial implementation of test cases for the apis
1 parent f194541 commit 97b62b6

6 files changed

Lines changed: 396 additions & 249 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
# Pytest fixtures (tests/conftest.py) build a temp workspaceStorage and
115115
# exercise Flask routes via app.test_client(). Only listed files — not
116116
# `pytest tests/` — to avoid re-collecting unittest.TestCase classes above.
117-
run: python -m pytest tests/test_api_endpoints.py tests/test_pdf_export.py tests/test_search_helpers.py -v --tb=short
117+
run: python -m pytest tests/test_api_search.py tests/test_api_workspaces.py tests/test_api_export.py tests/test_pdf_export.py tests/test_search_helpers.py -v --tb=short
118118

119119
# ── PyInstaller desktop build (Windows only, once per workflow) ────────
120120
# Closes #44. Builds the onedir bundle and smoke-tests --help so the

tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
HAPPY_COMPOSER_ID,
2323
HAPPY_WORKSPACE_ID,
2424
)
25+
from utils.exclusion_rules import tokenize_rule
2526

2627

2728
def _make_global_state_db(path: str) -> None:
@@ -141,6 +142,19 @@ def client(workspace_storage: str):
141142
return app.test_client()
142143

143144

145+
def client_with_rules(rule_lines: list[str]) -> FlaskClient:
146+
"""Flask test client with EXCLUSION_RULES parsed from the given lines.
147+
148+
Requires WORKSPACE_PATH / CLI_CHATS_PATH to already be set (e.g. by
149+
``workspace_storage`` fixture).
150+
"""
151+
parsed = [tokenize_rule(line) for line in rule_lines]
152+
app = create_app()
153+
app.config["TESTING"] = True
154+
app.config["EXCLUSION_RULES"] = [r for r in parsed if r]
155+
return app.test_client()
156+
157+
144158
@pytest.fixture
145159
def empty_workspace_client() -> Generator[FlaskClient, None, None]:
146160
"""Flask test client bound to a workspaceStorage with no workspaces.

tests/test_api_endpoints.py

Lines changed: 0 additions & 248 deletions
This file was deleted.

0 commit comments

Comments
 (0)