mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Fix renderer tests.
- All MockViews return Response objects - Only one urlpatterns attribute in the module - Renamed `RendererIntegrationTests` to `RendererEndToEndTests`, as the former wasn't being run locally (but it was on Travis...dunno).
This commit is contained in:
parent
3b1404bd7d
commit
10450bafc9
|
@ -55,27 +55,27 @@ class MockView(APIView):
|
|||
|
||||
def get(self, request, **kwargs):
|
||||
response = Response(DUMMYCONTENT, status=DUMMYSTATUS)
|
||||
return self.render(response)
|
||||
return response
|
||||
|
||||
|
||||
class MockGETView(APIView):
|
||||
|
||||
def get(self, request, **kwargs):
|
||||
return {'foo': ['bar', 'baz']}
|
||||
return Response({'foo': ['bar', 'baz']})
|
||||
|
||||
|
||||
class HTMLView(APIView):
|
||||
renderers = (DocumentingHTMLRenderer, )
|
||||
|
||||
def get(self, request, **kwargs):
|
||||
return 'text'
|
||||
return Response('text')
|
||||
|
||||
|
||||
class HTMLView1(APIView):
|
||||
renderers = (DocumentingHTMLRenderer, JSONRenderer)
|
||||
|
||||
def get(self, request, **kwargs):
|
||||
return 'text'
|
||||
return Response('text')
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^.*\.(?P<format>.+)$', MockView.as_view(renderers=[RendererA, RendererB])),
|
||||
|
@ -88,7 +88,7 @@ urlpatterns = patterns('',
|
|||
)
|
||||
|
||||
|
||||
class RendererIntegrationTests(TestCase):
|
||||
class RendererEndToEndTests(TestCase):
|
||||
"""
|
||||
End-to-end testing of renderers using an RendererMixin on a generic view.
|
||||
"""
|
||||
|
@ -216,18 +216,6 @@ class JSONRendererTests(TestCase):
|
|||
self.assertEquals(strip_trailing_whitespace(content), _indented_repr)
|
||||
|
||||
|
||||
class MockGETView(APIView):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return Response({'foo': ['bar', 'baz']})
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^jsonp/jsonrenderer$', MockGETView.as_view(renderers=[JSONRenderer, JSONPRenderer])),
|
||||
url(r'^jsonp/nojsonrenderer$', MockGETView.as_view(renderers=[JSONPRenderer])),
|
||||
)
|
||||
|
||||
|
||||
class JSONPRendererTests(TestCase):
|
||||
"""
|
||||
Tests specific to the JSONP Renderer
|
||||
|
|
Loading…
Reference in New Issue
Block a user