changeset 6296:6cf9f2f49b89

Fix UTC timezone test case if pytz not available; add tests UTC is a special known timezone so it doesn't raise an exception even if pytz is missing. Added test case with bogus timezone that raises exception. Added testcase for EST that is known with and without pytz.
author John Rouillard <rouilj@ieee.org>
date Mon, 14 Dec 2020 21:25:56 -0500
parents bc2b00afa980
children a635a60ffb84
files test/test_config.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_config.py	Mon Dec 14 09:52:58 2020 -0500
+++ b/test/test_config.py	Mon Dec 14 21:25:56 2020 -0500
@@ -112,13 +112,23 @@
                     config._get_option('TIMEZONE').set("UTC"))
             self.assertEqual(None,
                     config._get_option('TIMEZONE').set("America/New_York"))
+            self.assertEqual(None,
+                    config._get_option('TIMEZONE').set("EST"))
+            self.assertRaises(configuration.OptionValueError,
+                    config._get_option('TIMEZONE').set, "Zool/Zot")
 
         except ImportError:
-            self.assertRaises(configuration.OptionValueError,
-                    config._get_option('TIMEZONE').set, "UTC")
+            # UTC is a known offset of 0 coded into roundup.date
+            # so it works even without pytz.
+            self.assertEqual(None,
+                    config._get_option('TIMEZONE').set("UTC"))
+            # same with EST known timeone offset of 5
+            self.assertEqual(None,
+                    config._get_option('TIMEZONE').set("EST"))
             self.assertRaises(configuration.OptionValueError,
                     config._get_option('TIMEZONE').set, "America/New_York")
 
+
     def testWebSecretKey(self):
         config = configuration.CoreConfig()
 

Roundup Issue Tracker: http://roundup-tracker.org/