From a284d73e1fd1fb650b4fb6dc173ac4ac0431f6c3 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Mon, 26 Mar 2018 16:35:16 +0200 Subject: [PATCH] Add unit test for get_supported_py_config function typecheck --- salt/utils/thin.py | 2 +- tests/unit/utils/test_thin.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/salt/utils/thin.py b/salt/utils/thin.py index b69b6e4a1f..bf1d40649c 100644 --- a/salt/utils/thin.py +++ b/salt/utils/thin.py @@ -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('') diff --git a/tests/unit/utils/test_thin.py b/tests/unit/utils/test_thin.py index f05023366c..ca3333fd78 100644 --- a/tests/unit/utils/test_thin.py +++ b/tests/unit/utils/test_thin.py @@ -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)