diff tests/unit.py @ 55:87bd539a21d3

test with overrides
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 27 Mar 2012 14:55:29 -0700
parents 09fbc09455d4
children 7f8e9c5d1606
line wrap: on
line diff
--- a/tests/unit.py	Tue Mar 27 14:41:13 2012 -0700
+++ b/tests/unit.py	Tue Mar 27 14:55:29 2012 -0700
@@ -101,14 +101,25 @@
     def test_multiple_configurations(self):
         """test having multiple configurations"""
 
-        example = ExampleConfiguration()
-
         # simple override
-        config1 = {'browser_path': '/home/jhammel/bin/firefox',
-                   'activeTests': ['ts']}
         args1 = ['-e', '/opt/bin/firefox']
 
-        #
+        # simple serialized file
+        json_file = os.path.join(here, 'base.json')
+        assert os.path.exists(json_file)
+        json_config = json.loads(file(json_file).read())
+
+        # parse the json file
+        example = ExampleConfiguration()
+        example.parse([json_file])
+        self.assertEqual(example.config, json_config)
+
+        # parse the json file with overrides
+        example = ExampleConfiguration()
+        example.parse([json_file] + args1)
+        config = json_config.copy()
+        config['browser_path'] = '/opt/bin/firefox'
+        self.assertEqual(example.config, config)
 
 if __name__ == '__main__':
     unittest.main()