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 """Unittests for cbuildbot. Needs to be run inside of chroot for mox.""" | 7 """Unittests for cbuildbot. Needs to be run inside of chroot for mox.""" |
8 | 8 |
9 import __builtin__ | 9 import __builtin__ |
10 import mox | 10 import mox |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 redirect_stdout=True, enter_chroot=True, | 201 redirect_stdout=True, enter_chroot=True, |
202 error_ok=True).AndReturn('RESULT\n') | 202 error_ok=True).AndReturn('RESULT\n') |
203 self.mox.ReplayAll() | 203 self.mox.ReplayAll() |
204 result = cbuildbot._GetPortageEnvVar(self._buildroot, self._test_board, | 204 result = cbuildbot._GetPortageEnvVar(self._buildroot, self._test_board, |
205 envvar) | 205 envvar) |
206 self.mox.VerifyAll() | 206 self.mox.VerifyAll() |
207 self.assertEqual(result, 'RESULT') | 207 self.assertEqual(result, 'RESULT') |
208 | 208 |
209 def testUploadPublicPrebuilts(self): | 209 def testUploadPublicPrebuilts(self): |
210 """Test _UploadPrebuilts with a public location.""" | 210 """Test _UploadPrebuilts with a public location.""" |
211 check = mox.And(mox.IsA(list), mox.In('gs://chromeos-prebuilt')) | 211 binhost = 'http://www.example.com' |
| 212 binhosts = [binhost, None] |
| 213 check = mox.And(mox.IsA(list), mox.In(binhost), mox.Not(mox.In(None)), |
| 214 mox.In('gs://chromeos-prebuilt')) |
212 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) | 215 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) |
213 self.mox.ReplayAll() | 216 self.mox.ReplayAll() |
214 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'public') | 217 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'public', |
| 218 binhosts) |
215 self.mox.VerifyAll() | 219 self.mox.VerifyAll() |
216 | 220 |
217 def testUploadPrivatePrebuilts(self): | 221 def testUploadPrivatePrebuilts(self): |
218 """Test _UploadPrebuilts with a private location.""" | 222 """Test _UploadPrebuilts with a private location.""" |
219 check = mox.And(mox.IsA(list), mox.In('chromeos-images:/var/www/prebuilt/')) | 223 binhost = 'http://www.example.com' |
| 224 binhosts = [binhost, None] |
| 225 check = mox.And(mox.IsA(list), mox.In(binhost), mox.Not(mox.In(None)), |
| 226 mox.In('chromeos-images:/var/www/prebuilt/')) |
220 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) | 227 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) |
221 self.mox.ReplayAll() | 228 self.mox.ReplayAll() |
222 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'private') | 229 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'private', |
| 230 binhosts) |
223 self.mox.VerifyAll() | 231 self.mox.VerifyAll() |
224 | 232 |
225 | 233 |
226 if __name__ == '__main__': | 234 if __name__ == '__main__': |
227 unittest.main() | 235 unittest.main() |
OLD | NEW |