aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/authentication.py
diff options
context:
space:
mode:
authorTom Christie2011-06-02 12:58:10 +0100
committerTom Christie2011-06-02 12:58:10 +0100
commitb50492853f537a2473bb0a9eea86c8b0ed6b8824 (patch)
treed289d39aacf187a8a0696a4c1c863aabe1472c3a /djangorestframework/tests/authentication.py
parent7ee9adbe5c03c29cd4a894dd476548f7fe73b5e4 (diff)
parentfc1640de75511006e89f033c9270ec91a9f1e4d4 (diff)
downloaddjango-rest-framework-b50492853f537a2473bb0a9eea86c8b0ed6b8824.tar.bz2
pull in -dev as 0.2.0
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)
+