Exemple #1
0
    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())
Exemple #2
0
def create_hobby_and_return(description):
    hobby = Hobby(description=description)
    hobby.save()
    return hobby
Exemple #3
0
def create_hobby(description):
    Hobby(description=description).save()