Merge branch 'develop' into feature/keywords-rework

# Conflicts:
#	cookbook/static/vue/js/chunk-vendors.js
#	cookbook/static/vue/js/import_response_view.js
#	cookbook/static/vue/js/offline_view.js
#	cookbook/static/vue/js/recipe_search_view.js
#	cookbook/static/vue/js/recipe_view.js
#	cookbook/static/vue/js/supermarket_view.js
#	cookbook/static/vue/js/user_file_view.js
#	cookbook/templates/sw.js
#	cookbook/views/views.py
#	vue/src/components/RecipeCard.vue
#	vue/src/locales/en.json
This commit is contained in:
vabene1111
2021-06-30 14:57:33 +02:00
115 changed files with 14137 additions and 5122 deletions

View File

@@ -1,10 +1,11 @@
import json
import pytest
from django.db.models import Subquery, OuterRef
from django.urls import reverse
from django_scopes import scopes_disabled
from cookbook.models import Ingredient
from cookbook.models import Ingredient, Step
LIST_URL = 'api:ingredient-list'
DETAIL_URL = 'api:ingredient-detail'
@@ -28,6 +29,8 @@ def test_list_space(recipe_1_s1, u1_s1, u1_s2, space_2):
with scopes_disabled():
recipe_1_s1.space = space_2
recipe_1_s1.save()
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

View File

@@ -1,10 +1,11 @@
import json
import pytest
from django.db.models import Subquery, OuterRef
from django.urls import reverse
from django_scopes import scopes_disabled
from cookbook.models import Step
from cookbook.models import Step, Ingredient
LIST_URL = 'api:step-list'
DETAIL_URL = 'api:step-detail'
@@ -28,6 +29,8 @@ def test_list_space(recipe_1_s1, u1_s1, u1_s2, space_2):
with scopes_disabled():
recipe_1_s1.space = space_2
recipe_1_s1.save()
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)) == 2