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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 redirect_stdout=True, enter_chroot=True, | 221 redirect_stdout=True, enter_chroot=True, |
222 error_ok=True).AndReturn('RESULT\n') | 222 error_ok=True).AndReturn('RESULT\n') |
223 self.mox.ReplayAll() | 223 self.mox.ReplayAll() |
224 result = cbuildbot._GetPortageEnvVar(self._buildroot, self._test_board, | 224 result = cbuildbot._GetPortageEnvVar(self._buildroot, self._test_board, |
225 envvar) | 225 envvar) |
226 self.mox.VerifyAll() | 226 self.mox.VerifyAll() |
227 self.assertEqual(result, 'RESULT') | 227 self.assertEqual(result, 'RESULT') |
228 | 228 |
229 def testUploadPublicPrebuilts(self): | 229 def testUploadPublicPrebuilts(self): |
230 """Test _UploadPrebuilts with a public location.""" | 230 """Test _UploadPrebuilts with a public location.""" |
231 check = mox.And(mox.IsA(list), mox.In('gs://chromeos-prebuilt')) | 231 binhost = 'http://www.example.com' |
| 232 binhosts = [binhost, None] |
| 233 check = mox.And(mox.IsA(list), mox.In(binhost), mox.Not(mox.In(None)), |
| 234 mox.In('gs://chromeos-prebuilt')) |
232 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) | 235 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) |
233 self.mox.ReplayAll() | 236 self.mox.ReplayAll() |
234 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'public') | 237 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'public', |
| 238 binhosts) |
235 self.mox.VerifyAll() | 239 self.mox.VerifyAll() |
236 | 240 |
237 def testUploadPrivatePrebuilts(self): | 241 def testUploadPrivatePrebuilts(self): |
238 """Test _UploadPrebuilts with a private location.""" | 242 """Test _UploadPrebuilts with a private location.""" |
239 check = mox.And(mox.IsA(list), mox.In('chromeos-images:/var/www/prebuilt/')) | 243 binhost = 'http://www.example.com' |
| 244 binhosts = [binhost, None] |
| 245 check = mox.And(mox.IsA(list), mox.In(binhost), mox.Not(mox.In(None)), |
| 246 mox.In('chromeos-images:/var/www/prebuilt/')) |
240 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) | 247 cbuildbot.RunCommand(check, cwd='%s/src/scripts' % self._buildroot) |
241 self.mox.ReplayAll() | 248 self.mox.ReplayAll() |
242 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'private') | 249 cbuildbot._UploadPrebuilts(self._buildroot, self._test_board, 'private', |
| 250 binhosts) |
243 self.mox.VerifyAll() | 251 self.mox.VerifyAll() |
244 | 252 |
245 | 253 |
246 if __name__ == '__main__': | 254 if __name__ == '__main__': |
247 unittest.main() | 255 unittest.main() |
OLD | NEW |