- Add max-h-[90vh] and flex-col to modal content container - Wrap tools grid in max-h-[50vh] overflow-y-auto container - Add overscroll-contain for smooth scroll behavior on mobile - Fixes issue where 21 PDF tools overflow viewport on small screens
2.3 KiB
2.3 KiB
description, name, argument-hint, agent, tools
| description | name | argument-hint | agent | tools | |||
|---|---|---|---|---|---|---|---|
| Generate a complete pytest test file for the selected Flask route or service code, following project conventions in backend/tests/ | Generate Backend Tests | Optional: additional context or specific scenarios to cover | agent |
|
Generate a complete pytest test file for the following Flask backend code (shown in #selection):
#selection
Rules
Follow the conventions used in backend/tests/:
- Class-based: Wrap all test methods in a
class Test<RouteName>(e.g.,class TestCompressRoutes). - Fixtures: Use
clientfor HTTP tests andapponly when patchingapp.config. Both come from backend/tests/conftest.py. Do not redefine fixtures. - CSRF: The
CSRFTestClientin conftest injectsX-CSRF-Tokenautomatically for mutating requests — no manual handling needed. - Mocking: Use
unittest.mock.patchandMagicMock. Patch at the service boundary (e.g.,@patch("app.routes.compress.compress_service.run")) not at the stdlib level. - Assertions: Always assert
response.status_codefirst, then checkresponse.get_json()contents. - Naming: Test method names must be descriptive, e.g.,
test_compress_returns_200_on_valid_pdf,test_compress_returns_400_when_no_file_provided.
Required Coverage
Include tests for:
- Happy path — valid input, expected 2xx response and payload shape.
- Missing / invalid input — 400 responses with an
errorkey in JSON. - Unauthenticated access — 401 when a login-protected route is hit without a session (register + logout first if needed).
- Service failure — mock the underlying service to raise an exception and assert the route returns 500.
- Edge cases — any domain-specific boundaries visible in the selected code (e.g., file size limits, unsupported MIME types, quota exceeded).
Output Format
Output a single, ready-to-save Python file.
- First line:
"""Tests for <describe the module>.""" - Then imports, then the test class(es).
- Suggest the save path as a comment at the top:
# Save as: backend/tests/test_<module_name>.py - Do not add
if __name__ == "__main__"blocks.
{{argument}}