aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/authentication.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/tests/authentication.py')
-rw-r--r--djangorestframework/tests/authentication.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py
index 246ad4a0..8254403c 100644
--- a/djangorestframework/tests/authentication.py
+++ b/djangorestframework/tests/authentication.py
@@ -1,23 +1,24 @@
from django.conf.urls.defaults import patterns
+from django.contrib.auth.models import User
+from django.contrib.auth import login
from django.test import Client, TestCase
+
from django.utils import simplejson as json
from djangorestframework.compat import RequestFactory
-from djangorestframework.resource import Resource
-from django.contrib.auth.models import User
-from django.contrib.auth import login
+from djangorestframework.views import View
+from djangorestframework import permissions
import base64
-class MockResource(Resource):
- allowed_methods = ('POST',)
-
- def post(self, request, auth, content):
+class MockView(View):
+ permissions = ( permissions.IsAuthenticated, )
+ def post(self, request):
return {'a':1, 'b':2, 'c':3}
urlpatterns = patterns('',
- (r'^$', MockResource.as_view()),
+ (r'^$', MockView.as_view()),
)
@@ -86,3 +87,4 @@ class SessionAuthTests(TestCase):
"""Ensure POSTing form over session authentication without logged in user fails."""
response = self.csrf_client.post('/', {'example': 'example'})
self.assertEqual(response.status_code, 403)
+