def test_maximum_5_hobbies(self): Hobby(description='A').save() Hobby(description='B').save() Hobby(description='C').save() Hobby(description='D').save() Hobby(description='E').save() form = self.create_form(False, Hobby.objects.all()) self.assertTrue(form.is_valid()) Hobby(description='F').save() form = self.create_form(False, Hobby.objects.all()) self.assertFalse(form.is_valid())
def create_hobby_and_return(description): hobby = Hobby(description=description) hobby.save() return hobby
def create_hobby(description): Hobby(description=description).save()