annotate tests/unit.py @ 28:c516ab813079

begin stubbing serialization/deserialization
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 26 Mar 2012 16:54:37 -0700
parents b39e550402ea
children b27a7cb2dd5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 unit tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 import os
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 import sys
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 import unittest
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10
19
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
11 from example import ExampleConfiguration # example configuration to test
11
e00afe2c83bf stubbing configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
12
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 # globals
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 here = os.path.dirname(os.path.abspath(__file__))
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15
24
39f2611db9be rename a bunch of things and begin to work on the sanity of validation
Jeff Hammel <jhammel@mozilla.com>
parents: 19
diff changeset
16 class ConfigurationUnitTest(unittest.TestCase):
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
24
39f2611db9be rename a bunch of things and begin to work on the sanity of validation
Jeff Hammel <jhammel@mozilla.com>
parents: 19
diff changeset
18 def test_cli(self):
28
c516ab813079 begin stubbing serialization/deserialization
Jeff Hammel <jhammel@mozilla.com>
parents: 25
diff changeset
19 """test command line interface"""
c516ab813079 begin stubbing serialization/deserialization
Jeff Hammel <jhammel@mozilla.com>
parents: 25
diff changeset
20
19
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
21 example = ExampleConfiguration()
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
22
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
23 # parse command line arguments
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
24 options, args = example.parse(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox'])
25
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
25
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
26 # ensure that the options appropriately get set
19
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
27 self.assertEqual(bool(args), False) # no arguments
cadc9514f60a we have a legitimately failing test!
Jeff Hammel <jhammel@mozilla.com>
parents: 11
diff changeset
28 self.assertEqual(options.develop, True)
25
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
29 self.assertEqual(options.activeTests, ['ts'])
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
30 self.assertEqual(options.browser_path, '/home/jhammel/bin/firefox')
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
31
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
32 # ensure that the configuration appropriately gets updated
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
33 self.assertEqual(example.config['develop'], True)
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
34 self.assertEqual(example.config['activeTests'], ['ts'])
b39e550402ea we now update configuration correctly
Jeff Hammel <jhammel@mozilla.com>
parents: 24
diff changeset
35 self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox')
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36
28
c516ab813079 begin stubbing serialization/deserialization
Jeff Hammel <jhammel@mozilla.com>
parents: 25
diff changeset
37 def test_configuration_providers(self):
c516ab813079 begin stubbing serialization/deserialization
Jeff Hammel <jhammel@mozilla.com>
parents: 25
diff changeset
38 """test file-based configuration providers"""
c516ab813079 begin stubbing serialization/deserialization
Jeff Hammel <jhammel@mozilla.com>
parents: 25
diff changeset
39
0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 if __name__ == '__main__':
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
41 unittest.main()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
42