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

Unified Diff: tools/telemetry/third_party/gsutil/third_party/oauth2client/tests/test_util.py

Issue 1258583006: Add gsutil 4.13 to telemetry/third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo all other changes so this just add gsutil to third_party Created 5 years, 5 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: tools/telemetry/third_party/gsutil/third_party/oauth2client/tests/test_util.py
diff --git a/tools/telemetry/third_party/gsutil/third_party/oauth2client/tests/test_util.py b/tools/telemetry/third_party/gsutil/third_party/oauth2client/tests/test_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..2d67316772ebaaef419a5914562b77df739206d8
--- /dev/null
+++ b/tools/telemetry/third_party/gsutil/third_party/oauth2client/tests/test_util.py
@@ -0,0 +1,44 @@
+"""Unit tests for oauth2client.util."""
+
+__author__ = 'jcgregorio@google.com (Joe Gregorio)'
+
+import unittest
+
+from oauth2client import util
+
+
+class ScopeToStringTests(unittest.TestCase):
+
+ def test_iterables(self):
+ cases = [
+ ('', ''),
+ ('', ()),
+ ('', []),
+ ('', ('', )),
+ ('', ['', ]),
+ ('a', ('a', )),
+ ('b', ['b', ]),
+ ('a b', ['a', 'b']),
+ ('a b', ('a', 'b')),
+ ('a b', 'a b'),
+ ('a b', (s for s in ['a', 'b'])),
+ ]
+ for expected, case in cases:
+ self.assertEqual(expected, util.scopes_to_string(case))
+
+
+class KeyConversionTests(unittest.TestCase):
+
+ def test_key_conversions(self):
+ d = {'somekey': 'some value', 'another': 'something else', 'onemore': 'foo'}
+ tuple_key = util.dict_to_tuple_key(d)
+
+ # the resulting key should be naturally sorted
+ self.assertEqual(
+ (('another', 'something else'),
+ ('onemore', 'foo'),
+ ('somekey', 'some value')),
+ tuple_key)
+
+ # check we get the original dictionary back
+ self.assertEqual(d, dict(tuple_key))

Powered by Google App Engine
This is Rietveld 408576698