| 1 |
# Copyright 2017 gRPC authors. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
"""An example gRPC Python-using application's common code elements.""" |
| 15 |
|
| 16 |
from tests.testing.proto import requests_pb2 |
| 17 |
from tests.testing.proto import services_pb2 |
| 18 |
|
| 19 |
SERVICE_NAME = 'tests_of_grpc_testing.FirstService' |
| 20 |
UNARY_UNARY_METHOD_NAME = 'UnUn' |
| 21 |
UNARY_STREAM_METHOD_NAME = 'UnStre' |
| 22 |
STREAM_UNARY_METHOD_NAME = 'StreUn' |
| 23 |
STREAM_STREAM_METHOD_NAME = 'StreStre' |
| 24 |
|
| 25 |
UNARY_UNARY_REQUEST = requests_pb2.Up(first_up_field=2) |
| 26 |
ERRONEOUS_UNARY_UNARY_REQUEST = requests_pb2.Up(first_up_field=3) |
| 27 |
UNARY_UNARY_RESPONSE = services_pb2.Down(first_down_field=5) |
| 28 |
ERRONEOUS_UNARY_UNARY_RESPONSE = services_pb2.Down(first_down_field=7) |
| 29 |
UNARY_STREAM_REQUEST = requests_pb2.Charm(first_charm_field=11) |
| 30 |
STREAM_UNARY_REQUEST = requests_pb2.Charm(first_charm_field=13) |
| 31 |
STREAM_UNARY_RESPONSE = services_pb2.Strange(first_strange_field=17) |
| 32 |
STREAM_STREAM_REQUEST = requests_pb2.Top(first_top_field=19) |
| 33 |
STREAM_STREAM_RESPONSE = services_pb2.Bottom(first_bottom_field=23) |
| 34 |
TWO_STREAM_STREAM_RESPONSES = (STREAM_STREAM_RESPONSE,) * 2 |
| 35 |
ABORT_REQUEST = requests_pb2.Up(first_up_field=42) |
| 36 |
ABORT_SUCCESS_QUERY = requests_pb2.Up(first_up_field=43) |
| 37 |
ABORT_NO_STATUS_RESPONSE = services_pb2.Down(first_down_field=50) |
| 38 |
ABORT_SUCCESS_RESPONSE = services_pb2.Down(first_down_field=51) |
| 39 |
ABORT_FAILURE_RESPONSE = services_pb2.Down(first_down_field=52) |
| 40 |
STREAM_STREAM_MUTATING_REQUEST = requests_pb2.Top(first_top_field=24601) |
| 41 |
STREAM_STREAM_MUTATING_COUNT = 2 |
| 42 |
|
| 43 |
INFINITE_REQUEST_STREAM_TIMEOUT = 0.2 |