Example #1
0
 def test_too_long_surname_should_throw_error(self):
     director = Director(name='steven', surname='a' * 41)
     with self.assertRaises(ValidationError):
         director.full_clean()
Example #2
0
 def test_too_long_name_should_throw_error(self):
     director = Director(name='a' * 21, surname='spilberg')
     with self.assertRaises(ValidationError):
         director.full_clean()
Example #3
0
    def test_deleting_none_existing_director_should_error_throw(self):
        director = Director(name='steven', surname='spilberg')

        with self.assertRaises(AssertionError):
            director.delete()
Example #4
0
 def test_empty_surname_should_throw_error(self):
     director = Director(name='ennio')
     with self.assertRaises(ValidationError):
         director.full_clean()
Example #5
0
    def test_deleting_existing_director_should_pass(self):
        director = Director(name='steven', surname='spilberg')
        director.save()

        director.delete()
        self.assertEqual(0, Director.objects.count())