* feat(tests): Add reusable workspace fixture
Introduces a new `workspace` fixture in `conftest.py` to provide a
consistent and reusable setup for tests that require a workspace.
* feat(tests): Add tests for project creation (POST)
This commit introduces a comprehensive test suite for the project creation API endpoint.
The suite covers a wide range of scenarios, including:
- Successful creation and verification of side-effects (default states, project members, user properties).
- Validation for invalid or missing data (400 Bad Request).
- Permission checks for different user roles (e.g., guests are forbidden).
- Authentication requirements (401 Unauthorized).
- Uniqueness constraints for project names and identifiers (409 Conflict).
- Successful creation with all optional fields populated.
It leverages the `workspace`, `session_client` and `create_user` fixtures for a consistent test setup.
* refactor(tests): Centralize project URL helper into a base class
To avoid code duplication in upcoming tests, this commit introduces a `TestProjectBase` class.
The `get_project_url` helper method is moved into this shared base class, and the existing `TestProjectAPIPost` class is updated to inherit from it. This ensures the URL generation logic is defined in a single place and preparing the suite for the upcoming GET tests.
* feat(tests): Add tests for project listing and retrieval (GET)
This commit adds a suite for the GET method. It leverages the previously created `TestProjectBase` class for URL generation.
The new test suite covers:
- Listing projects:
- Verifies that administrators see all projects.
- Confirms guests only see projects they are members of.
- Tests the separate detailed project list endpoint.
- Retrieving a single project:
- Checks for successful retrieval of a project by its ID.
- Handles edge cases for non-existent and archived projects (404 Not Found).
- Authentication:
- Ensures authentication is required (401 Unauthorized).
* feat(tests): Add tests for project update (PATCH) and deletion (DELETE)
Key scenarios tested for PATCH:
- Successful partial updates by project administrators.
- Forbidden access for non-admin members (403).
- Conflict errors for duplicate names or identifiers on update (409).
- Validation errors for invalid data (400).
Key scenarios tested for DELETE:
- Successful deletion by both project admins and workspace admins.
- Forbidden access for non-admin members (403).
- Authentication checks for unauthenticated users (401).
* Remove unnecessary print statement
* refactor(tests): Update workspace fixture to use ORM
Updates the `workspace` fixture to create the model instance directly via the ORM using the `Workspace` model instead of the API, as requested during code review.
* Refactor: Remove some unused imports
Removes imports that I added while working on the test suite for the Project API but were ultimately not used. Note that other unused imports still exist from the state of the codebase when this branch was created/forked.
* fix: removed t function from dependency array which was causing infinite loop
* fix: add eslint disable comment for exhaustive-deps warning in IssuePeekOverview
* feat: add IssueListDetailSerializer for detailed issue representation
- Introduced IssueListDetailSerializer to enhance issue data representation with expanded fields.
- Updated issue detail endpoint to utilize the new serializer for improved data handling.
- Added methods for retrieving related module, label, and assignee IDs, along with support for expanded relations.
* feat: add ViewIssueListSerializer and enhance issue ordering
- Introduced ViewIssueListSerializer for improved issue representation, including assignee, label, and module IDs.
- Updated WorkspaceViewIssuesViewSet to utilize the new serializer and optimized queryset with prefetching.
- Enhanced order_issue_queryset to maintain consistent ordering by created_at alongside other fields.
- Modified pagination logic to support total count retrieval for better performance.
* fix: optimize issue filtering and pagination logic
- Updated WorkspaceViewIssuesViewSet to apply filters more efficiently in the issue query.
- Refined pagination logic in OffsetPaginator to ensure consistent behavior using limit instead of cursor.value, improving overall pagination accuracy.
* fix: improve pagination logic in OffsetPaginator
- Updated the next_cursor calculation to use the length of results instead of cursor.value, ensuring accurate pagination behavior.
- Added a comment to clarify the purpose of checking for additional results after the current page.
* Move the common permission filters into a separate method
* fix: handle deleted related issues in serializers
- Updated IssueListDetailSerializer to skip null related issues when building relations.
- Enhanced ViewIssueListSerializer to safely access state.group, returning None if state is not present.
- Removed unused User import in base.py for cleaner code.
---------
Co-authored-by: Dheeraj Kumar Ketireddy <dheeru0198@gmail.com>