Skip to content

test: Add comprehensive tests for PromoComment #50

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

Merged
merged 1 commit into from
Jun 21, 2025
Merged

Conversation

RandomProgramm3r
Copy link
Owner

This commit introduces a new test suite, PromoCommentsTestCase, to provide robust test coverage for the promo comments API endpoints.

Key functionality covered:

  • CRUD Operations: Full lifecycle testing for creating (POST), retrieving (GET list/detail), updating (PUT), and deleting (DELETE) comments.
  • Permissions: Verifies that users can only modify or delete their own comments (403 Forbidden).
  • Error Handling: Validates correct 404 Not Found responses for invalid requests, such as mismatched promo and comment IDs.
  • Data Integrity: Ensures the comment_count on the parent Promo object is correctly updated after comments are created or deleted.
  • Listing & Pagination: Confirms that comments are listed in reverse chronological order and that pagination headers (X-Total-Count) are accurate.

This commit introduces a new test suite, `PromoCommentsTestCase`, to provide robust test coverage for the promo comments API endpoints.

Key functionality covered:
- **CRUD Operations**: Full lifecycle testing for creating (POST), retrieving (GET list/detail), updating (PUT), and deleting (DELETE) comments.
- **Permissions**: Verifies that users can only modify or delete their own comments (403 Forbidden).
- **Error Handling**: Validates correct 404 Not Found responses for invalid requests, such as mismatched promo and comment IDs.
- **Data Integrity**: Ensures the `comment_count` on the parent Promo object is correctly updated after comments are created or deleted.
- **Listing & Pagination**: Confirms that comments are listed in reverse chronological order and that pagination headers (`X-Total-Count`) are accurate.
@RandomProgramm3r RandomProgramm3r merged commit 19f263b into main Jun 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant