diff --git a/salt/states/hanamod.py b/salt/states/hanamod.py index 20921398..469f0ad6 100644 --- a/salt/states/hanamod.py +++ b/salt/states/hanamod.py @@ -790,6 +790,12 @@ def pydbapi_extracted( 'extraction)'.format(output_dir) return ret + if __opts__['test']: + ret['result'] = None + ret['comment'] = '{} would be extracted'.format(name) + ret['changes']['output_dir'] = output_dir + return ret + __salt__['file.mkdir'](output_dir) try: diff --git a/tests/unit/states/test_hanamod.py b/tests/unit/states/test_hanamod.py index 6e6e01e1..97e49a8a 100644 --- a/tests/unit/states/test_hanamod.py +++ b/tests/unit/states/test_hanamod.py @@ -1056,6 +1056,16 @@ def test_pydbapi_extracted_already_exists(self): mock_dir_exists.assert_called_once_with('/tmp/output') + def test_pydbapi_extracted_test(self): + ret = {'name': 'PYDBAPI.tar', + 'changes': {'output_dir': '/tmp/output'}, + 'result': None, + 'comment': 'PYDBAPI.tar would be extracted'} + + with patch.dict(hanamod.__opts__, {'test': True}): + assert hanamod.pydbapi_extracted( + 'PYDBAPI.tar', ['1234', '5678'], '/tmp/output', force=True) == ret + def test_pydbapi_extracted_error(self): ret = {'name': 'PYDBAPI.tar', 'changes': {},