Merge pull request #52852 from garethgreenaway/52836_test_argspec_report_failing

[2019.2.1] Fixes to unit.utils.test_args.test_argspec_report
This commit is contained in:
Shane Lee 2019-05-07 13:25:47 -06:00 committed by GitHub
commit 77355e25fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -8,6 +8,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import copy
import fnmatch
import inspect
import logging
import re
import shlex
@ -20,6 +21,8 @@ import salt.utils.jid
import salt.utils.versions
import salt.utils.yaml
log = logging.getLogger(__name__)
if six.PY3:
KWARG_REGEX = re.compile(r'^([^\d\W][\w.-]*)=(?!=)(.*)$', re.UNICODE)

View file

@ -13,7 +13,6 @@ import salt.utils.args
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
create_autospec,
DEFAULT,
NO_MOCK,
NO_MOCK_REASON,
@ -126,11 +125,13 @@ class ArgsTestCase(TestCase):
def _test_spec(arg1, arg2, kwarg1=None):
pass
sys_mock = create_autospec(_test_spec)
test_functions = {'test_module.test_spec': sys_mock}
test_functions = {'test_module.test_spec': _test_spec}
ret = salt.utils.args.argspec_report(test_functions, 'test_module.test_spec')
self.assertDictEqual(ret, {'test_module.test_spec':
{'kwargs': True, 'args': None, 'defaults': None, 'varargs': True}})
{'kwargs': None,
'args': ['arg1', 'arg2', 'kwarg1'],
'defaults': (None, ),
'varargs': None}})
def test_test_mode(self):
self.assertTrue(salt.utils.args.test_mode(test=True))