From 18bbda84b9c663fec6eede112a21cf1a48103303 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 11 Apr 2011 17:13:11 +0100 Subject: depercate auth and content arguments to the request handler methods - yea :) --- djangorestframework/tests/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index af9c34ca..b2bc4446 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -15,7 +15,7 @@ except ImportError: class MockResource(Resource): allowed_methods = ('POST',) - def post(self, request, auth, content): + def post(self, request): return {'a':1, 'b':2, 'c':3} urlpatterns = patterns('', -- cgit v1.2.3 From 4692374e0d6f020f8a7a95f3a60094d525c59341 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 25 Apr 2011 01:03:23 +0100 Subject: Generic permissions added, allowed_methods and anon_allowed_methods now defunct, dispatch now mirrors View.dispatch more nicely --- djangorestframework/tests/authentication.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index b2bc4446..c825883d 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -13,8 +13,6 @@ except ImportError: import simplejson as json class MockResource(Resource): - allowed_methods = ('POST',) - def post(self, request): return {'a':1, 'b':2, 'c':3} -- cgit v1.2.3 From 762a52edde09297e87c640797219c9bb8255d50a Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 25 Apr 2011 04:50:28 +0100 Subject: Fix some compat issues with json/simplejson --- djangorestframework/tests/authentication.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index c825883d..72300506 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -1,16 +1,15 @@ from django.conf.urls.defaults import patterns from django.test import TestCase from django.test import Client -from djangorestframework.compat import RequestFactory -from djangorestframework.resource import Resource from django.contrib.auth.models import User from django.contrib.auth import login +from django.utils import simplejson as json + +from djangorestframework.compat import RequestFactory +from djangorestframework.resource import Resource import base64 -try: - import json -except ImportError: - import simplejson as json + class MockResource(Resource): def post(self, request): @@ -86,3 +85,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) + -- cgit v1.2.3 From 028851bfa1ee44b8e92808b18d32278d4a473cc8 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 27 Apr 2011 18:07:28 +0100 Subject: Fix up tests and examples after refactoring --- djangorestframework/tests/authentication.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index 72300506..f2c249a6 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -7,11 +7,13 @@ from django.utils import simplejson as json from djangorestframework.compat import RequestFactory from djangorestframework.resource import Resource +from djangorestframework import permissions import base64 class MockResource(Resource): + permissions = ( permissions.IsAuthenticated, ) def post(self, request): return {'a':1, 'b':2, 'c':3} -- cgit v1.2.3 From b18302586c0eeea2e09c799544b9c0a855e11755 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 27 Apr 2011 18:36:43 +0100 Subject: Urg. Fix broken merging. --- djangorestframework/tests/authentication.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index a43a87b3..248bd87a 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -1,12 +1,8 @@ from django.conf.urls.defaults import patterns -<<<<<<< local -from django.test import TestCase -from django.test import Client from django.contrib.auth.models import User from django.contrib.auth import login -======= from django.test import Client, TestCase ->>>>>>> other + from django.utils import simplejson as json from djangorestframework.compat import RequestFactory -- cgit v1.2.3 From d373b3a067796b8e181be9368fa24e89c572c45e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 4 May 2011 09:21:17 +0100 Subject: Decouple views and resources --- djangorestframework/tests/authentication.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index 248bd87a..04ac471a 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -6,19 +6,19 @@ from django.test import Client, TestCase from django.utils import simplejson as json from djangorestframework.compat import RequestFactory -from djangorestframework.resource import Resource +from djangorestframework.views import BaseView from djangorestframework import permissions import base64 -class MockResource(Resource): +class MockView(BaseView): permissions = ( permissions.IsAuthenticated, ) def post(self, request): return {'a':1, 'b':2, 'c':3} urlpatterns = patterns('', - (r'^$', MockResource.as_view()), + (r'^$', MockView.as_view()), ) -- cgit v1.2.3 From 370274f5640d55ef71422f7a2440710a43ff900e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 24 May 2011 10:27:24 +0100 Subject: Allow views to return HttpResponses. Add initial() hook method --- djangorestframework/tests/authentication.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'djangorestframework/tests/authentication.py') diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index 04ac471a..8254403c 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -6,13 +6,13 @@ from django.test import Client, TestCase from django.utils import simplejson as json from djangorestframework.compat import RequestFactory -from djangorestframework.views import BaseView +from djangorestframework.views import View from djangorestframework import permissions import base64 -class MockView(BaseView): +class MockView(View): permissions = ( permissions.IsAuthenticated, ) def post(self, request): return {'a':1, 'b':2, 'c':3} -- cgit v1.2.3