Content description:
In this post I'll describe how to test a ModelViewSet based on the created Contract model.
I'll test the methods: GET, POST, PATCH and DELETE.
I'll check the correctness of the validators and permissions.
I create a Contract model.
The model consists of fields:
- contract status (default: open),
- contract number set by the customer,
- contractor who is to perform the order,
- planned delivery date and time,
- warehouse to which the goods are to be delivered.
The delivery date contains a validator - it cannot be earlier than the order date.