| Index: tests/trychange_unittest.py
|
| diff --git a/tests/trychange_unittest.py b/tests/trychange_unittest.py
|
| index f483664a5f690b68b8eaa0392bf9f28d4c4319bd..bcb568abf907a29680fa7e65ec85453559c04136 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,46 @@ 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',
|
| + '--user', 'joe',
|
| + '--email', 'joe@example.com',
|
| + ]
|
| + options, args = trychange.gen_parser(None).parse_args(cmd)
|
| + self.assertEquals([], args)
|
| + # pylint: disable=W0212
|
| + values = trychange._ParseSendChangeOptions(options)
|
| + self.assertEquals(
|
| + [
|
| + ('user', 'joe'),
|
| + ('name', None),
|
| + ('email', 'joe@example.com'),
|
| + ('bot', 'bot1:test1,test2'),
|
| + ('bot', 'bot2:test1,test2'),
|
| + ],
|
| + 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 +152,4 @@ class GITUnittest(TryChangeTestsBase):
|
|
|
|
|
| if __name__ == '__main__':
|
| - import unittest
|
| unittest.main()
|
|
|