def test_delete_recipe_with_ingredients(self):
    'Test deleting a recipe with ingredients included'
    self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
    Ingredient.objects.create(name='Carrots', recipe=self.recipe)
    Ingredient.objects.create(name='Icing Sugar', recipe=self.recipe)
    response = self.client.delete(recipe_url(self.recipe.id), format='json')
    ingredients = Ingredient.objects.all()
    self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
    self.assertFalse(Recipe.objects.all())
    self.assertFalse(len(ingredients), 0)
Test deleting a recipe with ingredients included
def test_delete_recipe_with_ingredients(self):
    
    self.recipe = create_sample_recipe(name='Carrot Cake', description='Sponge cake with hella carrots.')
    Ingredient.objects.create(name='Carrots', recipe=self.recipe)
    Ingredient.objects.create(name='Icing Sugar', recipe=self.recipe)
    response = self.client.delete(recipe_url(self.recipe.id), format='json')
    ingredients = Ingredient.objects.all()
    self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
    self.assertFalse(Recipe.objects.all())
    self.assertFalse(len(ingredients), 0)