-
Notifications
You must be signed in to change notification settings - Fork 1
Add CI test workflow and schema-aligned test mocks #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.