diff tests/unit.py @ 108:a2184db43fe2

fix dict command line processing
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 03 May 2012 15:46:13 -0700
parents c530f6265deb
children 56db0b2b90af
line wrap: on
line diff
--- a/tests/unit.py	Thu May 03 08:26:10 2012 -0700
+++ b/tests/unit.py	Thu May 03 15:46:13 2012 -0700
@@ -41,6 +41,24 @@
         self.assertEqual(example.config['activeTests'], ['ts'])
         self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox')
 
+    def test_dict(self):
+        """test dictionary parsing from the "command line" """
+
+
+        # test adding a preference
+        example = ExampleConfiguration()
+        options, args = example.parse_args(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox',
+                                            '--pref', 'hangmonitor.timeout=0'])
+        self.assertTrue('hangmonitor.timeout' in options.preferences)
+
+        # test overriding a preference
+        example = ExampleConfiguration()
+        options, args = example.parse_args(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox',
+                                            '--pref', 'browser.bookmarks.max_backups=1'])
+        self.assertTrue(options.preferences['browser.bookmarks.max_backups'] == '1')
+
+
+
     def test_configuration_providers(self):
         """test file-based configuration providers"""
         # requires json/simplejson to be installed