| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Unit tests for cros_mark_as_stable.py.""" | 7 """Unit tests for cros_mark_as_stable.py.""" |
| 8 | 8 |
| 9 | 9 |
| 10 import mox | 10 import mox |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 self.assertEquals(ebuild.package, self.package) | 109 self.assertEquals(ebuild.package, self.package) |
| 110 self.assertEquals(ebuild.ebuild_path, self.ebuild_path) | 110 self.assertEquals(ebuild.ebuild_path, self.ebuild_path) |
| 111 self.assertEquals(ebuild.ebuild_path_no_revision, | 111 self.assertEquals(ebuild.ebuild_path_no_revision, |
| 112 '/path/test_package-0.0.1') | 112 '/path/test_package-0.0.1') |
| 113 self.assertEquals(ebuild.ebuild_path_no_version, '/path/test_package') | 113 self.assertEquals(ebuild.ebuild_path_no_version, '/path/test_package') |
| 114 self.assertEquals(ebuild.current_revision, 1) | 114 self.assertEquals(ebuild.current_revision, 1) |
| 115 self.assertEquals(ebuild.commit_id, 'my_id') | 115 self.assertEquals(ebuild.commit_id, 'my_id') |
| 116 | 116 |
| 117 def testFindEBuildPath(self): | 117 def testFindEBuildPath(self): |
| 118 self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand') | 118 self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand') |
| 119 cros_mark_as_stable._SimpleRunCommand( | 119 cmd = ('ACCEPT_KEYWORDS="x86 arm amd64" ' |
| 120 'equery-x86-generic which %s 2> /dev/null' % self.package).AndReturn( | 120 'equery-x86-generic which %s 2> /dev/null') |
| 121 self.ebuild_path) | 121 cros_mark_as_stable._SimpleRunCommand(cmd % self.package).AndReturn( |
| 122 self.ebuild_path) |
| 122 self.mox.ReplayAll() | 123 self.mox.ReplayAll() |
| 123 path = cros_mark_as_stable._EBuild._FindEBuildPath(self.package) | 124 path = cros_mark_as_stable._EBuild._FindEBuildPath(self.package) |
| 124 self.mox.VerifyAll() | 125 self.mox.VerifyAll() |
| 125 self.assertEquals(path, self.ebuild_path) | 126 self.assertEquals(path, self.ebuild_path) |
| 126 | 127 |
| 127 def testParseEBuildPath(self): | 128 def testParseEBuildPath(self): |
| 128 # Test with ebuild with revision number. | 129 # Test with ebuild with revision number. |
| 129 no_rev, no_version, revision = cros_mark_as_stable._EBuild._ParseEBuildPath( | 130 no_rev, no_version, revision = cros_mark_as_stable._EBuild._ParseEBuildPath( |
| 130 self.ebuild_path) | 131 self.ebuild_path) |
| 131 self.assertEquals(no_rev, '/path/test_package-0.0.1') | 132 self.assertEquals(no_rev, '/path/test_package-0.0.1') |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 #cros_mark_as_stable._SimpleRunCommand('git push') | 196 #cros_mark_as_stable._SimpleRunCommand('git push') |
| 196 #self.mox.ReplayAll() | 197 #self.mox.ReplayAll() |
| 197 #marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) | 198 #marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) |
| 198 #marker.PushChange() | 199 #marker.PushChange() |
| 199 #self.mox.VerifyAll() | 200 #self.mox.VerifyAll() |
| 200 pass | 201 pass |
| 201 | 202 |
| 202 | 203 |
| 203 if __name__ == '__main__': | 204 if __name__ == '__main__': |
| 204 unittest.main() | 205 unittest.main() |
| OLD | NEW |