Я новичок в тестировании, пожалуйста, помогите и спасибо заранее
BackupRequestmodel
class BackupRequest(models.Model):
request_no = models.ForeignKey(AllRequest, on_delete=models.CASCADE)
requirement = models.CharField(max_length=49)
backup_type = models.CharField(max_length=49)
purpose = models.CharField(max_length=150, null=False)
department = models.ForeignKey(Department, on_delete=models.CASCADE)
location = models.ForeignKey(Location, on_delete=models.CASCADE)
def __str__(self):
return self.request_no.__str__()
Как написать модульный тест для этой модели, зависимые модели приведены ниже
AllRequestModel
class AllRequest(models.Model):
form_type = models.ForeignKey(RequestType, related_name='requests', default=None,
on_delete=models.CASCADE)
request_no = models.AutoField(max_length=50, default=None, primary_key=True, )
status = models.IntegerField(default=0)
requested_by = models.CharField(max_length=50, blank=False, default='')
requested_on = models.DateTimeField(auto_now_add=True, editable=False)
updated_by = models.CharField(max_length=50, blank=False, default='')
updated_on = models.DateTimeField(auto_now_add=True, editable=True)
def __str__(self):
return str(self.request_no)
RequestTypeModel
class RequestType(models.Model):
name = models.CharField(max_length=150)