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

Unified Diff: third_party/gsutil/third_party/boto/tests/unit/sts/test_credentials.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/gsutil/third_party/boto/tests/unit/sts/test_credentials.py
diff --git a/third_party/gsutil/third_party/boto/tests/unit/sts/test_credentials.py b/third_party/gsutil/third_party/boto/tests/unit/sts/test_credentials.py
new file mode 100644
index 0000000000000000000000000000000000000000..27a16ca72a81b02960376ccf700d76b128e67668
--- /dev/null
+++ b/third_party/gsutil/third_party/boto/tests/unit/sts/test_credentials.py
@@ -0,0 +1,38 @@
+import unittest
+
+from boto.sts.credentials import Credentials
+
+
+class STSCredentialsTest(unittest.TestCase):
+ sts = True
+
+ def setUp(self):
+ super(STSCredentialsTest, self).setUp()
+ self.creds = Credentials()
+
+ def test_to_dict(self):
+ # This would fail miserably if ``Credentials.request_id`` hadn't been
+ # explicitly set (no default).
+ # Default.
+ self.assertEqual(self.creds.to_dict(), {
+ 'access_key': None,
+ 'expiration': None,
+ 'request_id': None,
+ 'secret_key': None,
+ 'session_token': None
+ })
+
+ # Override.
+ creds = Credentials()
+ creds.access_key = 'something'
+ creds.secret_key = 'crypto'
+ creds.session_token = 'this'
+ creds.expiration = 'way'
+ creds.request_id = 'comes'
+ self.assertEqual(creds.to_dict(), {
+ 'access_key': 'something',
+ 'expiration': 'way',
+ 'request_id': 'comes',
+ 'secret_key': 'crypto',
+ 'session_token': 'this'
+ })

Powered by Google App Engine
This is Rietveld 408576698