comparison tests/unit.py @ 39:3c91bf85adb5

actually test serialization
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 27 Mar 2012 10:29:36 -0700
parents 8909ae1cc4ea
children 056280e7a6ea
comparison
equal deleted inserted replaced
38:8909ae1cc4ea 39:3c91bf85adb5
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 43
44 def test_configuration_providers(self): 44 def test_configuration_providers(self):
45 """test file-based configuration providers""" 45 """test file-based configuration providers"""
46 # require json/simplejson and pyyaml to be installed 46 # requires json/simplejson to be installed
47 47
48 example = ExampleConfiguration() 48 example = ExampleConfiguration()
49 49
50 # see what providers you got 50 # see what providers you got
51 json_provider = example.configuration_provider('json') 51 json_provider = example.configuration_provider('json')
60 example(config) 60 example(config)
61 config['test_timeout'] = 1200 # default 61 config['test_timeout'] = 1200 # default
62 self.assertEqual(config, example.config) 62 self.assertEqual(config, example.config)
63 example.serialize(filename) 63 example.serialize(filename)
64 self.assertTrue(os.path.exists(filename)) 64 self.assertTrue(os.path.exists(filename))
65 serialized = json.loads(file(filename).read())
66 self.assertEqual(serialized, config)
65 if os.path.exists(filename): 67 if os.path.exists(filename):
66 os.remove(filename) 68 os.remove(filename)
67 69
68 def test_required(self): 70 def test_required(self):
69 """ensure you have to have required values""" 71 """ensure you have to have required values"""