Skip to content

Test: add edge case coverage for template upload and preview routes#427

Open
Arijit429 wants to merge 1 commit intofireform-core:mainfrom
Arijit429:test-template-route-edge-cases
Open

Test: add edge case coverage for template upload and preview routes#427
Arijit429 wants to merge 1 commit intofireform-core:mainfrom
Arijit429:test-template-route-edge-cases

Conversation

@Arijit429
Copy link
Copy Markdown

@Arijit429 Arijit429 commented Apr 13, 2026

Closes #24

🚀 Summary

This PR extends route-level integration coverage for the newly added template file endpoints by adding negative-path and edge-case test scenarios.

The focus is to improve regression safety and ensure the routes behave correctly under invalid inputs.


✨ What Changed

Extended:

tests/test_template_file_routes.py

with additional integration tests covering invalid request scenarios.


🧪 New Test Coverage Added

1) Non-PDF upload should fail

Validates that uploading unsupported file types correctly returns:

400 Bad Request

This ensures file type validation remains enforced.


2) Missing preview file should return 404

Verifies that requesting a non-existent PDF path correctly returns:

404 Not Found

3) Outside-project file access should fail

Tests path validation and ensures attempts to preview files outside the project directory return:

400 Bad Request

This strengthens route safety and path validation behavior.


💡 Why This Helps

These tests improve:

  • edge-case reliability
  • invalid input handling
  • route-level regression safety
  • path validation confidence

This is especially important for file-based routes.


🧪 Local Validation

Executed locally using:

PYTHONPATH=. pytest tests/test_template_file_routes.py -q

and verified successful execution of all added scenarios.


🎯 Impact

This improves production confidence for the newly introduced upload and preview endpoints by validating failure-path behavior in addition to happy-path flows.

@Arijit429
Copy link
Copy Markdown
Author

Hi maintainers, extending my ongoing post-proposal testing roadmap, this PR adds negative-path coverage for the newly introduced template file routes to strengthen edge-case reliability and route safety.

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.

[Enhancement]: Lack of isolated unit tests for core data pipeline

1 participant