Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the first set of API tests for the BERtron FastAPI application, adding test infrastructure to validate endpoint responses. The changes include setting up a test client, implementing basic endpoint tests, and fixing a type inconsistency in the FastAPI version parameter.
- Adds test infrastructure with FastAPI TestClient and pytest fixtures
- Implements tests for root redirect and version endpoint response validation
- Fixes type consistency by ensuring version parameter is explicitly a string
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/test_server.py | New test file with API endpoint tests using FastAPI TestClient |
| src/server.py | Fixes version parameter type by adding explicit string formatting |
| src/models.py | Adds strict validation configuration to prevent extra fields in responses |
| src/README.md | Updates documentation to include tests directory |
| pyproject.toml | Adds httpx dependency required for FastAPI TestClient |
Comments suppressed due to low confidence (1)
src/tests/test_server.py:18
- [nitpick] The variable name
test_clientinside the fixture function shadows the fixture name itself. Consider renaming the variable toclientorapi_clientfor clarity.
test_client = TestClient(app)
jeff-cohere
approved these changes
Jul 19, 2025
Collaborator
jeff-cohere
left a comment
There was a problem hiding this comment.
Looks great. Thanks @eecavanna !
Collaborator
Author
|
Thanks, @jeff-cohere! Merging. |
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.
On this branch, I added the first few tests that hit the BERtron API.
I also fixed a type inconsistency, where—as far as our type hints indicate—we could have passed a non-string value to a parameter (i.e. the
versionparameter of theFastAPIfunction) designed to be passed a string.I also introduced
httpxas a development dependency. It is a dependency of FastAPI'sTestClientclass.I did not include any tests that involve the MongoDB server. I think that will happen alongside #53, separately from this.