def test_bad_page_size(self): msg = rpc_pb2.SearchBuildsRequest( predicate=rpc_pb2.BuildPredicate(builder=build_pb2.BuilderID( project='chromium', bucket='try', builder='linux-rel'), ), page_size=-1, ) self.assert_invalid(msg, r'page_size: must be not be negative')
def test_basic(self, search_async): builds = [test_util.build(id=54), test_util.build(id=55)] search_async.return_value = future((builds, 'next page token')) req = rpc_pb2.SearchBuildsRequest( predicate=dict(builder=dict(project='chromium', bucket='try', builder='linux-try'), ), page_size=10, page_token='page token', ) res = self.call(self.api.SearchBuilds, req) search_async.assert_called_once_with( search.Query( bucket_ids=['chromium/try'], builder='linux-try', include_experimental=False, tags=[], status=common_pb2.STATUS_UNSPECIFIED, max_builds=10, start_cursor='page token', )) self.assertEqual(len(res.builds), 2) self.assertEqual(res.builds[0].id, 54) self.assertEqual(res.builds[1].id, 55) self.assertEqual(res.next_page_token, 'next page token')
def test_valid(self): msg = rpc_pb2.SearchBuildsRequest( predicate=rpc_pb2.BuildPredicate(builder=build_pb2.BuilderID( project='chromium', bucket='try', builder='linux-rel', ), )) self.assert_valid(msg)
def test_empty(self): msg = rpc_pb2.SearchBuildsRequest() self.assert_valid(msg)