Mercurial > hg > configuration
comparison tests/unit.py @ 30:b27a7cb2dd5b
stub test for configuration providers
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Mon, 26 Mar 2012 17:05:02 -0700 |
| parents | c516ab813079 |
| children | da4d5c5831c6 |
comparison
equal
deleted
inserted
replaced
| 29:fadcc6ab51d4 | 30:b27a7cb2dd5b |
|---|---|
| 2 | 2 |
| 3 """ | 3 """ |
| 4 unit tests | 4 unit tests |
| 5 """ | 5 """ |
| 6 | 6 |
| 7 import configuration | |
| 7 import os | 8 import os |
| 8 import sys | 9 import sys |
| 9 import unittest | 10 import unittest |
| 10 | 11 |
| 11 from example import ExampleConfiguration # example configuration to test | 12 from example import ExampleConfiguration # example configuration to test |
| 34 self.assertEqual(example.config['activeTests'], ['ts']) | 35 self.assertEqual(example.config['activeTests'], ['ts']) |
| 35 self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox') | 36 self.assertEqual(example.config['browser_path'], '/home/jhammel/bin/firefox') |
| 36 | 37 |
| 37 def test_configuration_providers(self): | 38 def test_configuration_providers(self): |
| 38 """test file-based configuration providers""" | 39 """test file-based configuration providers""" |
| 40 # require json/simplejson and pyyaml to be installed | |
| 41 | |
| 42 example = ExampleConfiguration() | |
| 43 | |
| 44 # see what providers you got | |
| 45 json_provider = example.configuration_provider('json') | |
| 46 self.assertTrue(isinstance(json_provider, configuration.JSON)) | |
| 39 | 47 |
| 40 if __name__ == '__main__': | 48 if __name__ == '__main__': |
| 41 unittest.main() | 49 unittest.main() |
| 42 | 50 |
