Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: third_party/gsutil/oauth2_plugin/oauth2_client_test.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2010 Google Inc. 1 # Copyright 2010 Google Inc.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 def testUniqeId(self): 305 def testUniqeId(self):
306 cred_id = self.cred.CacheKey() 306 cred_id = self.cred.CacheKey()
307 self.assertEquals('0720afed6871f12761fbea3271f451e6ba184bf5', cred_id) 307 self.assertEquals('0720afed6871f12761fbea3271f451e6ba184bf5', cred_id)
308 308
309 def testGetAuthorizationHeader(self): 309 def testGetAuthorizationHeader(self):
310 access_token = 'access_123' 310 access_token = 'access_123'
311 self.opener.open_result = ( 311 self.opener.open_result = (
312 '{"access_token":"%s","expires_in":3600}' % access_token) 312 '{"access_token":"%s","expires_in":3600}' % access_token)
313 313
314 self.assertEquals('OAuth %s' % access_token, 314 self.assertEquals('Bearer %s' % access_token,
315 self.cred.GetAuthorizationHeader()) 315 self.cred.GetAuthorizationHeader())
316 316
317 317
318 class FileSystemTokenCacheTest(unittest.TestCase): 318 class FileSystemTokenCacheTest(unittest.TestCase):
319 319
320 def setUp(self): 320 def setUp(self):
321 self.cache = oauth2_client.FileSystemTokenCache() 321 self.cache = oauth2_client.FileSystemTokenCache()
322 self.start_time = datetime.datetime(2011, 3, 1, 10, 25, 13, 300826) 322 self.start_time = datetime.datetime(2011, 3, 1, 10, 25, 13, 300826)
323 self.token_1 = oauth2_client.AccessToken('token1', self.start_time) 323 self.token_1 = oauth2_client.AccessToken('token1', self.start_time)
324 self.token_2 = oauth2_client.AccessToken( 324 self.token_2 = oauth2_client.AccessToken(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 cache = oauth2_client.FileSystemTokenCache( 366 cache = oauth2_client.FileSystemTokenCache(
367 path_pattern='/var/run/ccache/token.%(key)s') 367 path_pattern='/var/run/ccache/token.%(key)s')
368 self.assertEquals('/var/run/ccache/token.abc123', 368 self.assertEquals('/var/run/ccache/token.abc123',
369 cache.CacheFileName('abc123')) 369 cache.CacheFileName('abc123'))
370 370
371 371
372 if __name__ == '__main__': 372 if __name__ == '__main__':
373 logging.basicConfig(level=logging.DEBUG) 373 logging.basicConfig(level=logging.DEBUG)
374 unittest.main() 374 unittest.main()
OLDNEW
« no previous file with comments | « third_party/gsutil/oauth2_plugin/oauth2_client.py ('k') | third_party/gsutil/oauth2_plugin/oauth2_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698