def test_get_recipe(self):
    'Test retrieving a single recipe using name as filter'
    test_recipe_name = 'Beans on Toast'
    create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
    create_sample_recipe(name=test_recipe_name, description='Just the best recipe.')
    response = self.client.get(RECIPE_URL, {'name': test_recipe_name})
    recipes = Recipe.objects.all().order_by('-name')
    self.assertEqual(response.status_code, status.HTTP_200_OK)
    self.assertNotEqual(len(response.data), len(recipes))
    self.assertEqual(response.data[0]['name'], test_recipe_name)
Test retrieving a single recipe using name as filter
def test_get_recipe(self):
    
    test_recipe_name = 'Beans on Toast'
    create_sample_recipe(name='Roast Dinner', description='Roasted potatoes and chicken with vegetables and gravy.')
    create_sample_recipe(name=test_recipe_name, description='Just the best recipe.')
    response = self.client.get(RECIPE_URL, {'name': test_recipe_name})
    recipes = Recipe.objects.all().order_by('-name')
    self.assertEqual(response.status_code, status.HTTP_200_OK)
    self.assertNotEqual(len(response.data), len(recipes))
    self.assertEqual(response.data[0]['name'], test_recipe_name)