test: replace broken test suite with 52 passing tests#209
Open
utkarshqz wants to merge 1 commit intofireform-core:mainfrom
Open
test: replace broken test suite with 52 passing tests#209utkarshqz wants to merge 1 commit intofireform-core:mainfrom
utkarshqz wants to merge 1 commit intofireform-core:mainfrom
Conversation
This was referenced Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replaces the broken test suite with 52 fully passing tests covering the LLM class, template endpoints, and form endpoints.
The existing test infrastructure had two critical problems:
test_templates.pysentJSONto amultipart/form-dataendpoint → always 422test_forms.pywas entirely commented out → zero coverageconftest.pyused session-scoped DB → tests leaked data into each otherThis PR fixes all three and adds comprehensive tests for the new functionality introduced alongside it.
Fixes #163
Fixes #182
Fixes #183
Closes #186
Type of change
How Has This Been Tested?
Output:
All 52 tests pass on Windows 11, Python 3.11, in a clean virtual environment.
Test breakdown:
tests/test_llm.py— 15 tests (new file, Closes #186)TestTypeCheckAll— validates input types correctlyTestBuildBatchPrompt— confirms human labels appear in promptTestBuildPrompt— role-based guidance for officer/victim/location fieldsTestHandlePluralValues— semicolon splitting, whitespace strippingTestAddResponseToJson— stores values, ignores-1, handles pluralsTestMainLoop— mocked Ollama, asserts exactly 1 API call (O(1) batch)tests/test_templates.py— 10 tests (replaces broken version)tests/test_forms.py— 7 tests (replaces commented-out version)tests/conftest.py— fixed DB isolationChanged from session-scoped to function-scoped (
autouse=True)Each test gets a fresh empty DB — no data leakage between tests
Added
db_sessionfixture for direct DB access in test setupTest A —
python -m pytest tests/ -v→ 52 passedTest B — ran twice consecutively, same result (no order dependency)
Test Configuration:
Checklist: