changeset 58:f7dc5cf2540c

add complex test, now we can refactor
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 27 Mar 2012 15:25:12 -0700
parents 11a498419193
children b8f066b8ab62
files tests/unit.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/unit.py	Tue Mar 27 15:00:07 2012 -0700
+++ b/tests/unit.py	Tue Mar 27 15:25:12 2012 -0700
@@ -126,5 +126,17 @@
         example.parse(args1 + [json_file])
         self.assertEqual(example.config, config)
 
+        # Now a tricky case:
+        # the default value for test_timeout is 1200:
+        example = ExampleConfiguration()
+        self.assertEqual(example.options['test_timeout']['default'], 1200)
+        # The value from base.json is 60:
+        self.assertEqual(json_config['test_timeout'], 60)
+        self.assertEqual(config['test_timeout'], 60)
+        # but we can override it back from the "command line"
+        example.parse(args1 + [json_file, '--test_timeout', '1200'])
+        config['test_timeout'] = 1200
+        self.assertEqual(example.config, config)
+
 if __name__ == '__main__':
     unittest.main()