Add CI test workflow and schema-aligned test mocks#58
Add CI test workflow and schema-aligned test mocks#58devin-ai-integration[bot] wants to merge 21 commits intomainfrom
Conversation
- Add GitHub Actions workflow for running tests and linting - Create comprehensive test suite with schema-aligned mocks - Add authentication tests for JWT validation - Update endpoint paths to match OpenAPI schema - Add tests for optional parameters and error cases
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
Pull Request Feedback 🔍
|
| def test_create_jwt(sample_payload, sample_secret): | ||
| """Test JWT creation.""" | ||
| token = create_jwt(sample_payload, sample_secret) | ||
|
|
||
| # Verify token structure | ||
| assert isinstance(token, str) | ||
| assert len(token.split(".")) == 3 | ||
|
|
||
| # Verify token can be decoded | ||
| decoded = jwt.decode(token, sample_secret, algorithms=["HS256"]) | ||
| assert decoded["sub"] == sample_payload["sub"] | ||
| assert decoded["exp"] == sample_payload["exp"] |
There was a problem hiding this comment.
Suggestion: Consider adding tests for edge cases such as payloads with special characters or very large payloads to ensure the create_jwt function handles them correctly. [enhancement]
| def test_create_jwt(sample_payload, sample_secret): | |
| """Test JWT creation.""" | |
| token = create_jwt(sample_payload, sample_secret) | |
| # Verify token structure | |
| assert isinstance(token, str) | |
| assert len(token.split(".")) == 3 | |
| # Verify token can be decoded | |
| decoded = jwt.decode(token, sample_secret, algorithms=["HS256"]) | |
| assert decoded["sub"] == sample_payload["sub"] | |
| assert decoded["exp"] == sample_payload["exp"] | |
| def test_create_jwt(sample_payload, sample_secret): | |
| """Test JWT creation.""" | |
| token = create_jwt(sample_payload, sample_secret) | |
| # Verify token structure | |
| assert isinstance(token, str) | |
| assert len(token.split(".")) == 3 | |
| # Verify token can be decoded | |
| decoded = jwt.decode(token, sample_secret, algorithms=["HS256"]) | |
| assert decoded["sub"] == sample_payload["sub"] | |
| assert decoded["exp"] == sample_payload["exp"] | |
| # Test with special characters in payload | |
| special_payload = {"sub": "user!@#$%^&*()"} | |
| token = create_jwt(special_payload, sample_secret) | |
| decoded = jwt.decode(token, sample_secret, algorithms=["HS256"]) | |
| assert decoded["sub"] == special_payload["sub"] | |
| # Test with large payload | |
| large_payload = {"sub": "user" * 1000} | |
| token = create_jwt(large_payload, sample_secret) | |
| decoded = jwt.decode(token, sample_secret, algorithms=["HS256"]) | |
| assert decoded["sub"] == large_payload["sub"] |
…itive comparisons
|
Closing due to inactivity. |
Link to Devin run: https://app.devin.ai/sessions/872e7bbcb3ef4b01adc6fe5e7fc5e269
This PR introduces a GitHub Actions workflow for running tests and linting, and updates our existing test mocks to match the OpenAPI schema.
Changes:
The test mocks have been carefully aligned with the OpenAPI schema requirements, ensuring all required fields are present and response formats are correct. The workflow will run on all PRs to main branch.