コード例 #1
0
 def _mk_update_req(self, build, token='token', paths=None):
     build_req = rpc_pb2.UpdateBuildRequest(
         build=build,
         update_mask=dict(paths=paths or []),
     )
     ctx = prpc_context.ServicerContext()
     if token:
         metadata = ctx.invocation_metadata()
         metadata.append((api.BUILD_TOKEN_HEADER, token))
     return build_req, ctx
コード例 #2
0
 def test_steps_too_big(self):
     msg = rpc_pb2.UpdateBuildRequest(
         build=build_pb2.Build(id=1,
                               steps=[
                                   step_pb2.Step(
                                       name='x' * 1000,
                                       status=common_pb2.SCHEDULED),
                               ]),
         update_mask=field_mask_pb2.FieldMask(paths=['build.steps']),
     )
     self.assert_invalid(msg, r'build\.steps: too big to accept')
コード例 #3
0
ファイル: validation_test.py プロジェクト: xinghun61/infra
 def test_empty_property_value(self):
   msg = rpc_pb2.UpdateBuildRequest(
       build=build_pb2.Build(
           id=1,
           output=dict(properties=dict(fields=dict(a=struct_pb2.Value()))),
       ),
       update_mask=field_mask_pb2.FieldMask(paths=['build.output.properties']),
   )
   self.assert_invalid(
       msg, r'build\.output\.properties\.a: value is not set; '
       'for null, initialize null_value'
   )
コード例 #4
0
 def _mk_req(paths, **build_fields):
     build_fields.setdefault('id', 1)
     return rpc_pb2.UpdateBuildRequest(
         build=build_fields,
         update_mask=field_mask_pb2.FieldMask(paths=paths))