Chromium Code Reviews| Index: tests/trychange_unittest.py |
| diff --git a/tests/trychange_unittest.py b/tests/trychange_unittest.py |
| index f483664a5f690b68b8eaa0392bf9f28d4c4319bd..064f6ac95cd4ffb9b5d0a7ca058b3a76fd2b4951 100755 |
| --- a/tests/trychange_unittest.py |
| +++ b/tests/trychange_unittest.py |
| @@ -7,6 +7,7 @@ |
| import os |
| import sys |
| +import unittest |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| @@ -49,7 +50,7 @@ class TryChangeUnittest(TryChangeTestsBase): |
| 'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', 'SCM', 'SVN', |
| 'TryChange', 'USAGE', |
| 'breakpad', 'datetime', 'errno', 'fix_encoding', 'gcl', 'gclient_utils', |
| - 'getpass', |
| + 'getpass', 'gen_parser', |
| 'json', 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil', |
| 'subprocess2', 'sys', 'tempfile', 'urllib', |
| ] |
| @@ -57,6 +58,44 @@ class TryChangeUnittest(TryChangeTestsBase): |
| self.compareMembers(trychange, members) |
| +class TryChangeSimpleTest(unittest.TestCase): |
| + # Doesn't require supermox to run. |
| + def test_flags(self): |
| + cmd = [ |
| + '--bot', 'bot1', |
| + '--testfilter', 'test1', |
| + '--bot', 'bot2', |
| + '--testfilter', 'test2', |
| + ] |
| + options, args = trychange.gen_parser(None).parse_args(cmd) |
| + self.assertEquals([], args) |
| + # pylint: disable=W0212 |
| + values = trychange._ParseSendChangeOptions(options) |
| + self.assertEquals( |
| + [ |
| + ('user', 'maruel'), |
| + ('name', None), |
| + ('email', 'maruel@chromium.org'), |
| + ('bot', 'bot1:test1,test2'), |
| + ('bot', 'bot2:test1,test2'), |
|
Peter Mayo
2012/03/07 15:53:46
Eventually flagging this as ambiguous might be goo
M-A Ruel
2012/03/07 17:52:56
Good question. Not sure though about processing th
|
| + ], |
| + values) |
| + |
| + def test_flags_bad_combination(self): |
| + cmd = [ |
| + '--bot', 'bot1:test1', |
| + '--testfilter', 'test2', |
| + ] |
| + options, args = trychange.gen_parser(None).parse_args(cmd) |
| + self.assertEquals([], args) |
| + try: |
| + # pylint: disable=W0212 |
| + trychange._ParseSendChangeOptions(options) |
| + self.fail() |
| + except ValueError: |
| + pass |
| + |
| + |
| class SVNUnittest(TryChangeTestsBase): |
| """trychange.SVN tests.""" |
| def testMembersChanged(self): |
| @@ -111,5 +150,4 @@ class GITUnittest(TryChangeTestsBase): |
| if __name__ == '__main__': |
| - import unittest |
| unittest.main() |