Add unit test for get_supported_py_config function typecheck

This commit is contained in:
Bo Maryniuk 2018-03-26 16:35:16 +02:00
parent f833d18fd1
commit a284d73e1f
2 changed files with 11 additions and 1 deletions

View File

@ -307,7 +307,7 @@ def _get_supported_py_config(tops, extended_cfg):
elif py_ver == 3:
pymap.append('py3:3:0')
for ns, cfg in _six.iteritems(get_ext_tops(copy.deepcopy(extended_cfg) or {})):
for ns, cfg in _six.iteritems(copy.deepcopy(extended_cfg) or {}):
pymap.append('{}:{}:{}'.format(ns, *cfg.get('py-version')))
pymap.append('')

View File

@ -570,3 +570,13 @@ class SSHThinTestCase(TestCase):
assert arcname in files
files.pop(files.index(arcname))
assert not bool(files)
def test_get_supported_py_config_typecheck(self):
'''
Test collecting proper py-versions. Should return bytes type.
:return:
'''
tops = {}
ext_cfg = {}
out = thin._get_supported_py_config(tops=tops, extended_cfg=ext_cfg)
assert type(salt.utils.stringutils.to_bytes('')) == type(out)