mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-16 11:12:21 +03:00
Fix typos in tests
This commit is contained in:
parent
d4b7b1add4
commit
65967ee641
|
@ -19,7 +19,7 @@ factory = APIRequestFactory()
|
||||||
|
|
||||||
class SearchSplitTests(SimpleTestCase):
|
class SearchSplitTests(SimpleTestCase):
|
||||||
|
|
||||||
def test_keep_quoted_togheter_regardless_of_commas(self):
|
def test_keep_quoted_together_regardless_of_commas(self):
|
||||||
assert ['hello, world'] == list(filters.search_smart_split('"hello, world"'))
|
assert ['hello, world'] == list(filters.search_smart_split('"hello, world"'))
|
||||||
|
|
||||||
def test_strips_commas_around_quoted(self):
|
def test_strips_commas_around_quoted(self):
|
||||||
|
|
|
@ -797,7 +797,7 @@ class TestIntegration(TestCase):
|
||||||
)
|
)
|
||||||
self.instance.many_to_many.set(self.many_to_many_targets)
|
self.instance.many_to_many.set(self.many_to_many_targets)
|
||||||
|
|
||||||
def test_pk_retrival(self):
|
def test_pk_retrieval(self):
|
||||||
class TestSerializer(serializers.ModelSerializer):
|
class TestSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RelationalModel
|
model = RelationalModel
|
||||||
|
|
|
@ -61,8 +61,8 @@ class TestAcceptedMediaType(TestCase):
|
||||||
|
|
||||||
def test_match_is_false_if_main_types_not_match(self):
|
def test_match_is_false_if_main_types_not_match(self):
|
||||||
mediatype = _MediaType('test_1')
|
mediatype = _MediaType('test_1')
|
||||||
anoter_mediatype = _MediaType('test_2')
|
another_mediatype = _MediaType('test_2')
|
||||||
assert mediatype.match(anoter_mediatype) is False
|
assert mediatype.match(another_mediatype) is False
|
||||||
|
|
||||||
def test_mediatype_match_is_false_if_keys_not_match(self):
|
def test_mediatype_match_is_false_if_keys_not_match(self):
|
||||||
mediatype = _MediaType(';test_param=foo')
|
mediatype = _MediaType(';test_param=foo')
|
||||||
|
|
|
@ -513,7 +513,7 @@ class TestLimitOffset:
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_erronous_offset(self):
|
def test_erroneous_offset(self):
|
||||||
request = Request(factory.get('/', {'limit': 5, 'offset': 1000}))
|
request = Request(factory.get('/', {'limit': 5, 'offset': 1000}))
|
||||||
queryset = self.paginate_queryset(request)
|
queryset = self.paginate_queryset(request)
|
||||||
self.get_paginated_content(queryset)
|
self.get_paginated_content(queryset)
|
||||||
|
|
|
@ -624,7 +624,7 @@ class PermissionsCompositionTests(TestCase):
|
||||||
)
|
)
|
||||||
assert composed_perm().has_permission(request, None) is True
|
assert composed_perm().has_permission(request, None) is True
|
||||||
|
|
||||||
def test_or_lazyness(self):
|
def test_or_laziness(self):
|
||||||
request = factory.get('/1', format='json')
|
request = factory.get('/1', format='json')
|
||||||
request.user = AnonymousUser()
|
request.user = AnonymousUser()
|
||||||
|
|
||||||
|
@ -644,7 +644,7 @@ class PermissionsCompositionTests(TestCase):
|
||||||
assert mock_deny.call_count == 1
|
assert mock_deny.call_count == 1
|
||||||
assert mock_allow.call_count == 1
|
assert mock_allow.call_count == 1
|
||||||
|
|
||||||
def test_object_or_lazyness(self):
|
def test_object_or_laziness(self):
|
||||||
request = factory.get('/1', format='json')
|
request = factory.get('/1', format='json')
|
||||||
request.user = AnonymousUser()
|
request.user = AnonymousUser()
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ class PermissionsCompositionTests(TestCase):
|
||||||
assert mock_deny.call_count == 0
|
assert mock_deny.call_count == 0
|
||||||
assert mock_allow.call_count == 1
|
assert mock_allow.call_count == 1
|
||||||
|
|
||||||
def test_and_lazyness(self):
|
def test_and_laziness(self):
|
||||||
request = factory.get('/1', format='json')
|
request = factory.get('/1', format='json')
|
||||||
request.user = AnonymousUser()
|
request.user = AnonymousUser()
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ class PermissionsCompositionTests(TestCase):
|
||||||
assert mock_deny.call_count == 1
|
assert mock_deny.call_count == 1
|
||||||
mock_allow.assert_not_called()
|
mock_allow.assert_not_called()
|
||||||
|
|
||||||
def test_object_and_lazyness(self):
|
def test_object_and_laziness(self):
|
||||||
request = factory.get('/1', format='json')
|
request = factory.get('/1', format='json')
|
||||||
request.user = AnonymousUser()
|
request.user = AnonymousUser()
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,7 @@ class TestUniquenessTogetherValidation(TestCase):
|
||||||
"with a `UniqueTogetherValidator` using the desired field names.")
|
"with a `UniqueTogetherValidator` using the desired field names.")
|
||||||
assert str(excinfo.value) == expected
|
assert str(excinfo.value) == expected
|
||||||
|
|
||||||
def test_allow_explict_override(self):
|
def test_allow_explicit_override(self):
|
||||||
"""
|
"""
|
||||||
Ensure validators can be explicitly removed..
|
Ensure validators can be explicitly removed..
|
||||||
"""
|
"""
|
||||||
|
@ -664,7 +664,7 @@ class TestUniqueConstraintValidation(TestCase):
|
||||||
UniqueConstraint with single field must be transformed into
|
UniqueConstraint with single field must be transformed into
|
||||||
field's UniqueValidator
|
field's UniqueValidator
|
||||||
"""
|
"""
|
||||||
# Django 5 includes Max and Min values validators for IntergerField
|
# Django 5 includes Max and Min values validators for IntegerField
|
||||||
extra_validators_qty = 2 if django_version[0] >= 5 else 0
|
extra_validators_qty = 2 if django_version[0] >= 5 else 0
|
||||||
serializer = UniqueConstraintSerializer()
|
serializer = UniqueConstraintSerializer()
|
||||||
assert len(serializer.validators) == 2
|
assert len(serializer.validators) == 2
|
||||||
|
|
|
@ -47,7 +47,7 @@ def custom_handler(exc, context):
|
||||||
return Response({'error': 'UnknownError'}, status=500)
|
return Response({'error': 'UnknownError'}, status=500)
|
||||||
|
|
||||||
|
|
||||||
class OverridenSettingsView(APIView):
|
class OverriddenSettingsView(APIView):
|
||||||
settings = APISettings({'EXCEPTION_HANDLER': custom_handler})
|
settings = APISettings({'EXCEPTION_HANDLER': custom_handler})
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
@ -131,7 +131,7 @@ class TestCustomExceptionHandler(TestCase):
|
||||||
|
|
||||||
class TestCustomSettings(TestCase):
|
class TestCustomSettings(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.view = OverridenSettingsView.as_view()
|
self.view = OverriddenSettingsView.as_view()
|
||||||
|
|
||||||
def test_get_exception_handler(self):
|
def test_get_exception_handler(self):
|
||||||
request = factory.get('/', content_type='application/json')
|
request = factory.get('/', content_type='application/json')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user