def test_get_recipes(self):
    'Test retrieving a recipe'
    create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
    create_sample_recipe(name='Beans on Toast', description='Just the best.')
    response = self.client.get(RECIPE_URL)
    recipes = Recipe.objects.all().order_by('-name')
    self.assertEqual(response.status_code, status.HTTP_200_OK)
    self.assertEqual(len(response.data), len(recipes))
Test retrieving a recipe
def test_get_recipes(self):
    
    create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
    create_sample_recipe(name='Beans on Toast', description='Just the best.')
    response = self.client.get(RECIPE_URL)
    recipes = Recipe.objects.all().order_by('-name')
    self.assertEqual(response.status_code, status.HTTP_200_OK)
    self.assertEqual(len(response.data), len(recipes))