mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Update linter requirements (#7010)
This commit is contained in:
parent
65ed7be754
commit
a8c86be660
|
@ -1,7 +1,7 @@
|
||||||
# PEP8 code linting, which we run on all commits.
|
# PEP8 code linting, which we run on all commits.
|
||||||
flake8==3.5.0
|
flake8==3.7.8
|
||||||
flake8-tidy-imports==1.1.0
|
flake8-tidy-imports==3.0.0
|
||||||
pycodestyle==2.3.1
|
pycodestyle==2.5.0
|
||||||
|
|
||||||
# Sort and lint imports
|
# Sort and lint imports
|
||||||
isort==4.3.3
|
isort==4.3.21
|
||||||
|
|
|
@ -23,8 +23,8 @@ Other access should target the submodules directly
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
|
||||||
from . import coreapi, openapi
|
from . import coreapi, openapi
|
||||||
from .inspectors import DefaultSchema # noqa
|
|
||||||
from .coreapi import AutoSchema, ManualSchema, SchemaGenerator # noqa
|
from .coreapi import AutoSchema, ManualSchema, SchemaGenerator # noqa
|
||||||
|
from .inspectors import DefaultSchema # noqa
|
||||||
|
|
||||||
|
|
||||||
def get_schema_view(
|
def get_schema_view(
|
||||||
|
|
|
@ -6,7 +6,7 @@ addopts=--tb=short --strict -ra
|
||||||
testspath = tests
|
testspath = tests
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E501
|
ignore = E501,W504
|
||||||
banned-modules = json = use from rest_framework.utils import json!
|
banned-modules = json = use from rest_framework.utils import json!
|
||||||
|
|
||||||
[isort]
|
[isort]
|
||||||
|
|
|
@ -24,8 +24,8 @@ from rest_framework.utils import formatting
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||||
|
|
||||||
from . import views
|
|
||||||
from ..models import BasicModel, ForeignKeySource, ManyToManySource
|
from ..models import BasicModel, ForeignKeySource, ManyToManySource
|
||||||
|
from . import views
|
||||||
|
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -494,28 +494,28 @@ class CustomPermissionsTests(TestCase):
|
||||||
self.custom_message = 'Custom: You cannot access this resource'
|
self.custom_message = 'Custom: You cannot access this resource'
|
||||||
|
|
||||||
def test_permission_denied(self):
|
def test_permission_denied(self):
|
||||||
response = denied_view(self.request, pk=1)
|
response = denied_view(self.request, pk=1)
|
||||||
detail = response.data.get('detail')
|
detail = response.data.get('detail')
|
||||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||||
self.assertNotEqual(detail, self.custom_message)
|
self.assertNotEqual(detail, self.custom_message)
|
||||||
|
|
||||||
def test_permission_denied_with_custom_detail(self):
|
def test_permission_denied_with_custom_detail(self):
|
||||||
response = denied_view_with_detail(self.request, pk=1)
|
response = denied_view_with_detail(self.request, pk=1)
|
||||||
detail = response.data.get('detail')
|
detail = response.data.get('detail')
|
||||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||||
self.assertEqual(detail, self.custom_message)
|
self.assertEqual(detail, self.custom_message)
|
||||||
|
|
||||||
def test_permission_denied_for_object(self):
|
def test_permission_denied_for_object(self):
|
||||||
response = denied_object_view(self.request, pk=1)
|
response = denied_object_view(self.request, pk=1)
|
||||||
detail = response.data.get('detail')
|
detail = response.data.get('detail')
|
||||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||||
self.assertNotEqual(detail, self.custom_message)
|
self.assertNotEqual(detail, self.custom_message)
|
||||||
|
|
||||||
def test_permission_denied_for_object_with_custom_detail(self):
|
def test_permission_denied_for_object_with_custom_detail(self):
|
||||||
response = denied_object_view_with_detail(self.request, pk=1)
|
response = denied_object_view_with_detail(self.request, pk=1)
|
||||||
detail = response.data.get('detail')
|
detail = response.data.get('detail')
|
||||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||||
self.assertEqual(detail, self.custom_message)
|
self.assertEqual(detail, self.custom_message)
|
||||||
|
|
||||||
|
|
||||||
class PermissionsCompositionTests(TestCase):
|
class PermissionsCompositionTests(TestCase):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user