文本Django Viewset 测试生成器
提示词主题封面

文本

Django Viewset 测试生成器

为 Django Viewset 生成覆盖 CRUD、边界情况和权限问题的单元测试,并遵循 Django 常用规范。

Prompt

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:

1. Create test cases for all CRUD (Create, Read, Update, Delete) operations.
2. Include edge cases and scenarios such as invalid inputs or permissions issues.
3. Use Django's TestCase class and the APIClient for making requests.
4. 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.

使用建议

提供一个 Viewset 类,让模型据此生成测试用例。

信息

类型
文本
许可
CC0-1.0

反馈这条内容