OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 presubmit_support.py and presubmit_canned_checks.py.""" | 6 """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" |
7 | 7 |
8 import StringIO | 8 import StringIO |
9 | 9 |
10 # Fixes include path. | 10 # Fixes include path. |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 input_api = self.MockInputApi(None, True) | 1423 input_api = self.MockInputApi(None, True) |
1424 connection = self.mox.CreateMockAnything() | 1424 connection = self.mox.CreateMockAnything() |
1425 input_api.urllib2.urlopen('url_to_closed').AndReturn(connection) | 1425 input_api.urllib2.urlopen('url_to_closed').AndReturn(connection) |
1426 connection.read().AndReturn('0') | 1426 connection.read().AndReturn('0') |
1427 connection.close() | 1427 connection.close() |
1428 self.mox.ReplayAll() | 1428 self.mox.ReplayAll() |
1429 results = presubmit_canned_checks.CheckTreeIsOpen( | 1429 results = presubmit_canned_checks.CheckTreeIsOpen( |
1430 input_api, presubmit.OutputApi, url='url_to_closed', closed='0') | 1430 input_api, presubmit.OutputApi, url='url_to_closed', closed='0') |
1431 self.assertEquals(len(results), 1) | 1431 self.assertEquals(len(results), 1) |
1432 self.assertEquals(results[0].__class__, | 1432 self.assertEquals(results[0].__class__, |
1433 presubmit.OutputApi.PresubmitPromptWarning) | 1433 presubmit.OutputApi.PresubmitError) |
1434 | 1434 |
1435 def testRunPythonUnitTestsNoTest(self): | 1435 def testRunPythonUnitTestsNoTest(self): |
1436 input_api = self.MockInputApi(None, False) | 1436 input_api = self.MockInputApi(None, False) |
1437 self.mox.ReplayAll() | 1437 self.mox.ReplayAll() |
1438 results = presubmit_canned_checks.RunPythonUnitTests( | 1438 results = presubmit_canned_checks.RunPythonUnitTests( |
1439 input_api, presubmit.OutputApi, []) | 1439 input_api, presubmit.OutputApi, []) |
1440 self.assertEquals(results, []) | 1440 self.assertEquals(results, []) |
1441 | 1441 |
1442 def testRunPythonUnitTestsNonExistentUpload(self): | 1442 def testRunPythonUnitTestsNonExistentUpload(self): |
1443 input_api = self.MockInputApi(None, False) | 1443 input_api = self.MockInputApi(None, False) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( | 1603 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( |
1604 input_api, presubmit.OutputApi, 'uurl', 2, ('foo')) | 1604 input_api, presubmit.OutputApi, 'uurl', 2, ('foo')) |
1605 self.assertEquals(len(results), 1) | 1605 self.assertEquals(len(results), 1) |
1606 self.assertEquals(results[0].__class__, | 1606 self.assertEquals(results[0].__class__, |
1607 presubmit.OutputApi.PresubmitNotifyResult) | 1607 presubmit.OutputApi.PresubmitNotifyResult) |
1608 | 1608 |
1609 | 1609 |
1610 if __name__ == '__main__': | 1610 if __name__ == '__main__': |
1611 import unittest | 1611 import unittest |
1612 unittest.main() | 1612 unittest.main() |
OLD | NEW |