aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests
diff options
context:
space:
mode:
authorTom Christie2012-02-21 22:50:41 +0000
committerTom Christie2012-02-21 22:50:41 +0000
commit66eabe8bd1a539f92c3d677565d69edc29a1721b (patch)
tree60c5d2f5cdba605e73545ae21d94fcf809a39788 /djangorestframework/tests
parentb074754b54adf172cd2d102e2a326a7f322cf2ef (diff)
downloaddjango-rest-framework-66eabe8bd1a539f92c3d677565d69edc29a1721b.tar.bz2
Remove staticviews. Use standard login/logout
Diffstat (limited to 'djangorestframework/tests')
-rw-r--r--djangorestframework/tests/accept.py15
-rw-r--r--djangorestframework/tests/oauthentication.py2
-rw-r--r--djangorestframework/tests/renderers.py3
-rw-r--r--djangorestframework/tests/views.py12
4 files changed, 22 insertions, 10 deletions
diff --git a/djangorestframework/tests/accept.py b/djangorestframework/tests/accept.py
index d66f6fb0..21aba589 100644
--- a/djangorestframework/tests/accept.py
+++ b/djangorestframework/tests/accept.py
@@ -1,3 +1,4 @@
+from django.conf.urls.defaults import patterns, url, include
from django.test import TestCase
from djangorestframework.compat import RequestFactory
from djangorestframework.views import View
@@ -13,9 +14,19 @@ SAFARI_5_0_USER_AGENT = 'Mozilla/5.0 (X11; U; Linux x86_64; en-ca) AppleWebKit/5
OPERA_11_0_MSIE_USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 8.0; X11; Linux x86_64; pl) Opera 11.00'
OPERA_11_0_OPERA_USER_AGENT = 'Opera/9.80 (X11; Linux x86_64; U; pl) Presto/2.7.62 Version/11.00'
+
+urlpatterns = patterns('',
+ url(r'^api', include('djangorestframework.urls', namespace='djangorestframework'))
+)
+
+
class UserAgentMungingTest(TestCase):
- """We need to fake up the accept headers when we deal with MSIE. Blergh.
- http://www.gethifi.com/blog/browser-rest-http-accept-headers"""
+ """
+ We need to fake up the accept headers when we deal with MSIE. Blergh.
+ http://www.gethifi.com/blog/browser-rest-http-accept-headers
+ """
+
+ urls = 'djangorestframework.tests.accept'
def setUp(self):
diff --git a/djangorestframework/tests/oauthentication.py b/djangorestframework/tests/oauthentication.py
index b4bcf2fa..29f2c44e 100644
--- a/djangorestframework/tests/oauthentication.py
+++ b/djangorestframework/tests/oauthentication.py
@@ -27,7 +27,7 @@ else:
urlpatterns = patterns('',
url(r'^$', oauth_required(ClientView.as_view())),
url(r'^oauth/', include('oauth_provider.urls')),
- url(r'^accounts/login/$', 'djangorestframework.utils.staticviews.api_login'),
+ url(r'^restframework/', include('djangorestframework.urls', namespace='djangorestframework')),
)
diff --git a/djangorestframework/tests/renderers.py b/djangorestframework/tests/renderers.py
index 9a02d0a9..3ed5ab28 100644
--- a/djangorestframework/tests/renderers.py
+++ b/djangorestframework/tests/renderers.py
@@ -1,6 +1,6 @@
import re
-from django.conf.urls.defaults import patterns, url
+from django.conf.urls.defaults import patterns, url, include
from django.test import TestCase
from djangorestframework import status
@@ -73,6 +73,7 @@ urlpatterns = patterns('',
url(r'^jsonp/nojsonrenderer$', MockGETView.as_view(renderers=[JSONPRenderer])),
url(r'^html$', HTMLView.as_view()),
url(r'^html1$', HTMLView1.as_view()),
+ url(r'^api', include('djangorestframework.urls', namespace='djangorestframework'))
)
diff --git a/djangorestframework/tests/views.py b/djangorestframework/tests/views.py
index d4189087..418b4b16 100644
--- a/djangorestframework/tests/views.py
+++ b/djangorestframework/tests/views.py
@@ -1,4 +1,5 @@
-from django.conf.urls.defaults import patterns, url
+from django.core.urlresolvers import reverse
+from django.conf.urls.defaults import patterns, url, include
from django.http import HttpResponse
from django.test import TestCase
from django.test import Client
@@ -45,14 +46,13 @@ class MockResource(ModelResource):
model = MockResourceModel
fields = ('foo', 'bar', 'baz')
-urlpatterns = patterns('djangorestframework.utils.staticviews',
- url(r'^accounts/login$', 'api_login'),
- url(r'^accounts/logout$', 'api_logout'),
+urlpatterns = patterns('',
url(r'^mock/$', MockView.as_view()),
url(r'^mock/final/$', MockViewFinal.as_view()),
url(r'^resourcemock/$', ResourceMockView.as_view()),
url(r'^model/$', ListOrCreateModelView.as_view(resource=MockResource)),
url(r'^model/(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=MockResource)),
+ url(r'^restframework/', include('djangorestframework.urls', namespace='djangorestframework')),
)
class BaseViewTests(TestCase):
@@ -123,13 +123,13 @@ class ExtraViewsTests(TestCase):
def test_login_view(self):
"""Ensure the login view exists"""
- response = self.client.get('/accounts/login')
+ response = self.client.get(reverse('djangorestframework:login'))
self.assertEqual(response.status_code, 200)
self.assertEqual(response['Content-Type'].split(';')[0], 'text/html')
def test_logout_view(self):
"""Ensure the logout view exists"""
- response = self.client.get('/accounts/logout')
+ response = self.client.get(reverse('djangorestframework:logout'))
self.assertEqual(response.status_code, 200)
self.assertEqual(response['Content-Type'].split(';')[0], 'text/html')