mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Fix error text in test.
This commit is contained in:
		
							parent
							
								
									6838f17325
								
							
						
					
					
						commit
						2cc4cb2465
					
				| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
 | 
			
		||||
#### Pagination controls in the browsable API.
 | 
			
		||||
 | 
			
		||||
#### New pagination schemes.
 | 
			
		||||
#### New schemes, including cursor pagination.
 | 
			
		||||
 | 
			
		||||
#### Support for header-based pagination.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12,4 +12,6 @@
 | 
			
		|||
 | 
			
		||||
## Internationalization
 | 
			
		||||
 | 
			
		||||
## New fields
 | 
			
		||||
 | 
			
		||||
## ModelSerializer API
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@ Provides an APIView class that is the base of all views in REST framework.
 | 
			
		|||
from __future__ import unicode_literals
 | 
			
		||||
from django.core.exceptions import PermissionDenied
 | 
			
		||||
from django.http import Http404
 | 
			
		||||
from django.utils import six
 | 
			
		||||
from django.utils.encoding import smart_text
 | 
			
		||||
from django.utils.translation import ugettext_lazy as _
 | 
			
		||||
from django.views.decorators.csrf import csrf_exempt
 | 
			
		||||
| 
						 | 
				
			
			@ -74,11 +75,13 @@ def exception_handler(exc, context):
 | 
			
		|||
        return Response(data, status=exc.status_code, headers=headers)
 | 
			
		||||
 | 
			
		||||
    elif isinstance(exc, Http404):
 | 
			
		||||
        data = {'detail': _('Not found.')}
 | 
			
		||||
        msg = _('Not found.')
 | 
			
		||||
        data = {'detail': six.text_type(msg)}
 | 
			
		||||
        return Response(data, status=status.HTTP_404_NOT_FOUND)
 | 
			
		||||
 | 
			
		||||
    elif isinstance(exc, PermissionDenied):
 | 
			
		||||
        data = {'detail': _('Permission denied.')}
 | 
			
		||||
        msg = _('Permission denied.')
 | 
			
		||||
        data = {'detail': six.text_type(msg)}
 | 
			
		||||
        return Response(data, status=status.HTTP_403_FORBIDDEN)
 | 
			
		||||
 | 
			
		||||
    # Note: Unhandled exceptions will raise a 500 error.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -483,7 +483,7 @@ class TestFilterBackendAppliedToViews(TestCase):
 | 
			
		|||
        request = factory.get('/1')
 | 
			
		||||
        response = instance_view(request, pk=1).render()
 | 
			
		||||
        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
 | 
			
		||||
        self.assertEqual(response.data, {'detail': 'Not found'})
 | 
			
		||||
        self.assertEqual(response.data, {'detail': 'Not found.'})
 | 
			
		||||
 | 
			
		||||
    def test_get_instance_view_will_return_single_object_when_filter_does_not_exclude_it(self):
 | 
			
		||||
        """
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user