Skip to content

Commit

Permalink
adding a test for filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanNoelk committed Apr 6, 2018
1 parent ff0bb04 commit d11987b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion v1/recipe/tests/test_read_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RecipeSerializerTests(TestCase):
def setUp(self):
self.factory = APIRequestFactory()

def test_view(self):
def test_retrieve_view(self):
"""Try and read the view of a recipe"""
view = views.RecipeViewSet.as_view({'get': 'retrieve'})
request = self.factory.get('/api/v1/recipe/recipes/tasty-chili')
Expand All @@ -30,6 +30,14 @@ def test_view(self):
self.assertTrue(response.data.get('prep_time') == 60)
self.assertTrue(response.data.get('servings') == 8)

def test_list_view(self):
"""Try and read the view of a recipe"""
view = views.RecipeViewSet.as_view({'get': 'list'})
request = self.factory.get('/api/v1/recipe/recipes/tasty-chili?course=entry&cuisine=american&rating=3')
response = view(request)

self.assertEqual(len(response.data.get('results')), 31)

def test_mini_browse(self):
"""Try and read the view of a recipe"""
view = views.MiniBrowseViewSet.as_view({'get': 'list'})
Expand Down

0 comments on commit d11987b

Please sign in to comment.