# HG changeset patch # User Jeff Hammel # Date 1332885329 25200 # Node ID 87bd539a21d31aab1b87ec54d6a945803daf15b9 # Parent 135322cc5bc08c8f772441e1429844f840bbf90c test with overrides diff -r 135322cc5bc0 -r 87bd539a21d3 tests/unit.py --- 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()