idella4 14/04/10 12:04:26 Added: requests-oauthlib-0.4.0-expires_at.patch Log: bump; test phase updated with related patch sourced from upstream (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D)
Revision Changes Path 1.1 dev-python/requests-oauthlib/files/requests-oauthlib-0.4.0-expires_at.patch file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/requests-oauthlib/files/requests-oauthlib-0.4.0-expires_at.patch?rev=1.1&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/requests-oauthlib/files/requests-oauthlib-0.4.0-expires_at.patch?rev=1.1&content-type=text/plain Index: requests-oauthlib-0.4.0-expires_at.patch =================================================================== https://github.com/requests/requests-oauthlib/commit/7057cbee773c1dff1856730ca661cc71abb2506e.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 @@ -11,6 +11,9 @@ from requests_oauthlib import OAuth2Session, TokenUpdated +fake_time = 1396184331.016881 + + 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):