Skip to content

Add FastAPI Integration Tests #23

@MuddyHope

Description

@MuddyHope

Description

We need to implement robust integration tests for using @TrackQuery inside FastAPI routes. This will ensure the tracking and logging system behaves correctly in real-world API scenarios. Additional development and potential rework of decorators or logging middleware might be necessary to ensure clean and consistent behavior.

Acceptance Criteria:

  • Create a minimal FastAPI app with example routes using @TrackQuery.

  • Test both synchronous and asynchronous route handlers.

  • Use fastapi.testclient.TestClient for testing.

  • Validate logs using caplog or mock logger where needed.

  • Ensure that logging occurs correctly and doesn't interfere with route execution.

  • Handle slow execution (sleep), exceptions, and edge cases.

If needed, refactor the decorator to better support ASGI/FastAPI lifecycle.

🛠️ Notes:

May require changes to decorator or logger setup to support ASGI and middleware contexts.

Could explore an optional FastAPI middleware instead of (or in addition to) decorators for broader coverage.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions