Commit e3c95865 by Clinton Blackburn

Updated edx-drf-extensions

This version actually checks the expiration date of the access token.

ECOM-3895
parent aa0f2c6b
# pylint: disable=redefined-builtin
import datetime
import json
import urllib
from time import time
......@@ -33,11 +34,12 @@ class OAuth2Mixin(object):
def mock_access_token_response(self, user, status=200):
""" Mock the access token endpoint response of the OAuth2 provider. """
url = '{root}/{token}'.format(root=OAUTH2_ACCESS_TOKEN_URL.rstrip('/'), token=self.get_access_token(user))
expires = datetime.datetime.utcnow() + datetime.timedelta(days=1)
responses.add(
responses.GET,
url,
body=json.dumps({'username': user.username, 'scope': 'read', 'expires_in': 60}),
body=json.dumps({'username': user.username, 'scope': 'read', 'expires': expires.isoformat()}),
content_type="application/json",
status=status
)
......
......@@ -5,7 +5,7 @@ djangorestframework==3.3.1
djangorestframework-jwt==1.7.2
django-rest-swagger[reST]==0.3.4
edx-auth-backends==0.1.3
edx-drf-extensions==0.1.0
edx-drf-extensions==0.1.1
edx-rest-api-client==1.5.0
elasticsearch>=1.0.0,<2.0.0
pytz==2015.7
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment