view tests/unit.py @ 21:0fe74db6a56c

a hacky way to do CLI types handlers
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 26 Mar 2012 14:45:36 -0700
parents cadc9514f60a
children 39f2611db9be
line wrap: on
line source

#!/usr/bin/env python

"""
unit tests
"""

import os
import sys
import unittest

from example import ExampleConfiguration # example configuration to test

# globals
here = os.path.dirname(os.path.abspath(__file__))

class configurationUnitTest(unittest.TestCase):

    def test_configuration(self):
        example = ExampleConfiguration()

        # parse command line arguments
        options, args = example.parse(['-a', 'ts', '--develop', '-e', '/home/jhammel/bin/firefox'])
        self.assertEqual(bool(args), False) # no arguments
        self.assertEqual(options.develop, True)

if __name__ == '__main__':
    unittest.main()