interop/resources.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 """Constants and functions for data used in interoperability testing."""
15 
16 import argparse
17 import os
18 import pkgutil
19 
20 _ROOT_CERTIFICATES_RESOURCE_PATH = 'credentials/ca.pem'
21 _PRIVATE_KEY_RESOURCE_PATH = 'credentials/server1.key'
22 _CERTIFICATE_CHAIN_RESOURCE_PATH = 'credentials/server1.pem'
23 
24 
26  return pkgutil.get_data(__name__, _ROOT_CERTIFICATES_RESOURCE_PATH)
27 
28 
30  return pkgutil.get_data(__name__, _PRIVATE_KEY_RESOURCE_PATH)
31 
32 
34  return pkgutil.get_data(__name__, _CERTIFICATE_CHAIN_RESOURCE_PATH)
35 
36 
37 def parse_bool(value):
38  if value == 'true':
39  return True
40  if value == 'false':
41  return False
42  raise argparse.ArgumentTypeError('Only true/false allowed')
tests.interop.resources.test_root_certificates
def test_root_certificates()
Definition: interop/resources.py:25
tests.interop.resources.certificate_chain
def certificate_chain()
Definition: interop/resources.py:33
tests.interop.resources.parse_bool
def parse_bool(value)
Definition: interop/resources.py:37
tests.interop.resources.private_key
def private_key()
Definition: interop/resources.py:29


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:05