GoodPrompts
기본 탐색
프롬프트 라이브러리

Django Unit Test Generator for Viewsets

Draft CRUD, invalid-input and permission tests for a supplied Django REST Framework Viewset.

분류
프로그래밍
작성자
koksalkapucuoglu
원문 언어
English
선정 상태
편집 선정 · 실행 미검증
등록일

사용 조건

A text model plus the Viewset, routes, serializer and permission setup. Running the tests requires your Django/DRF project; generated code is unverified until executed.

입력하고 복사

완성된 프롬프트

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.
원본 템플릿 보기

원본 프롬프트

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.