OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Unit tests for trychange.py.""" | 6 """Unit tests for trychange.py.""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 'subprocess2', 'sys', 'tempfile', 'urllib', | 55 'subprocess2', 'sys', 'tempfile', 'urllib', |
56 ] | 56 ] |
57 # If this test fails, you should add the relevant test. | 57 # If this test fails, you should add the relevant test. |
58 self.compareMembers(trychange, members) | 58 self.compareMembers(trychange, members) |
59 | 59 |
60 | 60 |
61 class TryChangeSimpleTest(unittest.TestCase): | 61 class TryChangeSimpleTest(unittest.TestCase): |
62 # Doesn't require supermox to run. | 62 # Doesn't require supermox to run. |
63 def test_flags(self): | 63 def test_flags(self): |
64 cmd = [ | 64 cmd = [ |
65 '--bot', 'bot1', | 65 '--bot', 'bot1,bot2', |
66 '--testfilter', 'test1', | 66 '--testfilter', 'test1', |
67 '--bot', 'bot2', | |
68 '--testfilter', 'test2', | 67 '--testfilter', 'test2', |
69 '--user', 'joe', | 68 '--user', 'joe', |
70 '--email', 'joe@example.com', | 69 '--email', 'joe@example.com', |
71 ] | 70 ] |
72 options, args = trychange.gen_parser(None).parse_args(cmd) | 71 options, args = trychange.gen_parser(None).parse_args(cmd) |
73 self.assertEquals([], args) | 72 self.assertEquals([], args) |
74 # pylint: disable=W0212 | 73 # pylint: disable=W0212 |
75 values = trychange._ParseSendChangeOptions(options) | 74 values = trychange._ParseSendChangeOptions(options) |
76 self.assertEquals( | 75 self.assertEquals( |
77 [ | 76 [ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') | 145 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') |
147 self.mox.ReplayAll() | 146 self.mox.ReplayAll() |
148 git = trychange.GIT(self.options, self.fake_root, self.options.files) | 147 git = trychange.GIT(self.options, self.fake_root, self.options.files) |
149 self.assertEqual(git.GetFileNames(), self.expected_files) | 148 self.assertEqual(git.GetFileNames(), self.expected_files) |
150 self.assertEqual(git.checkout_root, self.fake_root) | 149 self.assertEqual(git.checkout_root, self.fake_root) |
151 self.assertEqual(git.GenerateDiff(), 'A diff') | 150 self.assertEqual(git.GenerateDiff(), 'A diff') |
152 | 151 |
153 | 152 |
154 if __name__ == '__main__': | 153 if __name__ == '__main__': |
155 unittest.main() | 154 unittest.main() |
OLD | NEW |