mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Replace @skipIf(salt.utils.platform.is_windows(), ...)
usage
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
b839a6c3a8
commit
3463585037
13 changed files with 74 additions and 85 deletions
|
@ -11,7 +11,7 @@ from tests.support.unit import skipIf
|
|||
@pytest.mark.windows_whitelisted
|
||||
@skipIf(salt.utils.platform.is_darwin(), "No mtab on Darwin")
|
||||
@skipIf(salt.utils.platform.is_freebsd(), "No mtab on FreeBSD")
|
||||
@skipIf(salt.utils.platform.is_windows(), "No mtab on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No mtab on Windows")
|
||||
@pytest.mark.destructive_test
|
||||
class DiskModuleVirtualizationTest(ModuleCase):
|
||||
"""
|
||||
|
@ -67,7 +67,7 @@ class DiskModuleTest(ModuleCase):
|
|||
self.assertTrue("available" in val)
|
||||
self.assertTrue("capacity" in val)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "inode info not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="inode info not available on Windows")
|
||||
def test_inodeusage(self):
|
||||
"""
|
||||
disk.inodeusage
|
||||
|
|
|
@ -10,7 +10,6 @@ import salt.utils.platform
|
|||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import requires_system_grains
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
# Posix only
|
||||
try:
|
||||
|
@ -70,7 +69,7 @@ class FileModuleTest(ModuleCase):
|
|||
shutil.rmtree(self.mydir, ignore_errors=True)
|
||||
super().tearDown()
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No security context on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No security context on Windows")
|
||||
@requires_system_grains
|
||||
def test_get_selinux_context(self, grains):
|
||||
if grains.get("selinux", {}).get("enabled", False):
|
||||
|
@ -98,7 +97,7 @@ class FileModuleTest(ModuleCase):
|
|||
ret_file = self.run_function("file.get_selinux_context", arg=[self.myfile])
|
||||
self.assertIn("No selinux context information is available", ret_file)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No security context on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No security context on Windows")
|
||||
@requires_system_grains
|
||||
def test_set_selinux_context(self, grains):
|
||||
if not grains.get("selinux", {}).get("enabled", False):
|
||||
|
@ -116,7 +115,7 @@ class FileModuleTest(ModuleCase):
|
|||
)
|
||||
self.assertEqual(ret_dir, DIR_CONTEXT)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chown(self):
|
||||
user = getpass.getuser()
|
||||
if sys.platform == "darwin":
|
||||
|
@ -129,14 +128,14 @@ class FileModuleTest(ModuleCase):
|
|||
self.assertEqual(fstat.st_uid, os.getuid())
|
||||
self.assertEqual(fstat.st_gid, grp.getgrnam(group).gr_gid)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chown_no_user(self):
|
||||
user = "notanyuseriknow"
|
||||
group = grp.getgrgid(pwd.getpwuid(os.getuid()).pw_gid).gr_name
|
||||
ret = self.run_function("file.chown", arg=[self.myfile, user, group])
|
||||
self.assertIn("not exist", ret)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chown_no_user_no_group(self):
|
||||
user = "notanyuseriknow"
|
||||
group = "notanygroupyoushoulduse"
|
||||
|
@ -144,7 +143,7 @@ class FileModuleTest(ModuleCase):
|
|||
self.assertIn("Group does not exist", ret)
|
||||
self.assertIn("User does not exist", ret)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chown_no_path(self):
|
||||
user = getpass.getuser()
|
||||
if sys.platform == "darwin":
|
||||
|
@ -154,7 +153,7 @@ class FileModuleTest(ModuleCase):
|
|||
ret = self.run_function("file.chown", arg=["/tmp/nosuchfile", user, group])
|
||||
self.assertIn("File not found", ret)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chown_noop(self):
|
||||
user = ""
|
||||
group = ""
|
||||
|
@ -164,7 +163,7 @@ class FileModuleTest(ModuleCase):
|
|||
self.assertEqual(fstat.st_uid, os.getuid())
|
||||
self.assertEqual(fstat.st_gid, os.getgid())
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chgrp(self):
|
||||
if sys.platform == "darwin":
|
||||
group = "everyone"
|
||||
|
@ -175,7 +174,7 @@ class FileModuleTest(ModuleCase):
|
|||
fstat = os.stat(self.myfile)
|
||||
self.assertEqual(fstat.st_gid, grp.getgrnam(group).gr_gid)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No chgrp on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No chgrp on Windows")
|
||||
def test_chgrp_failure(self):
|
||||
group = "thisgroupdoesntexist"
|
||||
ret = self.run_function("file.chgrp", arg=[self.myfile, group])
|
||||
|
|
|
@ -6,7 +6,6 @@ import salt.utils.platform
|
|||
import salt.utils.stringutils
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import runs_on
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
if not salt.utils.platform.is_windows():
|
||||
import grp
|
||||
|
@ -102,7 +101,7 @@ class GroupModuleTest(ModuleCase):
|
|||
self.assertFalse(self.run_function("group.add", [self._group], gid=self._gid))
|
||||
|
||||
@pytest.mark.destructive_test
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows")
|
||||
@pytest.mark.slow_test
|
||||
def test_add_system_group(self):
|
||||
"""
|
||||
|
@ -120,7 +119,7 @@ class GroupModuleTest(ModuleCase):
|
|||
self.assertFalse(self.run_function("group.add", [self._group]))
|
||||
|
||||
@pytest.mark.destructive_test
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows")
|
||||
@pytest.mark.slow_test
|
||||
def test_add_system_group_gid(self):
|
||||
"""
|
||||
|
@ -165,7 +164,7 @@ class GroupModuleTest(ModuleCase):
|
|||
self.assertEqual(group_info["gid"], self._gid)
|
||||
self.assertIn(self._user, str(group_info["members"]))
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "gid test skipped on windows")
|
||||
@pytest.mark.skip_on_windows(reason="gid test skipped on windows")
|
||||
@pytest.mark.slow_test
|
||||
def test_chgid(self):
|
||||
"""
|
||||
|
|
|
@ -5,7 +5,7 @@ from tests.support.case import ModuleCase
|
|||
from tests.support.unit import skipIf
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "minion is windows")
|
||||
@pytest.mark.skip_on_windows(reason="minion is windows")
|
||||
@skipIf(salt.utils.platform.is_darwin(), "locale method is not supported on mac")
|
||||
@skipIf(
|
||||
salt.utils.platform.is_freebsd(),
|
||||
|
|
|
@ -23,7 +23,7 @@ class EnabledTest(ModuleCase):
|
|||
"echo duh &> /dev/null"
|
||||
)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows OS")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows OS")
|
||||
@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
|
||||
def test_shell_default_enabled(self):
|
||||
"""
|
||||
|
@ -33,7 +33,7 @@ class EnabledTest(ModuleCase):
|
|||
ret = self.run_function("cmd.run", [self.cmd])
|
||||
self.assertEqual(ret.strip(), enabled_ret)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows OS")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows OS")
|
||||
def test_shell_disabled(self):
|
||||
"""
|
||||
test shell disabled output for cmd.run
|
||||
|
@ -45,7 +45,7 @@ class EnabledTest(ModuleCase):
|
|||
ret = self.run_function("cmd.run", [self.cmd], python_shell=False)
|
||||
self.assertEqual(ret, disabled_ret)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows OS")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows OS")
|
||||
@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
|
||||
def test_template_shell(self):
|
||||
"""
|
||||
|
@ -85,7 +85,7 @@ class EnabledTest(ModuleCase):
|
|||
finally:
|
||||
os.remove(state_file)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows OS")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows OS")
|
||||
@pytest.mark.slow_test
|
||||
def test_template_default_disabled(self):
|
||||
"""
|
||||
|
|
|
@ -195,7 +195,7 @@ def test_blkid(stub_disk_blkid):
|
|||
assert stub_disk_blkid == disk.blkid()
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows")
|
||||
@skipIf(salt.utils.platform.is_darwin(), "Skip on Darwin")
|
||||
@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
|
||||
def test_blkid_token():
|
||||
|
@ -300,7 +300,7 @@ def test_resize2fs():
|
|||
mock.assert_called_once_with("resize2fs {}".format(device), python_shell=False)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows")
|
||||
@skipIf(not salt.utils.path.which("mkfs"), "mkfs not found")
|
||||
def test_format_():
|
||||
"""
|
||||
|
@ -313,7 +313,7 @@ def test_format_():
|
|||
mock.assert_any_call(["mkfs", "-t", "ext4", device], ignore_retcode=True)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Skip on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Skip on Windows")
|
||||
@skipIf(not salt.utils.path.which("mkfs"), "mkfs not found")
|
||||
def test_format__fat():
|
||||
"""
|
||||
|
|
|
@ -8,7 +8,6 @@ import salt.utils.platform
|
|||
import salt.utils.stringutils
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
from tests.support.mock import MagicMock, mock_open, patch
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
GET_ZONE_FILE = "salt.modules.timezone._get_zone_file"
|
||||
GET_LOCALTIME_PATH = "salt.modules.timezone._get_localtime_path"
|
||||
|
@ -198,7 +197,7 @@ def test_get_zone_os_family_aix():
|
|||
assert timezone.get_zone() == TEST_TZ
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_zone_os_family_nilinuxrt(patch_os):
|
||||
"""
|
||||
Test zone set on NILinuxRT
|
||||
|
@ -210,7 +209,7 @@ def test_set_zone_os_family_nilinuxrt(patch_os):
|
|||
assert timezone.set_zone(TEST_TZ)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_zone_os_family_allbsd_slackware(patch_os):
|
||||
"""
|
||||
Test zone set on *BSD and Slackware
|
||||
|
@ -221,7 +220,7 @@ def test_set_zone_os_family_allbsd_slackware(patch_os):
|
|||
assert timezone.set_zone(TEST_TZ)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_zone_redhat(patch_os):
|
||||
"""
|
||||
Test zone set on RH series
|
||||
|
@ -233,7 +232,7 @@ def test_set_zone_redhat(patch_os):
|
|||
assert args == ("/etc/sysconfig/clock", "^ZONE=.*", 'ZONE="UTC"')
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_zone_suse(patch_os):
|
||||
"""
|
||||
Test zone set on SUSE series
|
||||
|
@ -245,7 +244,7 @@ def test_set_zone_suse(patch_os):
|
|||
assert args == ("/etc/sysconfig/clock", "^TIMEZONE=.*", 'TIMEZONE="UTC"')
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_zone_gentoo(patch_os):
|
||||
"""
|
||||
Test zone set on Gentoo series
|
||||
|
@ -259,7 +258,7 @@ def test_set_zone_gentoo(patch_os):
|
|||
assert fh_.write_calls == ["UTC", "\n"], fh_.write_calls
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_zone_debian(patch_os):
|
||||
"""
|
||||
Test zone set on Debian series
|
||||
|
@ -273,7 +272,7 @@ def test_set_zone_debian(patch_os):
|
|||
assert fh_.write_calls == ["UTC", "\n"], fh_.write_calls
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_timedate_utc():
|
||||
"""
|
||||
Test get hwclock UTC/localtime
|
||||
|
@ -295,7 +294,7 @@ def test_get_hwclock_timedate_utc():
|
|||
assert timezone.get_hwclock() == "localtime"
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_suse(patch_os):
|
||||
"""
|
||||
Test get hwclock on SUSE
|
||||
|
@ -308,7 +307,7 @@ def test_get_hwclock_suse(patch_os):
|
|||
assert kwarg == {"python_shell": False}
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_redhat(patch_os):
|
||||
"""
|
||||
Test get hwclock on RedHat
|
||||
|
@ -335,7 +334,7 @@ def _test_get_hwclock_debian(
|
|||
assert kwarg == {"python_shell": False}
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_solaris(patch_os):
|
||||
"""
|
||||
Test get hwclock on Solaris
|
||||
|
@ -348,7 +347,7 @@ def test_get_hwclock_solaris(patch_os):
|
|||
assert timezone.get_hwclock() == "localtime"
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_aix(patch_os):
|
||||
"""
|
||||
Test get hwclock on AIX
|
||||
|
@ -362,7 +361,7 @@ def test_get_hwclock_aix(patch_os):
|
|||
assert timezone.get_hwclock() == hwclock
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_slackware_with_adjtime(patch_os):
|
||||
"""
|
||||
Test get hwclock on Slackware with /etc/adjtime present
|
||||
|
@ -375,7 +374,7 @@ def test_get_hwclock_slackware_with_adjtime(patch_os):
|
|||
assert kwarg == {"python_shell": False}
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_get_hwclock_slackware_without_adjtime():
|
||||
"""
|
||||
Test get hwclock on Slackware without /etc/adjtime present
|
||||
|
@ -396,7 +395,7 @@ def test_get_hwclock_slackware_without_adjtime():
|
|||
assert timezone.get_hwclock() == "localtime"
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_timedatectl():
|
||||
"""
|
||||
Test set hwclock with timedatectl
|
||||
|
@ -414,7 +413,7 @@ def test_set_hwclock_timedatectl():
|
|||
assert args == (["timedatectl", "set-local-rtc", "true"],)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_aix_nilinuxrt(patch_os):
|
||||
"""
|
||||
Test set hwclock on AIX and NILinuxRT
|
||||
|
@ -427,7 +426,7 @@ def test_set_hwclock_aix_nilinuxrt(patch_os):
|
|||
assert timezone.set_hwclock("UTC")
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_solaris(patch_os):
|
||||
"""
|
||||
Test set hwclock on Solaris
|
||||
|
@ -447,7 +446,7 @@ def test_set_hwclock_solaris(patch_os):
|
|||
assert kwargs == {"python_shell": False}
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_arch(patch_os):
|
||||
"""
|
||||
Test set hwclock on arch
|
||||
|
@ -463,7 +462,7 @@ def test_set_hwclock_arch(patch_os):
|
|||
assert kwargs == {"python_shell": False}
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_redhat(patch_os):
|
||||
"""
|
||||
Test set hwclock on RedHat
|
||||
|
@ -478,7 +477,7 @@ def test_set_hwclock_redhat(patch_os):
|
|||
assert args == ("/etc/sysconfig/clock", "^ZONE=.*", 'ZONE="TEST_TIMEZONE"')
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_suse(patch_os):
|
||||
"""
|
||||
Test set hwclock on SUSE
|
||||
|
@ -497,7 +496,7 @@ def test_set_hwclock_suse(patch_os):
|
|||
)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_debian(patch_os):
|
||||
"""
|
||||
Test set hwclock on Debian
|
||||
|
@ -516,7 +515,7 @@ def test_set_hwclock_debian(patch_os):
|
|||
assert args == ("/etc/default/rcS", "^UTC=.*", "UTC=no")
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_gentoo(patch_os):
|
||||
"""
|
||||
Test set hwclock on Gentoo
|
||||
|
@ -538,7 +537,7 @@ def test_set_hwclock_gentoo(patch_os):
|
|||
assert args == ("/etc/conf.d/hwclock", "^clock=.*", 'clock="local"')
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "os.symlink not available in Windows")
|
||||
@pytest.mark.skip_on_windows(reason="os.symlink not available in Windows")
|
||||
def test_set_hwclock_slackware(patch_os):
|
||||
"""
|
||||
Test set hwclock on Slackware
|
||||
|
|
|
@ -12,7 +12,7 @@ import salt.utils.files
|
|||
import salt.utils.platform
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.mock import MagicMock, patch
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
try:
|
||||
from salt.utils.odict import OrderedDict as odict
|
||||
|
@ -846,7 +846,7 @@ test_interfaces = [
|
|||
# fmt: on
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Do not run these tests on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Do not run these tests on Windows")
|
||||
class DebianIpTestCase(TestCase, LoaderModuleMockMixin):
|
||||
"""
|
||||
Test cases for salt.modules.debian_ip
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
"""
|
||||
Test module for syslog_ng
|
||||
"""
|
||||
|
||||
# Import Python modules
|
||||
|
||||
import os
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.modules.syslog_ng as syslog_ng
|
||||
import salt.utils.platform
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.mock import MagicMock, patch
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
_VERSION = "3.6.0alpha0"
|
||||
_MODULES = (
|
||||
|
@ -232,7 +227,7 @@ class SyslogNGTestCase(TestCase, LoaderModuleMockMixin):
|
|||
b,
|
||||
)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Module not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Module not available on Windows")
|
||||
def test_version(self):
|
||||
cmd_ret = {"retcode": 0, "stdout": VERSION_OUTPUT}
|
||||
expected_output = {"retcode": 0, "stdout": _VERSION}
|
||||
|
@ -256,7 +251,7 @@ class SyslogNGTestCase(TestCase, LoaderModuleMockMixin):
|
|||
cmd_args, env=self.mocked_env, python_shell=False
|
||||
)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Module not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Module not available on Windows")
|
||||
def test_stats(self):
|
||||
cmd_ret = {"retcode": 0, "stdout": STATS_OUTPUT}
|
||||
cmd_args = ["syslog-ng-ctl", "stats"]
|
||||
|
@ -279,7 +274,7 @@ class SyslogNGTestCase(TestCase, LoaderModuleMockMixin):
|
|||
cmd_args, env=self.mocked_env, python_shell=False
|
||||
)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Module not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Module not available on Windows")
|
||||
def test_modules(self):
|
||||
cmd_ret = {"retcode": 0, "stdout": VERSION_OUTPUT}
|
||||
expected_output = {"retcode": 0, "stdout": _MODULES}
|
||||
|
@ -303,7 +298,7 @@ class SyslogNGTestCase(TestCase, LoaderModuleMockMixin):
|
|||
cmd_args, env=self.mocked_env, python_shell=False
|
||||
)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Module not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Module not available on Windows")
|
||||
def test_config_test(self):
|
||||
cmd_ret = {"retcode": 0, "stderr": "", "stdout": "Foo"}
|
||||
cmd_args = ["syslog-ng", "--syntax-only"]
|
||||
|
@ -326,7 +321,7 @@ class SyslogNGTestCase(TestCase, LoaderModuleMockMixin):
|
|||
cmd_args, env=self.mocked_env, python_shell=False
|
||||
)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Module not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Module not available on Windows")
|
||||
def test_config_test_cfgfile(self):
|
||||
cfgfile = "/path/to/syslog-ng.conf"
|
||||
cmd_ret = {"retcode": 1, "stderr": "Syntax error...", "stdout": ""}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
:codeauthor: Mike Place <mp@saltstack.com>
|
||||
"""
|
||||
|
||||
|
||||
import time
|
||||
|
||||
# Import Salt libraries
|
||||
import pytest
|
||||
|
||||
import salt.master
|
||||
import salt.utils.platform
|
||||
from salt import auth
|
||||
from salt.exceptions import SaltDeserializationError
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.mock import MagicMock, call, patch
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
|
||||
class LoadAuthTestCase(TestCase):
|
||||
|
@ -253,7 +253,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
}
|
||||
self.addCleanup(delattr, self, "valid_clear_load")
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_master_publish_name(self):
|
||||
"""
|
||||
Test to ensure a simple name can auth against a given function.
|
||||
|
@ -335,7 +335,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
self.clear.publish(self.valid_clear_load)
|
||||
self.assertEqual(self.fire_event_mock.mock_calls, [])
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_master_minion_glob(self):
|
||||
"""
|
||||
Test to ensure we can allow access to a given
|
||||
|
@ -384,7 +384,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
"""
|
||||
# Unimplemented
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_args_empty_spec(self):
|
||||
"""
|
||||
Test simple arg restriction allowed.
|
||||
|
@ -410,7 +410,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
self.clear.publish(self.valid_clear_load)
|
||||
self.assertEqual(self.fire_event_mock.call_args[0][0]["fun"], "test.empty")
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_args_simple_match(self):
|
||||
"""
|
||||
Test simple arg restriction allowed.
|
||||
|
@ -439,7 +439,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
self.clear.publish(self.valid_clear_load)
|
||||
self.assertEqual(self.fire_event_mock.call_args[0][0]["fun"], "test.echo")
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_args_more_args(self):
|
||||
"""
|
||||
Test simple arg restriction allowed to pass unlisted args.
|
||||
|
@ -515,7 +515,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
self.clear.publish(self.valid_clear_load)
|
||||
self.assertEqual(self.fire_event_mock.mock_calls, [])
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_args_kwargs_match(self):
|
||||
"""
|
||||
Test simple kwargs restriction allowed.
|
||||
|
@ -607,7 +607,7 @@ class MasterACLTestCase(ModuleCase):
|
|||
self.clear.publish(self.valid_clear_load)
|
||||
self.assertEqual(self.fire_event_mock.mock_calls, [])
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_args_mixed_match(self):
|
||||
"""
|
||||
Test mixed args and kwargs restriction allowed.
|
||||
|
@ -784,7 +784,7 @@ class AuthACLTestCase(ModuleCase):
|
|||
}
|
||||
self.addCleanup(delattr, self, "valid_clear_load")
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "PAM eauth not available on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="PAM eauth not available on Windows")
|
||||
def test_acl_simple_allow(self):
|
||||
self.clear.publish(self.valid_clear_load)
|
||||
self.assertEqual(
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""
|
||||
:codeauthor: Mike Place <mp@saltstack.com>
|
||||
"""
|
||||
|
||||
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
|
@ -19,7 +17,6 @@ import salt.transport.ipc
|
|||
import salt.utils.platform
|
||||
from salt.ext.tornado.iostream import StreamClosedError
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip_on_darwin,
|
||||
|
@ -30,7 +27,7 @@ pytestmark = [
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Windows does not support Posix IPC")
|
||||
@pytest.mark.skip_on_windows(reason="Windows does not support Posix IPC")
|
||||
class IPCMessagePubSubCase(salt.ext.tornado.testing.AsyncTestCase):
|
||||
"""
|
||||
Test all of the clear msg stuff
|
||||
|
|
|
@ -12,7 +12,7 @@ import salt.utils.path
|
|||
import salt.utils.platform
|
||||
from salt.exceptions import CommandNotFoundError
|
||||
from tests.support.mock import patch
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
|
||||
class PathJoinTestCase(TestCase):
|
||||
|
@ -73,7 +73,7 @@ class PathJoinTestCase(TestCase):
|
|||
|
||||
self.__unpatch_path()
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "*nix-only test")
|
||||
@pytest.mark.skip_on_windows(reason="*nix-only test")
|
||||
def test_mixed_unicode_and_binary(self):
|
||||
"""
|
||||
This tests joining paths that contain a mix of components with unicode
|
||||
|
|
|
@ -31,7 +31,7 @@ from salt.utils.verify import (
|
|||
from tests.support.helpers import TstSuiteLoggingHandler
|
||||
from tests.support.mock import MagicMock, patch
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
import win32file
|
||||
|
@ -105,7 +105,7 @@ class TestVerify(TestCase):
|
|||
# If there's a different error catch, write it to sys.stderr
|
||||
sys.stderr.write(writer.output)
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "No verify_env Windows")
|
||||
@pytest.mark.skip_on_windows(reason="No verify_env Windows")
|
||||
def test_verify_env(self):
|
||||
root_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP)
|
||||
var_dir = os.path.join(root_dir, "var", "log", "salt")
|
||||
|
@ -293,22 +293,22 @@ class TestVerifyLog(TestCase):
|
|||
)
|
||||
assert filtered == ["/tmp/foo"], filtered
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Not applicable on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Not applicable on Windows")
|
||||
def test_verify_log_files_udp_scheme(self):
|
||||
verify_log_files(["udp://foo"], getpass.getuser())
|
||||
self.assertFalse(os.path.isdir(os.path.join(os.getcwd(), "udp:")))
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Not applicable on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Not applicable on Windows")
|
||||
def test_verify_log_files_tcp_scheme(self):
|
||||
verify_log_files(["udp://foo"], getpass.getuser())
|
||||
self.assertFalse(os.path.isdir(os.path.join(os.getcwd(), "tcp:")))
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Not applicable on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Not applicable on Windows")
|
||||
def test_verify_log_files_file_scheme(self):
|
||||
verify_log_files(["file://{}"], getpass.getuser())
|
||||
self.assertFalse(os.path.isdir(os.path.join(os.getcwd(), "file:")))
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "Not applicable on Windows")
|
||||
@pytest.mark.skip_on_windows(reason="Not applicable on Windows")
|
||||
def test_verify_log_files(self):
|
||||
path = os.path.join(self.tmpdir, "foo", "bar.log")
|
||||
self.assertFalse(os.path.exists(path))
|
||||
|
|
Loading…
Add table
Reference in a new issue