_secure_intraop_test.py
Go to the documentation of this file.
1 # Copyright 2015 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 """Secure client-server interoperability as a unit test."""
15 
16 import sys
17 import unittest
18 
19 import grpc
20 
21 from src.proto.grpc.testing import test_pb2_grpc
22 from tests.interop import _intraop_test_case
23 from tests.interop import resources
24 from tests.interop import service
25 from tests.unit import test_common
26 
27 _SERVER_HOST_OVERRIDE = 'foo.test.google.fr'
28 
29 
30 @unittest.skipIf(sys.version_info[0] < 3,
31  'ProtoBuf descriptor has moved on from Python2')
33 
34  def setUp(self):
35  self.server = test_common.test_server()
36  test_pb2_grpc.add_TestServiceServicer_to_server(service.TestService(),
37  self.server)
38  port = self.server.add_secure_port(
39  '[::]:0',
40  grpc.ssl_server_credentials([(resources.private_key(),
41  resources.certificate_chain())]))
42  self.server.start()
43  self.stub = test_pb2_grpc.TestServiceStub(
45  'localhost:{}'.format(port),
47  resources.test_root_certificates()), ((
48  'grpc.ssl_target_name_override',
49  _SERVER_HOST_OVERRIDE,
50  ),)))
51 
52  def tearDown(self):
53  self.server.stop(None)
54 
55 
56 if __name__ == '__main__':
57  unittest.main(verbosity=2)
http2_test_server.format
format
Definition: http2_test_server.py:118
tests.interop._secure_intraop_test.SecureIntraopTest.stub
stub
Definition: _secure_intraop_test.py:43
tests.interop._secure_intraop_test.SecureIntraopTest.server
server
Definition: _secure_intraop_test.py:35
start
static uint64_t start
Definition: benchmark-pound.c:74
grpc.ssl_server_credentials
def ssl_server_credentials(private_key_certificate_chain_pairs, root_certificates=None, require_client_auth=False)
Definition: src/python/grpcio/grpc/__init__.py:1709
tests.interop.service.TestService
Definition: src/python/grpcio_tests/tests/interop/service.py:49
tests.interop._secure_intraop_test.SecureIntraopTest.setUp
def setUp(self)
Definition: _secure_intraop_test.py:34
tests.unit
Definition: src/python/grpcio_tests/tests/unit/__init__.py:1
tests.interop
Definition: src/python/grpcio_tests/tests/interop/__init__.py:1
tests.interop._intraop_test_case.IntraopTestCase
Definition: _intraop_test_case.py:19
grpc.ssl_channel_credentials
def ssl_channel_credentials(root_certificates=None, private_key=None, certificate_chain=None)
Definition: src/python/grpcio/grpc/__init__.py:1607
stop
static const char stop[]
Definition: benchmark-async-pummel.c:35
tests.interop._secure_intraop_test.SecureIntraopTest
Definition: _secure_intraop_test.py:32
tests.interop._secure_intraop_test.SecureIntraopTest.tearDown
def tearDown(self)
Definition: _secure_intraop_test.py:52
grpc.secure_channel
def secure_channel(target, credentials, options=None, compression=None)
Definition: src/python/grpcio/grpc/__init__.py:1982


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:38