Skip to content

Enhance router initialization logging#98

Merged
javidahmed64592 merged 1 commit into
mainfrom
update-tests
May 9, 2026
Merged

Enhance router initialization logging#98
javidahmed64592 merged 1 commit into
mainfrom
update-tests

Conversation

@javidahmed64592
Copy link
Copy Markdown
Owner

This pull request focuses on improving the testability and reliability of the TemplateServer by refactoring test fixtures and enhancing dependency injection for the router and limiter components. The changes ensure that tests use mock instances for dependencies, making tests more isolated and maintainable.

Test infrastructure improvements:

  • Refactored the mock_template_server_router fixture in tests/conftest.py to accept a mock Limiter instance, and introduced a new mock_limiter fixture to provide this mock, allowing for more flexible and isolated testing of rate limiting logic.
  • Updated the mock_template_server fixture in tests/test_template_server.py to patch TemplateServerRouter with the mock router fixture, ensuring that tests use the mock router instead of the real implementation.
  • Modified the test_init method in TestTemplateServer to verify that all routes from the mock router are included in the FastAPI app, improving the accuracy of route registration tests.
  • Added an import for TemplateServerRouter in tests/test_template_server.py to support the updated fixtures and tests.

Minor logging improvement:

  • Updated the router initialization log message in BaseRouter to display '/' when the prefix is empty or None, improving log clarity.

@javidahmed64592 javidahmed64592 merged commit 8f19d80 into main May 9, 2026
16 checks passed
@javidahmed64592 javidahmed64592 deleted the update-tests branch May 9, 2026 23:19
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.

1 participant