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

Unified Diff: third_party/boto/tests/unit/utils/test_utils.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « third_party/boto/tests/unit/test_regioninfo.py ('k') | third_party/gcs-oauth2-boto-plugin/.gitignore » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/tests/unit/utils/test_utils.py
===================================================================
--- third_party/boto/tests/unit/utils/test_utils.py (revision 33376)
+++ third_party/boto/tests/unit/utils/test_utils.py (working copy)
@@ -24,8 +24,10 @@
except ImportError:
import unittest
+import datetime
import hashlib
import hmac
+import locale
import mock
import thread
import time
@@ -259,5 +261,32 @@
'http://169.254.169.254/latest/user-data',
retry_on_404=False)
+
+class TestStringToDatetimeParsing(unittest.TestCase):
+ """ Test string to datetime parsing """
+ def setUp(self):
+ self._saved = locale.setlocale(locale.LC_ALL)
+ locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
+
+ def tearDown(self):
+ locale.setlocale(locale.LC_ALL, self._saved)
+
+ def test_nonus_locale(self):
+ test_string = 'Thu, 15 May 2014 09:06:03 GMT'
+
+ # Default strptime shoudl fail
+ with self.assertRaises(ValueError):
+ datetime.datetime.strptime(test_string, boto.utils.RFC1123)
+
+ # Our parser should succeed
+ result = boto.utils.parse_ts(test_string)
+
+ self.assertEqual(2014, result.year)
+ self.assertEqual(5, result.month)
+ self.assertEqual(15, result.day)
+ self.assertEqual(9, result.hour)
+ self.assertEqual(6, result.minute)
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « third_party/boto/tests/unit/test_regioninfo.py ('k') | third_party/gcs-oauth2-boto-plugin/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698