Example #1
0
 def testNoBuildbucketOutput(self):
   """Tests that a failure to get Buildbucket output is surfaced."""
   self._bb_mock.return_value = ''
   try_builder, found_mirror = builders._GetMirroredBuildersForCiBuilder(
       'foo_ci')
   self.assertFalse(found_mirror)
   self.assertEqual(try_builder, set(['foo_ci']))
Example #2
0
 def testFakeCiBuilder(self):
   """Tests that a fake CI builder gets properly mapped."""
   with mock.patch.object(builders, 'FAKE_CI_BUILDERS', {'foo_ci': 'foo_try'}):
     try_builder, found_mirror = builders._GetMirroredBuildersForCiBuilder(
         'foo_ci')
   self.assertTrue(found_mirror)
   self.assertEqual(try_builder, set(['foo_try']))
   self._bb_mock.assert_not_called()
Example #3
0
 def testBuildbucketOutput(self):
   """Tests that Buildbucket output is parsed correctly."""
   self._bb_mock.return_value = json.dumps({
       'output': {
           'properties': {
               'mirrored_builders': [
                   'try:foo_try',
                   'try:bar_try',
               ]
           }
       }
   })
   try_builders, found_mirror = builders._GetMirroredBuildersForCiBuilder(
       'foo_ci')
   self.assertTrue(found_mirror)
   self.assertEqual(try_builders, set(['foo_try', 'bar_try']))