def test_create_ingredient_is_successful(self):
    'Test that creating a new ingredient is successful.'
    payload = {'name': 'Lemon'}
    self.client.post(INGREDIENTS_URL, payload)
    exists = Ingredient.objects.filter(user=self.user, name=payload['name']).exists()
    self.assertTrue(exists)
Test that creating a new ingredient is successful.
def test_create_ingredient_is_successful(self):
    
    payload = {'name': 'Lemon'}
    self.client.post(INGREDIENTS_URL, payload)
    exists = Ingredient.objects.filter(user=self.user, name=payload['name']).exists()
    self.assertTrue(exists)