test: add unit test suite for backend API endpoints (#63)#64
Open
SandeepChauhan00 wants to merge 1 commit intoINCF:mainfrom
Open
test: add unit test suite for backend API endpoints (#63)#64SandeepChauhan00 wants to merge 1 commit intoINCF:mainfrom
SandeepChauhan00 wants to merge 1 commit intoINCF:mainfrom
Conversation
Author
|
PR submitted: #64 28 tests covering all backend endpoints — all passing on Python 3.14. Heavy dependencies are mocked so tests run instantly without GPU or cloud credentials. |
This was referenced Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the first unit test suite for the backend API, covering all existing endpoints with 28 tests. This establishes the testing foundation for the project.
Closes #63
What's Added
backend/tests/__init__.py— test package markerbackend/tests/conftest.py— shared fixtures with mocked heavy dependencies (torch, vertexai, google-cloud, sentence-transformers) so tests run fast without GPU or cloud credentialsbackend/tests/test_health.py— 15 tests covering/,/health, and/api/healthbackend/tests/test_query.py— 13 tests covering/api/chat,/api/session/reset, and unknown routespyproject.tomlwith[tool.pytest.ini_options]configurationTest Results
All 28 tests pass on Python 3.14:
backend/tests/test_health.py::TestRootEndpoint::test_root_returns_200 PASSED
backend/tests/test_health.py::TestRootEndpoint::test_root_contains_message PASSED
backend/tests/test_health.py::TestRootEndpoint::test_root_contains_version PASSED
backend/tests/test_health.py::TestHealthEndpoint::test_health_returns_200 PASSED
backend/tests/test_health.py::TestHealthEndpoint::test_health_status_is_healthy PASSED
backend/tests/test_health.py::TestHealthEndpoint::test_health_contains_timestamp PASSED
backend/tests/test_health.py::TestHealthEndpoint::test_health_contains_service_name PASSED
backend/tests/test_health.py::TestHealthEndpoint::test_health_contains_version PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_returns_200 PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_status_is_healthy PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_contains_components PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_components_have_expected_keys PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_keyword_search_always_enabled PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_contains_timestamp PASSED
backend/tests/test_health.py::TestApiHealthEndpoint::test_api_health_contains_version PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_endpoint_exists PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_returns_response_field PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_returns_metadata PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_metadata_contains_process_time PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_metadata_contains_session_id PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_with_custom_session_id PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_missing_query_returns_422 PASSED
backend/tests/test_query.py::TestChatEndpoint::test_chat_get_method_not_allowed PASSED
backend/tests/test_query.py::TestSessionResetEndpoint::test_reset_endpoint_exists PASSED
backend/tests/test_query.py::TestSessionResetEndpoint::test_reset_returns_ok_status PASSED
backend/tests/test_query.py::TestSessionResetEndpoint::test_reset_returns_session_id PASSED
backend/tests/test_query.py::TestUnknownRoutes::test_unknown_route_returns_404 PASSED
backend/tests/test_query.py::TestUnknownRoutes::test_unknown_api_route_returns_404 PASSED
28 passed, 18 warnings in 0.62s
Endpoint Coverage
GET /GET /healthGET /api/healthPOST /api/chatPOST /api/session/resetHow to Run