diff --git a/cookbook/tests/edits/test_edits_recipe.py b/cookbook/tests/edits/test_edits_recipe.py index 3cf8b3805..6c014e79b 100644 --- a/cookbook/tests/edits/test_edits_recipe.py +++ b/cookbook/tests/edits/test_edits_recipe.py @@ -14,6 +14,7 @@ def test_switch_recipe(u1_s1, recipe_1_s1, space_1): url = reverse('edit_recipe', args=[recipe_1_s1.pk]) r = u1_s1.get(url) + print(r) assert r.status_code == 302 r = u1_s1.get(r.url) diff --git a/cookbook/tests/other/test_url_import.py b/cookbook/tests/other/test_url_import.py index d9d7b1307..0fe0aea07 100644 --- a/cookbook/tests/other/test_url_import.py +++ b/cookbook/tests/other/test_url_import.py @@ -55,7 +55,10 @@ def test_import_permission(arg, request): ]) def test_recipe_import(arg, u1_s1): for f in arg['file']: - test_file = os.path.join(os.getcwd(), 'cookbook', 'tests', 'other', 'test_data', f) + if 'cookbook' in os.getcwd(): + test_file = os.path.join(os.getcwd(), 'other', 'test_data', f) + else: + test_file = os.path.join(os.getcwd(), 'cookbook', 'tests', 'other', 'test_data', f) with open(test_file, 'r', encoding='UTF-8') as d: response = u1_s1.post( reverse(IMPORT_SOURCE_URL), diff --git a/cookbook/views/edit.py b/cookbook/views/edit.py index cc82cecc5..4ce7358a1 100644 --- a/cookbook/views/edit.py +++ b/cookbook/views/edit.py @@ -45,11 +45,11 @@ def convert_recipe(request, pk): @group_required('user') def internal_recipe_update(request, pk): - if Recipe.objects.filter(space=request.space).count() > request.space.max_recipes: + if request.space.max_recipes != 0 and Recipe.objects.filter(space=request.space).count() > request.space.max_recipes: messages.add_message(request, messages.WARNING, _('You have reached the maximum number of recipes for your space.')) return HttpResponseRedirect(reverse('view_recipe', args=[pk])) - if UserPreference.objects.filter(space=request.space).count() > request.space.max_users: + if request.space.max_users != 0 and UserPreference.objects.filter(space=request.space).count() > request.space.max_users: messages.add_message(request, messages.WARNING, _('You have more users than allowed in your space.')) return HttpResponseRedirect(reverse('view_recipe', args=[pk]))