I have the following models:
class Course(Base):
title = models.CharField('Título', max_length=200)
subcategory = models.ForeignKey(SubCategory, on_delete=models.CASCADE)
def get_category(self):
return self.subcategory.category
class SubCategory(Base):
title = models.CharField('Título', max_length=80)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
class Category(Base):
title = models.CharField('Título', max_length=80)
How can I test the get_category method?
I'm trying to do that but the test don't pass on coverage report.
Aucun commentaire:
Enregistrer un commentaire