Beispiel #1
0
    def test_updating_surname_validation_throw(self):
        director = Director(name='steven', surname='spilberg')
        director.full_clean()
        director.save()

        director.surname = 'a' * 41
        with self.assertRaises(ValidationError):
            director.full_clean()
Beispiel #2
0
    def test_updating_surname_no_error_throw(self):
        director = Director(name='ennio', surname='spilberg')
        director.full_clean()
        director.save()

        director.surname = 'McDoe'
        director.save()
        director.full_clean()
        director.refresh_from_db()

        self.assertEqual(Director.objects.count(), 1)
        self.assertEqual(1, director.id)
        self.assertEqual('ennio', director.name)
        self.assertEqual('McDoe', director.surname)