示例#1
0
 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')
示例#2
0
    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')
示例#3
0
 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)
示例#4
0
 def test_empty(self):
     msg = rpc_pb2.SearchBuildsRequest()
     self.assert_valid(msg)