aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/oauthentication.py
diff options
context:
space:
mode:
authorTom Christie2012-09-03 16:54:17 +0100
committerTom Christie2012-09-03 16:54:17 +0100
commita092a72844705e3129b8996b81d8424997b5d37f (patch)
tree2f9cf30fc805a4b8cf4e6d60b3f820a3e96347e3 /djangorestframework/tests/oauthentication.py
parent1a1ccf94c2c0cadee8b0bd1c8f85c591c650d763 (diff)
downloaddjango-rest-framework-a092a72844705e3129b8996b81d8424997b5d37f.tar.bz2
View -> APIView
Diffstat (limited to 'djangorestframework/tests/oauthentication.py')
-rw-r--r--djangorestframework/tests/oauthentication.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/djangorestframework/tests/oauthentication.py b/djangorestframework/tests/oauthentication.py
index 29f2c44e..2621317d 100644
--- a/djangorestframework/tests/oauthentication.py
+++ b/djangorestframework/tests/oauthentication.py
@@ -4,7 +4,7 @@ from django.conf.urls.defaults import patterns, url, include
from django.contrib.auth.models import User
from django.test import Client, TestCase
-from djangorestframework.views import View
+from djangorestframework.views import APIView
# Since oauth2 / django-oauth-plus are optional dependancies, we don't want to
# always run these tests.
@@ -20,7 +20,7 @@ except ImportError:
else:
# Alrighty, we're good to go here.
- class ClientView(View):
+ class ClientView(APIView):
def get(self, request):
return {'resource': 'Protected!'}
@@ -30,7 +30,6 @@ else:
url(r'^restframework/', include('djangorestframework.urls', namespace='djangorestframework')),
)
-
class OAuthTests(TestCase):
"""
OAuth authentication:
@@ -117,12 +116,12 @@ else:
# Starting the test here
self.client.login(username=self.username, password=self.password)
- parameters = {'oauth_token': token.key,}
+ parameters = {'oauth_token': token.key}
response = self.client.get("/oauth/authorize/", parameters)
self.assertEqual(response.status_code, 200)
self.failIf(not response.content.startswith('Fake authorize view for api.example.com with params: oauth_token='))
self.assertEqual(token.is_approved, 0)
- parameters['authorize_access'] = 1 # fake authorization by the user
+ parameters['authorize_access'] = 1 # fake authorization by the user
response = self.client.post("/oauth/authorize/", parameters)
self.assertEqual(response.status_code, 302)
self.failIf(not response['Location'].startswith('http://api.example.com/request_token_ready?oauth_verifier='))