Exemple #1
0
    def test_updating_surname_validation_throw(self):
        actor = Actor(name='jane', surname='doe')
        actor.full_clean()
        actor.save()

        actor.surname = 'a' * 41
        with self.assertRaises(ValidationError):
            actor.full_clean()
Exemple #2
0
    def test_updating_surname_none_should_validation_error_throw(self):
        actor = Actor(name='jane', surname='doe')
        actor.full_clean()
        actor.save()

        actor.surname = None
        with self.assertRaises(ValidationError):
            actor.full_clean()
Exemple #3
0
    def test_updating_surname_no_error_throw(self):
        actor = Actor(name='john', surname='doe')
        actor.full_clean()
        actor.save()

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

        self.assertEqual(Actor.objects.count(), 1)
        self.assertEqual(1, actor.id)
        self.assertEqual('john', actor.name)
        self.assertEqual('McDoe', actor.surname)