def test_updating_name_validation_throw(self): director = Director(name='steven', surname='spilberg') director.full_clean() director.save() director.name = 'a' * 21 with self.assertRaises(ValidationError): director.full_clean()
def test_updating_name_no_error_throw(self): director = Director(name='ennio', surname='spilberg') director.full_clean() director.save() created_date_src = director.created director.name = 'steven' director.save() director.full_clean() director.refresh_from_db() created_date_dest = director.created self.assertEqual(Director.objects.count(), 1) self.assertEqual(1, director.id) self.assertEqual('steven', director.name) self.assertEqual('spilberg', director.surname) self.assertEqual(created_date_dest, created_date_src)