def test_deleting_existing_director_should_remove_movie(self): director = Director(name='steven', surname='spilberg') director.save() movie = Movie(title='IT Crowd', director=Director.objects.get(pk=1)) movie.save() director.delete() self.assertEqual(0, Director.objects.count()) self.assertEqual(0, Movie.objects.count())
def test_deleting_none_existing_director_should_error_throw(self): director = Director(name='steven', surname='spilberg') with self.assertRaises(AssertionError): director.delete()
def test_deleting_existing_director_should_pass(self): director = Director(name='steven', surname='spilberg') director.save() director.delete() self.assertEqual(0, Director.objects.count())