aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_test
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-10-15 17:20:22 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-10-16 14:29:54 -0700
commit785efd453e1f391dda65660a62fa46b56bee89ef (patch)
tree3a73f46081319ab983e5c4e9d302e0b316f89d57 /src/python/grpcio_test
parent5e2db5b518097e9f3b3926543c8d73ef57046552 (diff)
accept --use_tls=true --use_test_ca=true in python
Diffstat (limited to 'src/python/grpcio_test')
-rw-r--r--src/python/grpcio_test/grpc_interop/client.py6
-rw-r--r--src/python/grpcio_test/grpc_interop/resources.py9
-rw-r--r--src/python/grpcio_test/grpc_interop/server.py4
3 files changed, 14 insertions, 5 deletions
diff --git a/src/python/grpcio_test/grpc_interop/client.py b/src/python/grpcio_test/grpc_interop/client.py
index 36afe6c096..01928886b4 100644
--- a/src/python/grpcio_test/grpc_interop/client.py
+++ b/src/python/grpcio_test/grpc_interop/client.py
@@ -49,11 +49,11 @@ def _args():
parser.add_argument(
'--test_case', help='the test case to execute', type=str)
parser.add_argument(
- '--use_tls', help='require a secure connection', dest='use_tls',
- action='store_true')
+ '--use_tls', help='require a secure connection', default=False,
+ type=resources.parse_bool)
parser.add_argument(
'--use_test_ca', help='replace platform root CAs with ca.pem',
- action='store_true')
+ default=False, type=resources.parse_bool)
parser.add_argument(
'--server_host_override',
help='the server host to which to claim to connect', type=str)
diff --git a/src/python/grpcio_test/grpc_interop/resources.py b/src/python/grpcio_test/grpc_interop/resources.py
index 2c3045313d..1122499418 100644
--- a/src/python/grpcio_test/grpc_interop/resources.py
+++ b/src/python/grpcio_test/grpc_interop/resources.py
@@ -29,6 +29,7 @@
"""Constants and functions for data used in interoperability testing."""
+import argparse
import os
import pkg_resources
@@ -54,3 +55,11 @@ def private_key():
def certificate_chain():
return pkg_resources.resource_string(
__name__, _CERTIFICATE_CHAIN_RESOURCE_PATH)
+
+
+def parse_bool(value):
+ if value == 'true':
+ return True
+ if value == 'false':
+ return False
+ raise argparse.ArgumentTypeError('Only true/false allowed')
diff --git a/src/python/grpcio_test/grpc_interop/server.py b/src/python/grpcio_test/grpc_interop/server.py
index 60f630a6be..d4c1b4dbf6 100644
--- a/src/python/grpcio_test/grpc_interop/server.py
+++ b/src/python/grpcio_test/grpc_interop/server.py
@@ -46,8 +46,8 @@ def serve():
parser.add_argument(
'--port', help='the port on which to serve', type=int)
parser.add_argument(
- '--use_tls', help='require a secure connection', dest='use_tls',
- action='store_true')
+ '--use_tls', help='require a secure connection',
+ default=False, type=resources.parse_bool)
args = parser.parse_args()
if args.use_tls: