recipe api test

This commit is contained in:
vabene1111
2021-03-17 20:53:12 +01:00
parent ab3f7bf671
commit e41464cb31
3 changed files with 104 additions and 31 deletions

View File

@ -1,31 +0,0 @@
from cookbook.models import Recipe
from cookbook.tests.views.test_views import TestViews
from django.contrib import auth
from django.urls import reverse
class TestApiShopping(TestViews):
def setUp(self):
super(TestApiShopping, self).setUp()
self.internal_recipe = Recipe.objects.create(
name='Test',
internal=True,
created_by=auth.get_user(self.user_client_1)
)
def test_shopping_view_permissions(self):
self.batch_requests(
[
(self.anonymous_client, 403),
(self.guest_client_1, 200),
(self.user_client_1, 200),
(self.user_client_2, 200),
(self.admin_client_1, 200),
(self.superuser_client, 200)
],
reverse(
'api:recipe-detail', args={self.internal_recipe.id})
)
# TODO add tests for editing