Skip to content

Commit

Permalink
Update how qpc is configured
Browse files Browse the repository at this point in the history
Differentiate when or not to use HTTPS and to when or not validate the
HTTPS connection using a certificate.
  • Loading branch information
elyezer committed Feb 2, 2018
1 parent 4dea933 commit 7a0cf8d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions camayoc/tests/qcs/cli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a0cf8d

Please sign in to comment.