[WEB-4558] fix: project test cases#7464
Conversation
WalkthroughThe test cases for project creation and update scenarios were modified to expect HTTP 400 Bad Request status codes instead of HTTP 409 Conflict when encountering duplicate project names or identifiers. No other logic or structural changes were made to the tests. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/api/plane/tests/contract/app/test_project_app.py (2)
477-496: Ensure consistency in duplicate handling for PATCH operations.The test comment mentions "returns conflict" but now expects HTTP 400. This indicates either the comment needs updating or there's a mismatch between expected behavior and implementation.
Consider updating the test method docstring to reflect the actual expected behavior:
- """Test updating project with duplicate name returns conflict""" + """Test updating project with duplicate name returns bad request"""
499-518: Ensure consistency in duplicate handling for PATCH operations.Similar to the previous test, the docstring mentions "returns conflict" but expects HTTP 400.
Update the test method docstring for consistency:
- """Test updating project with duplicate identifier returns conflict""" + """Test updating project with duplicate identifier returns bad request"""
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/api/plane/tests/contract/app/test_project_app.py(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: NarayanBavisetti
PR: makeplane/plane#7460
File: apps/api/plane/app/serializers/draft.py:112-122
Timestamp: 2025-07-23T18:18:06.849Z
Learning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.
🔇 Additional comments (3)
apps/api/plane/tests/contract/app/test_project_app.py (3)
187-203: Verify the semantic correctness of HTTP 400 for duplicate identifier conflicts.Similar to the duplicate name scenario, this test now expects HTTP 400 Bad Request instead of HTTP 409 Conflict for duplicate project identifiers. This change should be consistent with the actual API behavior.
184-184: Duplicate validation consistently returns HTTP 400 Bad RequestConfirmed that in the project serializers both name and identifier duplicate checks raise
serializers.ValidationError, and in all create/partial-update endpoints (apps/api/plane/app/views/project/base.py) duplicate errors flow through toResponse(..., status=HTTP_400_BAD_REQUEST). The tests expecting HTTP 400 for both creation and update, and for both name and identifier conflicts, accurately reflect the implementation.
167-184: Duplicate validation tests correctly expect HTTP 400The
validate_nameandvalidate_identifiermethods in apps/api/plane/app/serializers/project.py raise aserializers.ValidationErrorwhen a duplicate is detected. By default, DRF translates these validation errors into HTTP 400 responses. The updated tests now align with the actual behavior of the API, so no further changes are needed.
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
Description
This PR will fix the failing test cases of the project endpoints.
Type of Change
Summary by CodeRabbit