aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/reverse.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/tests/reverse.py')
-rw-r--r--djangorestframework/tests/reverse.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/djangorestframework/tests/reverse.py b/djangorestframework/tests/reverse.py
index 05c21faa..c2388d62 100644
--- a/djangorestframework/tests/reverse.py
+++ b/djangorestframework/tests/reverse.py
@@ -2,28 +2,33 @@ from django.conf.urls.defaults import patterns, url
from django.test import TestCase
from django.utils import simplejson as json
-from djangorestframework.utils import reverse
+from djangorestframework.renderers import JSONRenderer
+from djangorestframework.reverse import reverse
from djangorestframework.views import View
from djangorestframework.response import Response
-class MockView(View):
- """Mock resource which simply returns a URL, so that we can ensure that reversed URLs are fully qualified"""
- permissions = ()
+class MyView(View):
+ """
+ Mock resource which simply returns a URL, so that we can ensure
+ that reversed URLs are fully qualified.
+ """
+ renderers = (JSONRenderer, )
def get(self, request):
return Response(reverse('another', request))
urlpatterns = patterns('',
- url(r'^$', MockView.as_view()),
- url(r'^another$', MockView.as_view(), name='another'),
+ url(r'^myview$', MyView.as_view(), name='myview'),
)
class ReverseTests(TestCase):
- """Tests for """
+ """
+ Tests for fully qualifed URLs when using `reverse`.
+ """
urls = 'djangorestframework.tests.reverse'
def test_reversed_urls_are_fully_qualified(self):
- response = self.client.get('/')
- self.assertEqual(json.loads(response.content), 'http://testserver/another')
+ response = self.client.get('/myview')
+ self.assertEqual(json.loads(response.content), 'http://testserver/myview')