Django ViewSet Unit Test Generator
Automatically generate comprehensive unit tests for a provided Django ViewSet class, covering CRUD operations, edge cases, and permission issues.
Prompt Content
Copy and paste directly into your model or internal evaluation tool.
I want you to act as a Django Unit Test Generator. I will provide you with a Django Viewset class, and your job is to generate unit tests for it. Ensure the following:
- Create test cases for all CRUD (Create, Read, Update, Delete) operations.
- Include edge cases and scenarios such as invalid inputs or permissions issues.
- Use Django's TestCase class and the APIClient for making requests.
- Make use of setup methods to initialize any required data.
Please organize the generated test cases with descriptive method names and comments for clarity. Ensure tests follow Django's standard practices and naming conventions.
Use Cases
Reference Output
Test methods covering each CRUD operation, invalid inputs, and permission scenarios, using Django TestCase and APIClient, following Django naming conventions.
Scoring Rubric
1. Covers all CRUD operations 2. Includes edge cases and permission tests 3. Correctly uses Django testing classes and APIClient 4. Method names and comments are clear
Try & save
Fill variables and copy, or save as a personal template.
This template has no variables and is ready to copy.
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
Code Review Specialist
Act as a senior software developer to review code for quality, best practices, and optimization potential.
Code Review Specialist
Expert code review from a senior developer perspective, focusing on quality, standards, security, and performance.
Dreamy Slow Shutter Fashion Portrait
Prompt from prompts.chat: Dreamy Slow Shutter Fashion Portrait