comparison 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
comparison
equal deleted inserted replaced
107:83d66a9bdef0 108:a2184db43fe2
38 38
39 # ensure that the configuration appropriately gets updated 39 # ensure that the configuration appropriately gets updated
40 self.assertEqual(example.config['develop'], True) 40 self.assertEqual(example.config['develop'], True)
41 self.assertEqual(example.config['activeTests'], ['ts']) 41 self.assertEqual(example.config['activeTests'], ['ts'])
42 self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox') 42 self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox')
43
44 def test_dict(self):
45 """test dictionary parsing from the "command line" """
46
47
48 # test adding a preference
49 example = ExampleConfiguration()
50 options, args = example.parse_args(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox',
51 '--pref', 'hangmonitor.timeout=0'])
52 self.assertTrue('hangmonitor.timeout' in options.preferences)
53
54 # test overriding a preference
55 example = ExampleConfiguration()
56 options, args = example.parse_args(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox',
57 '--pref', 'browser.bookmarks.max_backups=1'])
58 self.assertTrue(options.preferences['browser.bookmarks.max_backups'] == '1')
59
60
43 61
44 def test_configuration_providers(self): 62 def test_configuration_providers(self):
45 """test file-based configuration providers""" 63 """test file-based configuration providers"""
46 # requires json/simplejson to be installed 64 # requires json/simplejson to be installed
47 65