-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Fix Respect
can_read_model
permission in DjangoModelPermiss…
- Loading branch information
1 parent
a4d5807
commit 18da27e
Showing
3 changed files
with
5 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,8 +80,7 @@ def setUp(self): | |
user.user_permissions.set([ | ||
Permission.objects.get(codename='add_basicmodel'), | ||
Permission.objects.get(codename='change_basicmodel'), | ||
Permission.objects.get(codename='delete_basicmodel'), | ||
Permission.objects.get(codename='view_basicmodel') | ||
Permission.objects.get(codename='delete_basicmodel') | ||
]) | ||
|
||
user = User.objects.create_user('updateonly', '[email protected]', 'password') | ||
|
@@ -140,15 +139,6 @@ def test_get_queryset_has_create_permissions(self): | |
response = get_queryset_list_view(request, pk=1) | ||
self.assertEqual(response.status_code, status.HTTP_201_CREATED) | ||
|
||
def test_has_get_permissions(self): | ||
request = factory.get('/', HTTP_AUTHORIZATION=self.permitted_credentials) | ||
response = root_view(request) | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
||
request = factory.get('/1', HTTP_AUTHORIZATION=self.updateonly_credentials) | ||
response = root_view(request, pk=1) | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
||
def test_has_put_permissions(self): | ||
request = factory.put('/1', {'text': 'foobar'}, format='json', | ||
HTTP_AUTHORIZATION=self.permitted_credentials) | ||
|
@@ -166,15 +156,6 @@ def test_does_not_have_create_permissions(self): | |
response = root_view(request, pk=1) | ||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
|
||
def test_does_not_have_get_permissions(self): | ||
request = factory.get('/', HTTP_AUTHORIZATION=self.disallowed_credentials) | ||
response = root_view(request) | ||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
|
||
request = factory.get('/1', HTTP_AUTHORIZATION=self.disallowed_credentials) | ||
response = root_view(request, pk=1) | ||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
|
||
def test_does_not_have_put_permissions(self): | ||
request = factory.put('/1', {'text': 'foobar'}, format='json', | ||
HTTP_AUTHORIZATION=self.disallowed_credentials) | ||
|