From 7a0cf8d8c158470a3653e3157681791715a498d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ely=C3=A9zer=20Rezende?= Date: Fri, 2 Feb 2018 16:00:52 -0200 Subject: [PATCH] Update how qpc is configured Differentiate when or not to use HTTPS and to when or not validate the HTTPS connection using a certificate. --- camayoc/tests/qcs/cli/conftest.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/camayoc/tests/qcs/cli/conftest.py b/camayoc/tests/qcs/cli/conftest.py index f52aa33a..d33466d7 100644 --- a/camayoc/tests/qcs/cli/conftest.py +++ b/camayoc/tests/qcs/cli/conftest.py @@ -24,19 +24,22 @@ def qpc_server_config(): port = config.get('qcs', {}).get('port') username = config.get('qcs', {}).get('username', 'admin') password = config.get('qcs', {}).get('password', 'pass') - ssl_verify = config.get('qcs', {}).get('ssl-verify', False) - if not ssl_verify: - ssl_verify = ' --use-http' - elif ssl_verify is True: # When ssl verify is not a path - ssl_verify = '' + https = config.get('qcs', {}).get('https', False) + if not https: + https = ' --use-http' else: + https = '' + ssl_verify = config.get('qcs', {}).get('ssl-verify', False) + if ssl_verify not in (True, False): ssl_verify = ' --ssl-verify={}'.format(ssl_verify) + else: + ssl_verify = '' if not all([hostname, port]): raise ValueError( 'Both hostname and port must be defined under the qcs section on ' 'the Camayoc\'s configuration file.') - command = 'qpc server config --host {} --port {}{}'.format( - hostname, port, ssl_verify) + command = 'qpc server config --host {} --port {}{}{}'.format( + hostname, port, https, ssl_verify) qpc_server_config = pexpect.spawn(command) qpc_server_config.logfile = BytesIO() assert qpc_server_config.expect(pexpect.EOF) == 0