Skip to content

Add forms route tests and register AppError handler#267

Open
Mingqwqqaq wants to merge 1 commit intofireform-core:mainfrom
Mingqwqqaq:fix/forms-route-tests
Open

Add forms route tests and register AppError handler#267
Mingqwqqaq wants to merge 1 commit intofireform-core:mainfrom
Mingqwqqaq:fix/forms-route-tests

Conversation

@Mingqwqqaq
Copy link

@Mingqwqqaq Mingqwqqaq commented Mar 16, 2026

Summary

This PR improves route-level reliability around form submission. Closes #265

Changes

  • register the custom AppError handler in api/main.py
  • fetch the template only once in /forms/fill
  • add route tests for:
    • successful /forms/fill
    • missing-template /forms/fill returning 404
  • strengthen /templates/create assertions

Why

The forms route already raises AppError for missing templates, but the app was not registering the exception handler, so the intended API behavior was incomplete.

The existing tests/test_forms.py file was also still a stub, so the main submission path had no meaningful coverage.

Testing

Added API tests using monkeypatch to isolate route behavior from:

  • PDF processing
  • Ollama/LLM calls
  • file generation side effects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]/forms/fill should return a structured 404 for missing templates and needs route-level test coverage

1 participant