django-rest-framework/tests/test_reverse.py
Xavier Ordoquy 7b4463f739 Merge remote-tracking branch 'reference/2.4.0' into feature/pytest
Conflicts:
	rest_framework/runtests/urls.py
	tests/test_response.py
	tox.ini
2014-05-01 08:01:38 +02:00

28 lines
683 B
Python

from __future__ import unicode_literals
from django.conf.urls import patterns, url
from django.test import TestCase
from rest_framework.reverse import reverse
from rest_framework.test import APIRequestFactory
factory = APIRequestFactory()
def null_view(request):
pass
urlpatterns = patterns('',
url(r'^view$', null_view, name='view'),
)
class ReverseTests(TestCase):
"""
Tests for fully qualified URLs when using `reverse`.
"""
urls = 'tests.test_reverse'
def test_reversed_urls_are_fully_qualified(self):
request = factory.get('/view')
url = reverse('view', request=request)
self.assertEqual(url, 'http://testserver/view')