diff options
Diffstat (limited to 'djangorestframework/tests/reverse.py')
| -rw-r--r-- | djangorestframework/tests/reverse.py | 18 | 
1 files changed, 11 insertions, 7 deletions
diff --git a/djangorestframework/tests/reverse.py b/djangorestframework/tests/reverse.py index 2718ebca..b4b0a793 100644 --- a/djangorestframework/tests/reverse.py +++ b/djangorestframework/tests/reverse.py @@ -3,19 +3,19 @@ from django.core.urlresolvers import reverse  from django.test import TestCase  from django.utils import simplejson as json -from djangorestframework.resource import Resource +from djangorestframework.views import View -class MockResource(Resource): +class MockView(View):      """Mock resource which simply returns a URL, so that we can ensure that reversed URLs are fully qualified""" -    anon_allowed_methods = ('GET',) +    permissions = () -    def get(self, request, auth): +    def get(self, request):          return reverse('another')  urlpatterns = patterns('', -    url(r'^$', MockResource.as_view()), -    url(r'^another$', MockResource.as_view(), name='another'), +    url(r'^$', MockView.as_view()), +    url(r'^another$', MockView.as_view(), name='another'),  ) @@ -24,5 +24,9 @@ class ReverseTests(TestCase):      urls = 'djangorestframework.tests.reverse'      def test_reversed_urls_are_fully_qualified(self): -        response = self.client.get('/') +        try: +            response = self.client.get('/') +        except: +            import traceback +            traceback.print_exc()          self.assertEqual(json.loads(response.content), 'http://testserver/another')  | 
