def test_view_recipe_detail(self):
    'Test viewing a recipe details'
    recipe = sample_recipe(user=self.user)
    recipe.tags.add(sample_tag(user=self.user))
    recipe.ingredients.add(sample_ingredient(user=self.user))
    url = detail_url(recipe.id)
    res = self.client.get(url)
    serializer = RecipeDetailSerializer(recipe)
    self.assertEqual(res.status_code, status.HTTP_200_OK)
    self.assertEqual(res.data, serializer.data)
Test viewing a recipe details
def test_view_recipe_detail(self):
    
    recipe = sample_recipe(user=self.user)
    recipe.tags.add(sample_tag(user=self.user))
    recipe.ingredients.add(sample_ingredient(user=self.user))
    url = detail_url(recipe.id)
    res = self.client.get(url)
    serializer = RecipeDetailSerializer(recipe)
    self.assertEqual(res.status_code, status.HTTP_200_OK)
    self.assertEqual(res.data, serializer.data)