def test_partial_update_recipe(self):
    'Test updating a recipe with patch'
    recipe = sample_recipe(user=self.user)
    recipe.tags.add(sample_tag(user=self.user))
    new_tag = sample_tag(user=self.user, name='Curry')
    payload = {'title': 'Chicken tikka', 'tags': [new_tag.id]}
    url = detail_url(recipe.id)
    self.client.patch(url, payload)
    recipe.refresh_from_db()
    self.assertEqual(recipe.title, payload['title'])
    tags = recipe.tags.all()
    self.assertEqual(len(tags), 1)
    self.assertIn(new_tag, tags)
Test updating a recipe with patch
def test_partial_update_recipe(self):
    
    recipe = sample_recipe(user=self.user)
    recipe.tags.add(sample_tag(user=self.user))
    new_tag = sample_tag(user=self.user, name='Curry')
    payload = {'title': 'Chicken tikka', 'tags': [new_tag.id]}
    url = detail_url(recipe.id)
    self.client.patch(url, payload)
    recipe.refresh_from_db()
    self.assertEqual(recipe.title, payload['title'])
    tags = recipe.tags.all()
    self.assertEqual(len(tags), 1)
    self.assertIn(new_tag, tags)