| 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 # pylint is too confused. | 8 # pylint is too confused. |
| 9 # pylint: disable=E1101,E1103,W0212,W0403 | 9 # pylint: disable=E1101,E1103,W0212,W0403 |
| 10 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 binary, 'svn:mime-type').AndReturn('application/octet-stream') | 250 binary, 'svn:mime-type').AndReturn('application/octet-stream') |
| 251 presubmit.scm.SVN.GetFileProperty( | 251 presubmit.scm.SVN.GetFileProperty( |
| 252 notfound, 'svn:mime-type').AndReturn('') | 252 notfound, 'svn:mime-type').AndReturn('') |
| 253 presubmit.scm.SVN.CaptureInfo(blat).AndReturn( | 253 presubmit.scm.SVN.CaptureInfo(blat).AndReturn( |
| 254 {'URL': 'svn:/foo/foo/blat.cc'}) | 254 {'URL': 'svn:/foo/foo/blat.cc'}) |
| 255 presubmit.scm.SVN.CaptureInfo(binary).AndReturn( | 255 presubmit.scm.SVN.CaptureInfo(binary).AndReturn( |
| 256 {'URL': 'svn:/foo/binary.dll'}) | 256 {'URL': 'svn:/foo/binary.dll'}) |
| 257 presubmit.scm.SVN.CaptureInfo(notfound).AndReturn({}) | 257 presubmit.scm.SVN.CaptureInfo(notfound).AndReturn({}) |
| 258 presubmit.scm.SVN.CaptureInfo(flap).AndReturn( | 258 presubmit.scm.SVN.CaptureInfo(flap).AndReturn( |
| 259 {'URL': 'svn:/foo/boo/flap.h'}) | 259 {'URL': 'svn:/foo/boo/flap.h'}) |
| 260 presubmit.scm.SVN.GenerateDiff(blat).AndReturn(self.presubmit_diffs) | 260 presubmit.scm.SVN.GenerateDiff([blat]).AndReturn(self.presubmit_diffs) |
| 261 presubmit.scm.SVN.GenerateDiff(notfound).AndReturn(self.presubmit_diffs) | 261 presubmit.scm.SVN.GenerateDiff([notfound]).AndReturn(self.presubmit_diffs) |
| 262 | 262 |
| 263 self.mox.ReplayAll() | 263 self.mox.ReplayAll() |
| 264 | 264 |
| 265 change = presubmit.SvnChange('mychange', '\n'.join(description_lines), | 265 change = presubmit.SvnChange('mychange', '\n'.join(description_lines), |
| 266 self.fake_root_dir, files, 0, 0) | 266 self.fake_root_dir, files, 0, 0) |
| 267 self.failUnless(change.Name() == 'mychange') | 267 self.failUnless(change.Name() == 'mychange') |
| 268 self.failUnless(change.DescriptionText() == | 268 self.failUnless(change.DescriptionText() == |
| 269 'Hello there\nthis is a change\nand some more regular text') | 269 'Hello there\nthis is a change\nand some more regular text') |
| 270 self.failUnless(change.FullDescriptionText() == | 270 self.failUnless(change.FullDescriptionText() == |
| 271 '\n'.join(description_lines)) | 271 '\n'.join(description_lines)) |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 presubmit.scm.SVN.CaptureInfo(beingdeleted).AndReturn({}) | 769 presubmit.scm.SVN.CaptureInfo(beingdeleted).AndReturn({}) |
| 770 presubmit.scm.SVN.CaptureInfo(notfound).AndReturn({}) | 770 presubmit.scm.SVN.CaptureInfo(notfound).AndReturn({}) |
| 771 presubmit.scm.SVN.GetFileProperty(blat, 'svn:mime-type').AndReturn(None) | 771 presubmit.scm.SVN.GetFileProperty(blat, 'svn:mime-type').AndReturn(None) |
| 772 presubmit.scm.SVN.GetFileProperty(readme, 'svn:mime-type').AndReturn(None) | 772 presubmit.scm.SVN.GetFileProperty(readme, 'svn:mime-type').AndReturn(None) |
| 773 presubmit.scm.SVN.GetFileProperty(binary, 'svn:mime-type').AndReturn( | 773 presubmit.scm.SVN.GetFileProperty(binary, 'svn:mime-type').AndReturn( |
| 774 'application/octet-stream') | 774 'application/octet-stream') |
| 775 presubmit.scm.SVN.GetFileProperty(weird, 'svn:mime-type').AndReturn(None) | 775 presubmit.scm.SVN.GetFileProperty(weird, 'svn:mime-type').AndReturn(None) |
| 776 presubmit.scm.SVN.GetFileProperty(another, 'svn:mime-type').AndReturn(None) | 776 presubmit.scm.SVN.GetFileProperty(another, 'svn:mime-type').AndReturn(None) |
| 777 presubmit.scm.SVN.GetFileProperty(third_party, 'svn:mime-type' | 777 presubmit.scm.SVN.GetFileProperty(third_party, 'svn:mime-type' |
| 778 ).AndReturn(None) | 778 ).AndReturn(None) |
| 779 presubmit.scm.SVN.GenerateDiff(blat).AndReturn(self.presubmit_diffs) | 779 presubmit.scm.SVN.GenerateDiff([blat]).AndReturn(self.presubmit_diffs) |
| 780 presubmit.scm.SVN.GenerateDiff(another).AndReturn(self.presubmit_diffs) | 780 presubmit.scm.SVN.GenerateDiff([another]).AndReturn(self.presubmit_diffs) |
| 781 | 781 |
| 782 self.mox.ReplayAll() | 782 self.mox.ReplayAll() |
| 783 | 783 |
| 784 change = presubmit.SvnChange('mychange', '\n'.join(description_lines), | 784 change = presubmit.SvnChange('mychange', '\n'.join(description_lines), |
| 785 self.fake_root_dir, files, 0, 0) | 785 self.fake_root_dir, files, 0, 0) |
| 786 input_api = presubmit.InputApi(change, | 786 input_api = presubmit.InputApi(change, |
| 787 join(self.fake_root_dir, 'foo', | 787 join(self.fake_root_dir, 'foo', |
| 788 'PRESUBMIT.py'), | 788 'PRESUBMIT.py'), |
| 789 False) | 789 False) |
| 790 # Doesn't filter much | 790 # Doesn't filter much |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( | 1829 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( |
| 1830 input_api, presubmit.OutputApi, 'uurl', 2, ('foo')) | 1830 input_api, presubmit.OutputApi, 'uurl', 2, ('foo')) |
| 1831 self.assertEquals(len(results), 1) | 1831 self.assertEquals(len(results), 1) |
| 1832 self.assertEquals(results[0].__class__, | 1832 self.assertEquals(results[0].__class__, |
| 1833 presubmit.OutputApi.PresubmitNotifyResult) | 1833 presubmit.OutputApi.PresubmitNotifyResult) |
| 1834 | 1834 |
| 1835 | 1835 |
| 1836 if __name__ == '__main__': | 1836 if __name__ == '__main__': |
| 1837 import unittest | 1837 import unittest |
| 1838 unittest.main() | 1838 unittest.main() |
| OLD | NEW |