Skip to content

Commit

Permalink
add tests for ssl_verify option.
Browse files Browse the repository at this point in the history
  • Loading branch information
groutr committed Jul 21, 2015
1 parent d9395f1 commit e5ea6a8
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,3 +535,49 @@ def test_invalid_rc():
os.unlink(test_condarc)
except OSError:
pass

def test_config_set():
# Test the config set command
# Make sure it accepts only boolean values for boolean keys and any value for string keys

try:
stdout, stderr = run_conda_command('config', '--file', test_condarc,
'--set', 'always_yes', 'yep')

assert stdout == ''
assert stderr == 'Error: Key: always_yes; yep is not a YAML boolean.\n'

finally:
try:
os.unlink(test_condarc)
except OSError:
pass

def test_set_rc_string():
# Test setting string keys in .condarc

# We specifically test ssl_verify since it can be either a boolean or a string
try:
stdout, stderr = run_conda_command('config', '--file', test_condarc,
'--set', 'ssl_verify', 'yes')
assert stdout == ''
assert stderr == ''

verify = yaml.load(open(test_condarc, 'r'))['ssl_verify']
assert verify == True

stdout, stderr = run_conda_command('config', '--file', test_condarc,
'--set', 'ssl_verify', 'test_string.crt')
assert stdout == ''
assert stderr == ''

verify = yaml.load(open(test_condarc, 'r'))['ssl_verify']
assert verify == 'test_string.crt'


os.unlink(test_condarc)
finally:
try:
os.unlink(test_condarc)
except OSError:
pass

0 comments on commit e5ea6a8

Please sign in to comment.