mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-03 04:37:06 -08:00
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
62 lines
2.1 KiB
Diff
62 lines
2.1 KiB
Diff
https://github.com/requests/requests-oauthlib/commit/7057cbee773c1dff1856730ca661cc71abb2506e.diff
|
|
https://github.com/requests/requests-oauthlib/commit/8c2c96c4bb45803df2779cfde90868445977ab96.diff
|
|
diff --git a/tests/test_oauth2_session.py b/tests/test_oauth2_session.py
|
|
index 305241a..cf095a5 100644
|
|
--- a/tests/test_oauth2_session.py
|
|
+++ b/tests/test_oauth2_session.py
|
|
@@ -1,6 +1,7 @@
|
|
from __future__ import unicode_literals
|
|
import json
|
|
import mock
|
|
+import time
|
|
import unittest
|
|
|
|
from oauthlib.common import urlencode
|
|
@@ -11,6 +11,9 @@
|
|
from requests_oauthlib import OAuth2Session, TokenUpdated
|
|
|
|
|
|
+fake_time = time.time()
|
|
+
|
|
+
|
|
class OAuth2SessionTest(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
@@ -22,7 +25,8 @@ def setUp(self):
|
|
'token_type': 'Bearer',
|
|
'access_token': 'asdfoiw37850234lkjsdfsdf',
|
|
'refresh_token': 'sldvafkjw34509s8dfsdf',
|
|
- 'expires_in': '3600'
|
|
+ 'expires_in': '3600',
|
|
+ 'expires_at': fake_time + 3600,
|
|
}
|
|
self.client_id = 'foo'
|
|
self.clients = [
|
|
@@ -66,9 +70,11 @@ def test_authorization_url(self):
|
|
self.assertIn(self.client_id, auth_url)
|
|
self.assertIn('response_type=token', auth_url)
|
|
|
|
+ @mock.patch("time.time", new=lambda: fake_time)
|
|
def test_refresh_token_request(self):
|
|
self.expired_token = dict(self.token)
|
|
self.expired_token['expires_in'] = '-1'
|
|
+ del self.expired_token['expires_at']
|
|
|
|
def fake_refresh(r, **kwargs):
|
|
resp = mock.MagicMock()
|
|
@@ -98,12 +104,14 @@ def token_updater(token):
|
|
auth.send = fake_refresh
|
|
auth.get('https://i.b')
|
|
|
|
+ @mock.patch("time.time", new=lambda: fake_time)
|
|
def test_token_from_fragment(self):
|
|
mobile = MobileApplicationClient(self.client_id)
|
|
response_url = 'https://i.b/callback#' + urlencode(self.token.items())
|
|
auth = OAuth2Session(client=mobile)
|
|
self.assertEqual(auth.token_from_fragment(response_url), self.token)
|
|
|
|
+ @mock.patch("time.time", new=lambda: fake_time)
|
|
def test_fetch_token(self):
|
|
def fake_token(token):
|
|
def fake_send(r, **kwargs):
|