Merge pull request #45338 from twangboy/win_fix_test_ansiblegate

Fix `unit.modules.test_ansiblegate` for Windows
This commit is contained in:
Nicole Thomas 2018-01-19 09:21:38 -05:00 committed by GitHub
commit bef1e070aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -38,6 +38,7 @@ import subprocess
import salt.utils.json
from salt.exceptions import LoaderError, CommandExecutionError
import salt.utils.platform
import salt.utils.timed_subprocess
import salt.utils.yaml
from salt.ext import six
@ -216,6 +217,8 @@ def __virtual__():
Ansible module caller.
:return:
'''
if salt.utils.platform.is_windows():
return False, "The ansiblegate module isn't supported on Windows"
ret = ansible is not None
msg = not ret and "Ansible is not installed on this system" or None
if ret:

View File

@ -17,6 +17,7 @@
# Import Salt Testing Libs
from __future__ import absolute_import, print_function, unicode_literals
import os
try:
import pytest
except ImportError as import_error:
@ -33,18 +34,20 @@ from tests.support.mock import (
)
import salt.modules.ansiblegate as ansible
import salt.utils.platform
from salt.exceptions import LoaderError
@skipIf(NO_MOCK, NO_MOCK_REASON)
@skipIf(NO_PYTEST, False)
@skipIf(salt.utils.platform.is_windows(), 'Not supported on Windows')
class AnsiblegateTestCase(TestCase, LoaderModuleMockMixin):
def setUp(self):
self.resolver = ansible.AnsibleModuleResolver({})
self.resolver._modules_map = {
'one.two.three': '/one/two/three.py',
'four.five.six': '/four/five/six.py',
'three.six.one': '/three/six/one.py',
'one.two.three': os.sep + os.path.join('one', 'two', 'three.py'),
'four.five.six': os.sep + os.path.join('four', 'five', 'six.py'),
'three.six.one': os.sep + os.path.join('three', 'six', 'one.py'),
}
def tearDown(self):