From 69a23f34b41e5a7ef02b7fb260764398cd957aea Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 23 Apr 2022 18:54:23 +0200 Subject: [PATCH] updated tests ingredient pagination --- cookbook/tests/api/test_api_ingredient.py | 8 ++++---- cookbook/tests/api/test_api_shopping_recipe.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cookbook/tests/api/test_api_ingredient.py b/cookbook/tests/api/test_api_ingredient.py index cde3d65a9..c3182b1e2 100644 --- a/cookbook/tests/api/test_api_ingredient.py +++ b/cookbook/tests/api/test_api_ingredient.py @@ -23,8 +23,8 @@ def test_list_permission(arg, request): def test_list_space(recipe_1_s1, u1_s1, u1_s2, space_2): - assert len(json.loads(u1_s1.get(reverse(LIST_URL)).content)) == 10 - assert len(json.loads(u1_s2.get(reverse(LIST_URL)).content)) == 0 + assert len(json.loads(u1_s1.get(reverse(LIST_URL)).content)['results']) == 10 + assert len(json.loads(u1_s2.get(reverse(LIST_URL)).content)['results']) == 0 with scopes_disabled(): recipe_1_s1.space = space_2 @@ -32,8 +32,8 @@ def test_list_space(recipe_1_s1, u1_s1, u1_s2, space_2): Step.objects.update(space=Subquery(Step.objects.filter(pk=OuterRef('pk')).values('recipe__space')[:1])) Ingredient.objects.update(space=Subquery(Ingredient.objects.filter(pk=OuterRef('pk')).values('step__recipe__space')[:1])) - assert len(json.loads(u1_s1.get(reverse(LIST_URL)).content)) == 0 - assert len(json.loads(u1_s2.get(reverse(LIST_URL)).content)) == 10 + assert len(json.loads(u1_s1.get(reverse(LIST_URL)).content)['results']) == 0 + assert len(json.loads(u1_s2.get(reverse(LIST_URL)).content)['results']) == 10 @pytest.mark.parametrize("arg", [ diff --git a/cookbook/tests/api/test_api_shopping_recipe.py b/cookbook/tests/api/test_api_shopping_recipe.py index 9732250d5..bbf3cb8fb 100644 --- a/cookbook/tests/api/test_api_shopping_recipe.py +++ b/cookbook/tests/api/test_api_shopping_recipe.py @@ -230,4 +230,4 @@ def test_shopping_with_header_ingredient(u1_s1, recipe): # recipe.step_set.first().ingredient_set.add(IngredientFactory(ingredients__header=1)) u1_s1.put(reverse(SHOPPING_RECIPE_URL, args={recipe.id})) assert len(json.loads(u1_s1.get(reverse(SHOPPING_LIST_URL)).content)) == 10 - assert len(json.loads(u1_s1.get(reverse('api:ingredient-list')).content)) == 11 + assert len(json.loads(u1_s1.get(reverse('api:ingredient-list')).content)['results']) == 11