Esempio n. 1
0
 def testGetBuildHistoryOtherArgs(self):
   """Test GetBuildHistory's processing of (args - ignore_build_id)."""
   builder = build_pb2.BuilderID(project='chromeos', bucket='general')
   tags = [common_pb2.StringPair(key='cbb_config',
                                 value='something-paladin'),
           common_pb2.StringPair(key='cbb_branch',
                                 value='master')]
   start_date = date(2019, 4, 16)
   create_time = buildbucket_v2.DateToTimeRange(start_date)
   fake_build = rpc_pb2.BuildRange(start_build_id=1234)
   fake_predicate = rpc_pb2.BuildPredicate(
       builder=builder, tags=tags, create_time=create_time, build=fake_build)
   bbv2 = buildbucket_v2.BuildbucketV2()
   search_fn = self.PatchObject(bbv2, 'SearchBuild')
   self.PatchObject(bbv2, 'GetBuildStatus')
   bbv2.GetBuildHistory('something-paladin', 10, start_date=start_date,
                        branch='master', start_build_id=1234)
   search_fn.assert_called_once_with(fake_predicate, page_size=10)
 def testDateToTimeRangeEndDate(self):
     date_example = date(2019, 4, 15)
     result = buildbucket_v2.DateToTimeRange(end_date=date_example)
     self.assertEqual(result.end_time.seconds, 1555372740)
     self.assertEqual(result.start_time.seconds, 0)
 def testDateToTimeRangeNoneInput(self):
     self.assertIsNone(buildbucket_v2.DateToTimeRange(None))