Absolute imports and A LOT of code cleanup.

This commit is contained in:
Pedro Algarvio 2017-02-27 15:59:04 +00:00
parent 3beb3fb801
commit 40a64191a1
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
696 changed files with 413 additions and 5580 deletions

View file

@ -292066,7 +292066,7 @@ the test method:
.nf
.ft C
import integration
from salttesting.helpers import destructiveTest
from tests.support.helpers import destructiveTest
class PkgTest(integration.ModuleCase):
@destructiveTest
@ -292162,7 +292162,7 @@ can be used
.nf
.ft C
# Import logging handler
from salttesting.helpers import TestsLoggingHandler
from tests.support.helpers import TestsLoggingHandler
# .. inside test
with TestsLoggingHandler() as handler:

View file

@ -429,7 +429,7 @@ Test Helpers
------------
Several Salt-specific helpers are available. A full list is available by inspecting
functions exported in `salttesting.helpers`.
functions exported in `tests.support.helpers`.
`@expensiveTest` -- Designates a test which typically requires a relatively costly
external resource, like a cloud virtual machine. This decorator is not normally
@ -453,10 +453,10 @@ the test will be skipped if the binaries are not all present on the system.
`@skip_if_not_root` -- If the test is not executed as root, it will be skipped.
`@with_system_user` -- Creates and optionally destroys a system user within a test case.
See implementation details in `salttesting.helpers` for details.
See implementation details in `tests.support.helpers` for details.
`@with_system_group` -- Creates and optionally destroys a system group within a test case.
See implementation details in `salttesting.helpers` for details.
See implementation details in `tests.support.helpers` for details.
`@with_system_user_and_group` -- Creates and optionally destroys a system user and group
within a test case. See implementation details in `salttesting.helpers` for details.
within a test case. See implementation details in `tests.support.helpers` for details.

View file

@ -272,7 +272,7 @@ Now the workhorse method ``run_function`` can be used to test a module:
.. code-block:: python
import os
import integration
import tests.integration as integration
class TestModuleTest(integration.ModuleCase):
@ -312,7 +312,7 @@ Validating the shell commands can be done via shell tests:
import shutil
import tempfile
import integration
import tests.integration as integration
class KeyTest(integration.ShellCase):
'''
@ -345,7 +345,7 @@ Testing salt-ssh functionality can be done using the SSHCase test class:
.. code-block:: python
import integration
import tests.integration as integration
class SSHGrainsTest(integration.SSHCase):
'''
@ -370,7 +370,7 @@ on a minion event bus.
.. code-block:: python
import integration
import tests.integration as integration
class TestEvent(integration.SaltEventAssertsMixin):
'''
@ -392,7 +392,7 @@ Testing Salt's Syndic can be done via the SyndicCase test class:
.. code-block:: python
import integration
import tests.integration as integration
class TestSyndic(integration.SyndicCase):
'''
@ -438,11 +438,9 @@ to test states:
import shutil
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import integration
import salt.utils
HFILE = os.path.join(integration.TMP, 'hosts')
@ -506,8 +504,8 @@ the test method:
.. code-block:: python
import integration
from salttesting.helpers import destructiveTest
import tests.integration as integration
from tests.support.helpers import destructiveTest
class DestructiveExampleModuleTest(integration.ModuleCase):
'''
@ -628,7 +626,7 @@ the test function:
.. code-block:: python
from salttesting.helpers import expensiveTest
from tests.support.helpers import expensiveTest
@expensiveTest
def test_instance(self):

View file

@ -122,14 +122,13 @@ Most commonly, the following imports are necessary to create a unit test:
.. code-block:: python
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from tests.support.unit import skipIf, TestCase
If you need mock support to your tests, please also import:
.. code-block:: python
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch, call
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch, call
Evaluating Truth
@ -183,13 +182,13 @@ additional imports for MagicMock:
.. code-block:: python
# Import Salt Testing libs
from salttesting import TestCase
from tests.support.unit import TestCase
# Import Salt execution module to test
from salt.modules import db
# Import Mock libraries
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch, call
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch, call
# Create test case class and inherit from Salt's customized TestCase
# Skip this test case if we don't have access to mock!
@ -259,7 +258,7 @@ we might write the skeleton for testing ``fib.py``:
.. code-block:: python
# Import Salt Testing libs
from salttesting import TestCase
from tests.support.unit import TestCase
# Import Salt execution module to test
from salt.modules import fib
@ -339,17 +338,14 @@ will also redefine the ``__salt__`` dictionary such that it only contains
from salt.modules import linux_sysctl
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import (
from tests.support.unit import skipIf, TestCase
from tests.support.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
ensure_in_syspath('../../')
# Globals
linux_sysctl.__salt__ = {}
@ -368,11 +364,6 @@ will also redefine the ``__salt__`` dictionary such that it only contains
with patch.dict(linux_sysctl.__salt__, {'cmd.run': mock_cmd}):
self.assertEqual(linux_sysctl.get('net.ipv4.ip_forward'), 1)
if __name__ == '__main__':
from integration import run_tests
run_tests(LinuxSysctlTestCase, needs_daemon=False)
Since ``get()`` has only one raise or return statement and that statement is a
success condition, the test function is simply named ``test_get()``. As
described, the single function call parameter, ``name`` is mocked with
@ -450,17 +441,14 @@ with.
from salt.exceptions import CommandExecutionError
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import (
from tests.support.unit import skipIf, TestCase
from tests.support.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
ensure_in_syspath('../../')
# Globals
linux_sysctl.__salt__ = {}
@ -510,7 +498,3 @@ with.
with patch.dict(linux_sysctl.__salt__, {'cmd.run_all': mock_cmd}):
self.assertEqual(linux_sysctl.assign(
'net.ipv4.ip_forward', 1), ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(LinuxSysctlTestCase, needs_daemon=False)

View file

@ -379,7 +379,7 @@ the test method:
.. code-block:: python
import integration
from salttesting.helpers import destructiveTest
from tests.support.helpers import destructiveTest
class PkgTest(integration.ModuleCase):
@destructiveTest
@ -462,7 +462,7 @@ can be used
.. code-block:: python
# Import logging handler
from salttesting.helpers import TestsLoggingHandler
from tests.support.helpers import TestsLoggingHandler
# .. inside test
with TestsLoggingHandler() as handler:

View file

@ -7,9 +7,9 @@
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf
from tests.support.unit import skipIf
from tests.unit import ModuleTestCase, hasDependency
from salttesting.mock import (
from tests.support.mock import (
patch,
NO_MOCK,
NO_MOCK_REASON

View file

@ -7,9 +7,9 @@
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf
from tests.support.unit import skipIf
from tests.unit import ModuleTestCase, hasDependency
from salttesting.mock import (
from tests.support.mock import (
patch,
NO_MOCK,
NO_MOCK_REASON

View file

@ -542,7 +542,8 @@ def session_pillar_tree_root_dir(session_integration_files_dir):
@pytest.fixture(scope='session')
def test_daemon(request):
from collections import namedtuple
from integration import TestDaemon, PNUM
from tests.integration import TestDaemon
from tests.support.parser import PNUM
values = (('transport', request.config.getoption('--transport')),
('sysinfo', request.config.getoption('--sysinfo')),
('no_colors', request.config.getoption('--no-colors')),

View file

@ -51,8 +51,7 @@ from tests.support.unit import TestCase
from tests.support.case import ShellTestCase
from tests.support.mixins import CheckShellBinaryNameAndVersionMixin, ShellCaseCommonTestsMixin
from tests.support.parser import PNUM, print_header, SaltTestcaseParser
from tests.support.helpers import requires_sshd_server
from tests.support.helpers import ensure_in_syspath, RedirectStdStreams
from tests.support.helpers import requires_sshd_server, RedirectStdStreams
# Import Salt libs
import salt
@ -167,67 +166,6 @@ atexit.register(close_open_sockets, _RUNTESTS_PORTS)
SALT_LOG_PORT = get_unused_localhost_port()
def run_tests(*test_cases, **kwargs):
'''
Run integration tests for the chosen test cases.
Function uses optparse to set up test environment
'''
needs_daemon = kwargs.pop('needs_daemon', True)
if kwargs:
raise RuntimeError(
'The \'run_tests\' function only accepts \'needs_daemon\' as a '
'keyword argument'
)
class TestcaseParser(SaltTestcaseParser):
def setup_additional_options(self):
self.add_option(
'--sysinfo',
default=False,
action='store_true',
help='Print some system information.'
)
self.output_options_group.add_option(
'--no-colors',
'--no-colours',
default=False,
action='store_true',
help='Disable colour printing.'
)
if needs_daemon:
self.add_option(
'--transport',
default='zeromq',
choices=('zeromq', 'raet', 'tcp'),
help=('Select which transport to run the integration tests with, '
'zeromq, raet, or tcp. Default: %default')
)
def validate_options(self):
SaltTestcaseParser.validate_options(self)
# Transplant configuration
transport = None
if needs_daemon:
transport = self.options.transport
TestDaemon.transplant_configs(transport=transport)
def run_testcase(self, testcase, needs_daemon=True): # pylint: disable=W0221
if needs_daemon:
print(' * Setting up Salt daemons to execute tests')
with TestDaemon(self):
return SaltTestcaseParser.run_testcase(self, testcase)
return SaltTestcaseParser.run_testcase(self, testcase)
parser = TestcaseParser()
parser.parse_args()
for case in test_cases:
if parser.run_testcase(case, needs_daemon=needs_daemon) is False:
parser.finalize(1)
parser.finalize(0)
class ThreadingMixIn(socketserver.ThreadingMixIn):
daemon_threads = True

View file

@ -6,12 +6,7 @@
from __future__ import absolute_import
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Libs
import integration
import tests.integration as integration
class BatchTest(integration.ShellCase):
@ -60,7 +55,3 @@ class BatchTest(integration.ShellCase):
'''
cmd = self.run_salt(' "*" state.single test.fail_without_changes name=test_me -b 25%', with_retcode=True)
self.assertEqual(cmd[-1], 2)
if __name__ == '__main__':
from integration import run_tests
run_tests(BatchTest)

View file

@ -38,7 +38,7 @@
from __future__ import absolute_import
# Import Salt Libs
import integration
import tests.integration as integration
class SSHCustomModuleTest(integration.SSHCase):
@ -78,8 +78,3 @@ class SSHCustomModuleTest(integration.SSHCase):
raise AssertionError(cmd[key]['comment'])
cmd_ret = cmd[key]['changes'].get('ret', None)
self.assertEqual(cmd_ret, expected[key])
if __name__ == '__main__':
from integration import run_tests
run_tests(SSHCustomModuleTest)

View file

@ -17,13 +17,10 @@ from __future__ import absolute_import
import os
# Import Salt Libs
import integration
import salt.utils
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
class GrainsTargetingTest(integration.ShellCase):
@ -90,8 +87,3 @@ class SSHGrainsTest(integration.SSHCase):
'''
cmd = self.run_function('grains.get', ['id'])
self.assertEqual(cmd, 'localhost')
if __name__ == '__main__':
from integration import run_tests
run_tests(SSHGrainsTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class StdTest(integration.ModuleCase):
@ -93,8 +89,3 @@ class StdTest(integration.ModuleCase):
self.assertIn('int', data['args'][1])
self.assertIn('dict', data['kwargs']['outer'])
self.assertIn('str', data['kwargs']['inner'])
if __name__ == '__main__':
from integration import run_tests
run_tests(StdTest)

View file

@ -4,7 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
import integration
import tests.integration as integration
from tests.support.unit import skipIf
# Import Salt libs
@ -100,8 +100,3 @@ class RunnerModuleTest(integration.TestCase, integration.AdaptedConfigurationTes
'bar': 'Bar!',
}
self.runner.cmd_sync(low)
if __name__ == '__main__':
from integration import run_tests
run_tests(RunnerModuleTest, needs_daemon=True)

View file

@ -5,11 +5,9 @@ from __future__ import absolute_import
import os
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import integration
import salt.utils
@ -149,8 +147,3 @@ class StdTest(integration.ModuleCase):
finally:
os.unlink(key_file)
if __name__ == '__main__':
from integration import run_tests
run_tests(StdTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class TestSyndic(integration.SyndicCase):
@ -32,8 +28,3 @@ class TestSyndic(integration.SyndicCase):
)[0],
6765
)
if __name__ == '__main__':
from integration import run_tests
run_tests(TestSyndic)

View file

@ -12,7 +12,7 @@ from tests.support.unit import skipIf
# Import Salt libs
import salt.ext.six as six
import integration
import tests.integration as integration
import salt.utils.virtualbox
# Create the cloud instance name to be used throughout the tests

View file

@ -10,12 +10,10 @@ import random
import string
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
import tests.integration as integration
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
# Import 3rd-party libs
@ -177,8 +175,3 @@ class DigitalOceanTest(integration.ShellCase):
# To run this for each test when not all tests create instances.
if INSTANCE_NAME in [i.strip() for i in self.run_cloud('--query')]:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests
run_tests(DigitalOceanTest)

View file

@ -10,13 +10,11 @@ import random
import string
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
import tests.integration as integration
from tests.support.helpers import expensiveTest
# Import Third-Party Libs
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
@ -127,8 +125,3 @@ class EC2Test(integration.ShellCase):
# if test instance is still present, delete it
if ret_str in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests
run_tests(EC2Test)

View file

@ -11,13 +11,11 @@ import random
import string
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
import tests.integration as integration
from tests.support.helpers import expensiveTest
# Import Third-Party Libs
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
@ -157,8 +155,3 @@ class GCETest(integration.ShellCase):
# if test instance is still present, delete it
if ret_str in query:
self.run_cloud('-d {0} --assume-yes'.format(self.INSTANCE_NAME), timeout=TIMEOUT)
if __name__ == '__main__':
from integration import run_tests
run_tests(GCETest)

View file

@ -10,13 +10,11 @@ import random
import string
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
import tests.integration as integration
from tests.support.helpers import expensiveTest
from tests.support.unit import skipIf
ensure_in_syspath('../../../')
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
from salt.ext.six.moves import range
@ -111,8 +109,3 @@ class GoGridTest(integration.ShellCase):
# if test instance is still present, delete it
if ret_str in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests
run_tests(GoGridTest)

View file

@ -10,12 +10,10 @@ import random
import string
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
import tests.integration as integration
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
from salt.ext.six.moves import range # pylint: disable=redefined-builtin
@ -111,8 +109,3 @@ class JoyentTest(integration.ShellCase):
# if test instance is still present, delete it
if ret_str in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests
run_tests(JoyentTest)

View file

@ -10,12 +10,10 @@ import random
import string
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
import tests.integration as integration
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
from salt.ext.six.moves import range
@ -109,8 +107,3 @@ class LinodeTest(integration.ShellCase):
# if test instance is still present, delete it
if ret_str in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests # pylint: disable=import-error
run_tests(LinodeTest)

View file

@ -11,13 +11,11 @@ import string
from distutils.version import LooseVersion
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
# Import Third-Party Libs
@ -177,8 +175,3 @@ class AzureTest(integration.ShellCase):
if ret_str in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME),
timeout=TIMEOUT)
if __name__ == '__main__':
from integration import run_tests # pylint: disable=import-error
run_tests(AzureTest)

View file

@ -8,15 +8,10 @@ from __future__ import absolute_import
import logging
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath
)
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
log = logging.getLogger(__name__)
NO_KEYSTONE = False
@ -161,8 +156,3 @@ class OpenstackTest(integration.ModuleCase,
tenant_name='admin')
driver.authenticate()
self.assertTrue(driver.auth_token)
if __name__ == '__main__':
from integration import run_tests
run_tests(OpenstackTest)

View file

@ -10,13 +10,11 @@ import random
import string
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
from salt.ext.six.moves import range
@ -134,8 +132,3 @@ class ProfitBricksTest(integration.ShellCase):
# if test instance is still present, delete it
if ret in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests # pylint: disable=import-error
run_tests(ProfitBricksTest)

View file

@ -10,13 +10,11 @@ import random
import string
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
from salt.ext.six.moves import range
@ -119,8 +117,3 @@ class RackspaceTest(integration.ShellCase):
# if test instance is still present, delete it
if ret in query:
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
if __name__ == '__main__':
from integration import run_tests # pylint: disable=import-error
run_tests(RackspaceTest)

View file

@ -10,32 +10,37 @@ import logging
import socket
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
from integration.cloud.helpers.virtualbox import VirtualboxTestCase, VirtualboxCloudTestCase, CONFIG_NAME, \
PROVIDER_NAME, \
PROFILE_NAME, BASE_BOX_NAME, INSTANCE_NAME, BOOTABLE_BASE_BOX_NAME, DEPLOY_PROFILE_NAME
ensure_in_syspath('../../../')
from tests.integration.cloud.helpers.virtualbox import (VirtualboxTestCase,
VirtualboxCloudTestCase,
CONFIG_NAME,
PROVIDER_NAME,
PROFILE_NAME,
BASE_BOX_NAME,
INSTANCE_NAME,
BOOTABLE_BASE_BOX_NAME,
DEPLOY_PROFILE_NAME)
# Import Salt Libs
import salt.ext.six as six
from salt.ext.six.moves import range
import integration
from salt.config import cloud_providers_config, vm_profiles_config
from salt.utils.virtualbox import vb_xpcom_to_attribute_dict, vb_clone_vm, vb_destroy_machine, vb_create_machine, \
vb_get_box, vb_machine_exists, XPCOM_ATTRIBUTES, vb_start_vm, vb_stop_vm, \
vb_get_network_addresses, vb_wait_for_network_address, machine_get_machinestate_str, HAS_LIBS
from salt.utils.virtualbox import (vb_xpcom_to_attribute_dict,
vb_clone_vm,
vb_destroy_machine,
vb_create_machine,
vb_get_box,
vb_machine_exists,
XPCOM_ATTRIBUTES,
vb_start_vm,
vb_stop_vm,
vb_get_network_addresses,
vb_wait_for_network_address,
machine_get_machinestate_str,
HAS_LIBS)
# Setup logging
log = logging.getLogger()
log = logging.getLogger(__name__)
# log_handler = logging.StreamHandler()
# log_handler.setLevel(logging.INFO)
# log.addHandler(log_handler)
# log.setLevel(logging.INFO)
info = log.info
# As described in the documentation of list_nodes (this may change with time)
MINIMAL_MACHINE_ATTRIBUTES = [
@ -300,7 +305,7 @@ class VirtualboxProviderHeavyTests(VirtualboxCloudTestCase):
def test_start_stop_action(self):
res = self.run_cloud_action("start", BOOTABLE_BASE_BOX_NAME, timeout=10)
info(res)
log.info(res)
machine = res.get(BOOTABLE_BASE_BOX_NAME)
self.assertIsNotNone(machine)
@ -309,7 +314,7 @@ class VirtualboxProviderHeavyTests(VirtualboxCloudTestCase):
self.assertEqual(state, expected_state)
res = self.run_cloud_action("stop", BOOTABLE_BASE_BOX_NAME, timeout=10)
info(res)
log.info(res)
machine = res.get(BOOTABLE_BASE_BOX_NAME)
self.assertIsNotNone(machine)
@ -425,7 +430,7 @@ class XpcomConversionTests(unittest.TestCase):
self.assertIsNotNone(expected_attributes, "%s is unknown")
for key in ret.keys():
for key in ret:
self.assertIn(key, expected_attributes)
def test_override_attributes(self):
@ -460,7 +465,7 @@ class XpcomConversionTests(unittest.TestCase):
self.assertDictEqual(ret, expected_machine)
ret_keys = ret.keys()
for key in expected_extras.keys():
for key in expected_extras:
self.assertIn(key, ret_keys)
def test_extra_nonexistant_attributes(self):
@ -481,10 +486,3 @@ class XpcomConversionTests(unittest.TestCase):
ret = vb_xpcom_to_attribute_dict(xpcom, extra_attributes=expected_extras)
self.assertDictEqual(ret, expected_extra_dict)
if __name__ == '__main__':
from integration import run_tests # pylint: disable=import-error
run_tests(VirtualboxProviderTest)
# unittest.main()

View file

@ -11,12 +11,10 @@ import string
import time
# Import Salt Testing Libs
from tests.support.helpers import ensure_in_syspath, expensiveTest
ensure_in_syspath('../../../')
import tests.integration as integration
from tests.support.helpers import expensiveTest
# Import Salt Libs
import integration
from salt.config import cloud_providers_config
# Import 3rd-party libs
@ -188,8 +186,3 @@ class VultrTest(integration.ShellCase):
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME), timeout=500)
time.sleep(30)
ct = ct + 1
if __name__ == '__main__':
from integration import run_tests
run_tests(VultrTest)

View file

@ -12,16 +12,15 @@ import shutil
log = logging.getLogger(__name__)
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
from tests.support.helpers import destructiveTest
from tests.support.mock import MagicMock, patch, NO_MOCK, NO_MOCK_REASON
ensure_in_syspath('../..')
# Import salt libs
import integration
import salt.utils
from salt import fileclient
from salt.ext import six
import salt.ext.six as six
SALTENVS = ('base', 'dev')
FS_ROOT = os.path.join(integration.TMP, 'fileclient_fs_root')
@ -351,8 +350,3 @@ class FileclientCacheTest(integration.ModuleCase):
log.debug('cache_loc = %s', cache_loc)
log.debug('content = %s', content)
self.assertTrue(saltenv in content)
if __name__ == '__main__':
from integration import run_tests
run_tests(FileClientTest)

View file

@ -10,14 +10,11 @@ import pwd
import shutil
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
from tests.support.mock import patch, NO_MOCK, NO_MOCK_REASON
ensure_in_syspath('../..')
# Import salt libs
import integration
from salt.fileserver import gitfs
gitfs.__opts__ = {'cachedir': '/tmp/gitfs_test_cache',
@ -133,6 +130,3 @@ class GitFSTest(integration.ModuleCase):
'__role': self.master_opts['__role']}):
ret = gitfs.envs()
self.assertIn('base', ret)
if __name__ == '__main__':
integration.run_tests(GitFSTest)

View file

@ -8,13 +8,11 @@ from __future__ import absolute_import
import os
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
from tests.support.mock import patch, NO_MOCK, NO_MOCK_REASON
ensure_in_syspath('../..')
# Import salt libs
import integration
from salt.fileserver import roots
from salt import fileclient
import salt.utils
@ -211,8 +209,3 @@ class RootsLimitTraversalTest(integration.ModuleCase):
self.assertIn('test_deep.test', ret)
self.assertIn('test_deep.a.test', ret)
self.assertNotIn('test_deep.b.2.test', ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(RootsTest, RootsLimitTraversalTest)

View file

@ -7,13 +7,10 @@ Test the core grains
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
if salt.utils.is_windows():
try:

View file

@ -13,7 +13,7 @@ from __future__ import absolute_import
from tests.support.unit import skipIf
# Import salt libs
import integration
import tests.integration as integration
from salt.config import minion_config
from salt.loader import grains

View file

@ -13,11 +13,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../')
# Import salt libs
import integration
import tests.integration as integration
class LoaderOverridesTest(integration.ModuleCase):
@ -40,8 +36,3 @@ class LoaderOverridesTest(integration.ModuleCase):
self.run_function('test.echo', arg=[text])[::-1],
self.run_function('test.recho', arg=[text]),
)
if __name__ == '__main__':
from integration import run_tests
run_tests(LoaderOverridesTest)

View file

@ -10,12 +10,9 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import integration
import salt.loader
import inspect
import yaml
@ -142,8 +139,3 @@ class LoaderGlobalsTest(integration.ModuleCase):
- __context__ # Context dict shared amongst all modules of the same type
'''
self._verify_globals(salt.loader.render(self.master_opts, {}))
if __name__ == '__main__':
from integration import run_tests
run_tests(LoaderGlobalsTest, needs_daemon=False)

View file

@ -11,14 +11,10 @@ from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.unit import TestCase
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import salt.ext.six as six
from salt.config import minion_config
import salt.loader
# TODO: the rest of the public interfaces
@ -38,7 +34,3 @@ class RawModTest(TestCase):
self.opts = minion_config(None)
testmod = salt.loader.raw_mod(self.opts, 'module_we_do_not_have', None)
self.assertEqual(testmod, {})
if __name__ == '__main__':
from integration import run_tests
run_tests(RawModTest)

View file

@ -19,11 +19,7 @@ log = logging.getLogger(__name__)
# Import Salt Testing libs
from tests.support.unit import TestCase
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import integration # pylint: disable=import-error
import tests.integration as integration
# Import Salt libs
import salt.utils

View file

@ -10,12 +10,10 @@ from time import sleep
import textwrap
# Import Salt Testing libs
from tests.support.helpers import destructiveTest, ensure_in_syspath
ensure_in_syspath('../')
import tests.integration as integration
from tests.support.helpers import destructiveTest
# Import Salt libs
import integration
import salt.utils
@ -101,8 +99,3 @@ class MinionBlackoutTestCase(integration.ModuleCase):
self.assertIn('Minion in blackout mode.', cloud_ret)
finally:
self.end_blackout()
if __name__ == '__main__':
from integration import run_tests
run_tests(MinionBlackoutTestCase, needs_daemon=True)

View file

@ -2,16 +2,9 @@
'''
:codeauthor: :email:`Erik Johnson <erik@saltstack.com>`
'''
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, requires_system_grains
from tests.support.mock import NO_MOCK, NO_MOCK_REASON
ensure_in_syspath('../..')
# Import Python libs
from __future__ import absolute_import
import copy
import errno
import logging
@ -21,18 +14,21 @@ import textwrap
import yaml
from subprocess import Popen, PIPE, STDOUT
log = logging.getLogger(__name__)
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import requires_system_grains
from tests.support.mock import NO_MOCK, NO_MOCK_REASON
# Import 3rd-party libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('..')
import salt.ext.six as six
# Import salt libs
import integration
import salt.utils
from salt import pillar
log = logging.getLogger(__name__)
GPG_HOMEDIR = os.path.join(integration.TMP_CONF_DIR, 'gpgkeys')
PILLAR_BASE = os.path.join(integration.TMP, 'test-decrypt-pillar', 'pillar')
@ -373,7 +369,3 @@ class DecryptGPGPillarTest(integration.ModuleCase):
'not a valid decryption renderer. Valid choices are: foo, bar'
]
self.assertEqual(ret, expected)
if __name__ == '__main__':
integration.run_tests(DecryptGPGPillarTest)

View file

@ -7,10 +7,7 @@ Tests for various minion timeouts
from __future__ import absolute_import
# Import Salt Testing libs
import integration
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../')
import tests.integration as integration
class MinionTimeoutTestCase(integration.ShellCase):
@ -29,8 +26,3 @@ class MinionTimeoutTestCase(integration.ShellCase):
' may have returned error: {0}'.format(ret))
self.assertTrue('True' in ret[1], 'Minion did not return True after '
'{0} seconds.'.format(sleep_length))
if __name__ == '__main__':
from integration import run_tests
run_tests(MinionTimeoutTestCase, needs_daemon=True)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class AliasesTest(integration.ModuleCase):
@ -74,8 +70,3 @@ class AliasesTest(integration.ModuleCase):
'aliases.list_aliases')
self.assertIsInstance(tgt_ret, dict)
self.assertNotIn('alias=frank', tgt_ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(AliasesTest)

View file

@ -9,15 +9,11 @@ import shutil
import textwrap
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath
)
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
# Import 3rd party libs
@ -264,8 +260,3 @@ class ArchiveTest(integration.ModuleCase):
self._assert_artifacts_in_ret(ret)
self._tear_down()
if __name__ == '__main__':
from integration import run_tests
run_tests(ArchiveTest)

View file

@ -9,7 +9,7 @@ import os
# Salt Libs
from salt.exceptions import CommandExecutionError
import integration
import tests.integration as integration
import salt.utils
# Salttesting libs

View file

@ -7,12 +7,8 @@ Validate the boto_iam module
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
# Import 3rd-party libs
NO_BOTO_MODULE = True

View file

@ -8,12 +8,8 @@ from __future__ import absolute_import
import re
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
# Import 3rd-party libs
NO_BOTO_MODULE = True

View file

@ -8,17 +8,15 @@ import textwrap
import tempfile
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
skip_if_binaries_missing
)
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, Mock, patch
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
@ -294,7 +292,3 @@ class CMDModuleTest(integration.ModuleCase):
pass
else:
raise RuntimeError
if __name__ == '__main__':
from integration import run_tests
run_tests(CMDModuleTest)

View file

@ -7,11 +7,7 @@ Validate the config system
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class ConfigTest(integration.ModuleCase):
@ -103,8 +99,3 @@ class ConfigTest(integration.ModuleCase):
'config.get',
['config_test:spam']),
'eggs')
if __name__ == '__main__':
from integration import run_tests
run_tests(ConfigTest)

View file

@ -8,12 +8,10 @@ import hashlib
import tempfile
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import salt.ext.six as six
import integration
import salt.utils
@ -526,7 +524,3 @@ class CPModuleTest(integration.ModuleCase):
self.assertTrue(os.path.isfile(tgt_cache_file), 'File was not cached on the master')
finally:
os.unlink(tgt_cache_file)
if __name__ == '__main__':
from integration import run_tests
run_tests(CPModuleTest)

View file

@ -9,19 +9,17 @@ import os
import random
# Import Salt Libs
import integration
import salt.utils
import salt.utils.files
from salt.exceptions import CommandExecutionError
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Module Variables
ASSIGN_CMD = 'net.inet.icmp.icmplim'
@ -210,8 +208,3 @@ class DarwinSysctlModuleTest(integration.ModuleCase):
if self.has_conf is False and os.path.isfile(CONFIG):
# remove sysctl.conf created by tests
os.remove(CONFIG)
if __name__ == '__main__':
from integration import run_tests
run_tests(DarwinSysctlModuleTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class DataModuleTest(integration.ModuleCase):
@ -54,7 +50,3 @@ class DataModuleTest(integration.ModuleCase):
self.assertTrue(self.run_function('data.update', ['spam', 'eggs']))
self.assertTrue(self.run_function('data.cas', ['spam', 'green', 'eggs']))
self.assertEqual(self.run_function('data.get', ['spam']), 'green')
if __name__ == '__main__':
from integration import run_tests
run_tests(DataModuleTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class DecoratorTest(integration.ModuleCase):
@ -60,8 +56,3 @@ class DecoratorTest(integration.ModuleCase):
'runtests_decorators.missing_depends_will_fallback'
)
)
if __name__ == '__main__':
from integration import run_tests
run_tests(DecoratorTest)

View file

@ -6,12 +6,11 @@ import os
import shutil
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (ensure_in_syspath, destructiveTest)
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
# Import 3rd-party libs
@ -86,8 +85,3 @@ class DiskModuleTest(integration.ModuleCase):
self.assertTrue('free' in val)
self.assertTrue('use' in val)
self.assertTrue('filesystem' in val)
if __name__ == '__main__':
from integration import run_tests
run_tests([DiskModuleVirtualizationTest, DiskModuleTest])

View file

@ -6,13 +6,11 @@ Test the django module
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch
ensure_in_syspath('../../')
# Import salt libs
import integration
from salt.modules import djangomod as django
django.__salt__ = {}
@ -147,8 +145,3 @@ class DjangoModuleTest(integration.ModuleCase):
python_shell=False,
env=None
)
if __name__ == '__main__':
from integration import run_tests
run_tests(DjangoModuleTest)

View file

@ -13,11 +13,9 @@ import time
import threading
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import integration
from salt.utils import event
# Import 3rd-party libs
@ -117,8 +115,3 @@ class EventModuleTest(integration.ModuleCase):
with self.assertRaises(Empty):
eventfired = events.get(block=True, timeout=10)
if __name__ == '__main__':
from integration import run_tests
run_tests(EventModuleTest)

View file

@ -10,14 +10,11 @@ import shutil
import sys
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
from tests.support.mock import patch, MagicMock
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
from salt.modules import file as filemod
@ -252,7 +249,3 @@ class FileModuleTest(integration.ModuleCase):
ret = filemod.source_list(
[{'file://' + self.myfile: ''}], 'filehash', 'base')
self.assertEqual(list(ret), ['file://' + self.myfile, 'filehash'])
if __name__ == '__main__':
from integration import run_tests
run_tests(FileModuleTest)

View file

@ -7,12 +7,11 @@ Integration tests for Ruby Gem module
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
import salt.utils.http
@ -141,7 +140,3 @@ class GemModuleTest(integration.ModuleCase):
'''
ret = self.run_function('gem.update_system')
self.assertTrue(ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(GemModuleTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class GentoolkitModuleTest(integration.ModuleCase):
@ -24,8 +20,3 @@ class GentoolkitModuleTest(integration.ModuleCase):
def test_revdep_rebuild_true(self):
ret = self.run_function('gentoolkit.revdep_rebuild')
self.assertTrue(ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(GentoolkitModuleTest)

View file

@ -18,19 +18,17 @@ import shutil
import subprocess
import tarfile
import tempfile
from distutils.version import LooseVersion
# Import Salt Testing libs
from distutils.version import LooseVersion
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
skip_if_binaries_missing
)
ensure_in_syspath('../..')
# Import salt libs
import integration
import salt.utils
log = logging.getLogger(__name__)
@ -976,8 +974,3 @@ class GitModuleTest(integration.ModuleCase):
self.run_function('git.worktree_prune', [self.repo]),
prune_message
)
if __name__ == '__main__':
from integration import run_tests
run_tests(GitModuleTest)

View file

@ -9,13 +9,9 @@ import os
import time
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import destructiveTest, ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
from tests.support.helpers import destructiveTest
class TestModulesGrains(integration.ModuleCase):
@ -205,8 +201,3 @@ class GrainsAppendTestCase(integration.ModuleCase):
# We should only have hit the grain key once.
self.assertEqual(count, 1)
if __name__ == '__main__':
from integration import run_tests
run_tests(TestModulesGrains)

View file

@ -6,12 +6,11 @@ import string
import random
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
import tests.integration as integration
from tests.support.helpers import destructiveTest
# Import salt libs
from salt.ext.six.moves import range
import integration
import salt.utils
@ -169,8 +168,3 @@ class GroupModuleTest(integration.ModuleCase):
self.assertIn(self._user, str(ginfo))
self.assertNotIn(self._no_group, str(ginfo))
self.assertNotIn(self._no_user, str(ginfo))
if __name__ == '__main__':
from integration import run_tests
run_tests(GroupModuleTest)

View file

@ -8,11 +8,9 @@ import os
import shutil
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import integration
import salt.utils
HFN = os.path.join(integration.TMP, 'hosts')
@ -214,8 +212,3 @@ class HostsModuleTest(integration.ModuleCase):
'192.168.1.1\t\thost1.fqdn.com host1 host1-reorder',
'192.168.1.2\t\thost2.fqdn.com host2 oldhost2 host2-reorder',
])
if __name__ == '__main__':
from integration import run_tests
run_tests(HostsModuleTest)

View file

@ -5,11 +5,7 @@ from __future__ import absolute_import
import re
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class KeyModuleTest(integration.ModuleCase):
@ -28,7 +24,3 @@ class KeyModuleTest(integration.ModuleCase):
out = self.run_function('key.finger_master')
match = re.match("([0-9a-z]{2}:){15,}[0-9a-z]{2}$", out)
self.assertTrue(match)
if __name__ == '__main__':
from integration import run_tests
run_tests(KeyModuleTest)

View file

@ -6,12 +6,10 @@ import os
import shutil
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath, skip_if_binaries_missing
import salt.utils
ensure_in_syspath('../../')
import tests.integration as integration
from tests.support.helpers import skip_if_binaries_missing
# Import salt libs
import integration
import salt.utils
# from salt.modules import linux_acl as acl
@ -68,8 +66,3 @@ class LinuxAclModuleTest(integration.ModuleCase,
'group': [{'root': {'octal': 4, 'permissions': {'read': True, 'write': False, 'execute': False}}}],
'comment': {'owner': 'root', 'group': 'root', 'file': self.myfile}}}
)
if __name__ == '__main__':
from integration import run_tests
run_tests(LinuxAclModuleTest)

View file

@ -4,17 +4,15 @@
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
ensure_in_syspath,
requires_salt_modules,
requires_system_grains,
destructiveTest,
)
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils

View file

@ -8,16 +8,12 @@ Test the lxc module
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.helpers import (
ensure_in_syspath,
skip_if_not_root,
skip_if_binaries_missing
)
from tests.support.unit import skipIf
ensure_in_syspath('../../')
# Import salt libs
import integration
# Import 3rd-party libs
import salt.ext.six as six
@ -104,7 +100,3 @@ class LXCModuleTest(integration.ModuleCase):
self.run_function('cmd.run', ['truncate -s 0 {0}'.format(f)])
self.assertEqual(conf.get('lxc.network.type'), 'macvlan')
if __name__ == '__main__':
from integration import run_tests
run_tests(LXCModuleTest)

View file

@ -8,16 +8,12 @@ from __future__ import absolute_import
import os
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
OSA_SCRIPT = '/usr/bin/osascript'
@ -126,8 +122,3 @@ class MacAssistiveTest(integration.ModuleCase):
self.assertFalse(
self.run_function('assistive.enabled', [OSA_SCRIPT])
)
if __name__ == '__main__':
from integration import run_tests
run_tests(MacAssistiveTest)

View file

@ -8,15 +8,11 @@ from __future__ import absolute_import
import os
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
)
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import Salt Libs
import integration
import salt.utils
from salt.exceptions import CommandExecutionError
@ -188,8 +184,3 @@ class BrewModuleTest(integration.ModuleCase):
self.run_function('pkg.remove', [ADD_PKG])
if DEL_PKG in pkg_list:
self.run_function('pkg.remove', [DEL_PKG])
if __name__ == '__main__':
from integration import run_tests
run_tests(BrewModuleTest)

View file

@ -8,16 +8,12 @@ from __future__ import absolute_import
import os
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
DEFAULT_DOMAIN = 'com.apple.AppleMultitouchMouse'
DEFAULT_KEY = 'MouseHorizontalScroll'
@ -59,7 +55,3 @@ class MacDefaultsModuleTest(integration.ModuleCase):
DEFAULT_KEY])
self.assertTrue(read_domain)
self.assertEqual(read_domain, DEFAULT_VALUE)
if __name__ == '__main__':
from integration import run_tests
run_tests(MacDefaultsModuleTest)

View file

@ -8,18 +8,13 @@ from __future__ import absolute_import
import os
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
@skipIf(os.geteuid() != 0, 'You must be logged in as root to run this test')
class MacDesktopTestCase(integration.ModuleCase):
@ -93,8 +88,3 @@ class MacDesktopTestCase(integration.ModuleCase):
self.assertTrue(
self.run_function('desktop.say', ['hello', 'world'])
)
if __name__ == '__main__':
from integration import run_tests
run_tests(MacDesktopTestCase)

View file

@ -10,16 +10,14 @@ import random
import string
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
from salt.exceptions import CommandExecutionError
# Import 3rd-party libs
@ -216,8 +214,3 @@ class MacGroupModuleTest(integration.ModuleCase):
change_info = self.run_function('group.info', [CHANGE_GROUP])
if change_info:
self.run_function('group.delete', [CHANGE_GROUP])
if __name__ == '__main__':
from integration import run_tests
run_tests(MacGroupModuleTest)

View file

@ -8,16 +8,14 @@ from __future__ import absolute_import
import os
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
from salt.exceptions import CommandExecutionError
CERT = os.path.join(
@ -125,8 +123,3 @@ class MacKeychainModuleTest(integration.ModuleCase):
cert_default = 'com.apple.systemdefault'
certs = self.run_function('keychain.list_certs')
self.assertIn(cert_default, certs)
if __name__ == '__main__':
from integration import run_tests
run_tests(MacKeychainModuleTest)

View file

@ -8,11 +8,10 @@ from __future__ import absolute_import
import os
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
import tests.integration as integration
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
TEST_PKG_URL = 'https://distfiles.macports.org/MacPorts/MacPorts-2.3.4-10.11-ElCapitan.pkg'
@ -88,8 +87,3 @@ class MacPkgutilModuleTest(integration.ModuleCase):
# Test forget
self.assertTrue(self.run_function('pkgutil.forget', [TEST_PKG_NAME]))
if __name__ == '__main__':
from integration import run_tests
run_tests(MacPkgutilModuleTest)

View file

@ -7,11 +7,10 @@ integration tests for mac_ports
from __future__ import absolute_import, print_function
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
import tests.integration as integration
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
@ -116,8 +115,3 @@ class MacPortsModuleTest(integration.ModuleCase):
results = self.run_function('pkg.upgrade', refresh=False)
self.assertIsInstance(results, dict)
self.assertTrue(results['result'])
if __name__ == '__main__':
from integration import run_tests
run_tests(MacPortsModuleTest)

View file

@ -7,15 +7,13 @@ integration tests for mac_power
from __future__ import absolute_import, print_function
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
ensure_in_syspath('../../')
@skipIf(not salt.utils.is_darwin()
or not salt.utils.which('systemsetup')
@ -330,12 +328,3 @@ class MacPowerModuleTestWakeOnModem(integration.ModuleCase):
self.assertTrue(
self.run_function('power.set_wake_on_modem', ['off']))
self.assertFalse(self.run_function('power.get_wake_on_modem'))
if __name__ == '__main__':
from integration import run_tests
run_tests(MacPowerModuleTest,
MacPowerModuleTestSleepOnPowerButton,
MacPowerModuleTestRestartPowerFailure,
MacPowerModuleTestWakeOnNet,
MacPowerModuleTestWakeOnModem)

View file

@ -7,12 +7,11 @@ integration tests for mac_service
from __future__ import absolute_import, print_function
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
@ -220,8 +219,3 @@ class MacServiceModuleTest(integration.ModuleCase):
services = self.run_function('service.get_enabled')
self.assertIsInstance(services, list)
self.assertIn('com.apple.coreservicesd', services)
if __name__ == '__main__':
from integration import run_tests
run_tests(MacServiceModuleTest)

View file

@ -10,13 +10,12 @@ import random
import string
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath, destructiveTest
from salt.ext.six.moves import range
ensure_in_syspath('../../')
import tests.integration as integration
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
from salt.ext.six.moves import range
def __random_string(size=6):
@ -244,8 +243,3 @@ class MacShadowModuleTest(integration.ModuleCase):
self.assertEqual(
self.run_function('shadow.set_password', [NO_USER, 'P@SSw0rd']),
'ERROR: User not found: {0}'.format(NO_USER))
if __name__ == '__main__':
from integration import run_tests
run_tests(MacShadowModuleTest)

View file

@ -7,11 +7,10 @@ integration tests for mac_softwareupdate
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
import tests.integration as integration
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
@ -183,8 +182,3 @@ class MacSoftwareUpdateModuleTest(integration.ModuleCase):
self.assertTrue(self.run_function('softwareupdate.reset_catalog'))
self.assertEqual(self.run_function('softwareupdate.get_catalog'),
'Default')
if __name__ == '__main__':
from integration import run_tests
run_tests(MacSoftwareUpdateModuleTest)

View file

@ -9,14 +9,13 @@ import random
import string
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
from salt.ext.six.moves import range
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
from salt.ext.six.moves import range
def __random_string(size=6):
@ -245,8 +244,3 @@ class MacSystemModuleTest(integration.ModuleCase):
self.assertIn(
'Invalid value passed for arch',
self.run_function('system.set_boot_arch', ['spongebob']))
if __name__ == '__main__':
from integration import run_tests
run_tests(MacSystemModuleTest)

View file

@ -15,12 +15,11 @@ from __future__ import absolute_import
import datetime
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
@ -214,8 +213,3 @@ class MacTimezoneModuleTest(integration.ModuleCase):
self.run_function('timezone.set_time_server', ['spongebob.com']))
self.assertEqual(
self.run_function('timezone.get_time_server'), 'spongebob.com')
if __name__ == '__main__':
from integration import run_tests
run_tests(MacTimezoneModuleTest)

View file

@ -10,16 +10,14 @@ import random
import string
# Import Salt Testing Libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath,
requires_system_grains
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
from salt.exceptions import CommandExecutionError
# Import 3rd-party libs
@ -175,8 +173,3 @@ class MacUserModuleTest(integration.ModuleCase):
change_info = self.run_function('user.info', [CHANGE_USER])
if change_info:
self.run_function('user.delete', [CHANGE_USER])
if __name__ == '__main__':
from integration import run_tests
run_tests(MacUserModuleTest)

View file

@ -8,11 +8,9 @@ from __future__ import absolute_import
import os
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
import tests.integration as integration
# Import salt libs
import integration
import salt.utils
TEST_FILE = os.path.join(integration.TMP, 'xattr_test_file.txt')
@ -175,8 +173,3 @@ class MacXattrModuleTest(integration.ModuleCase):
# Test file not found
self.assertEqual(self.run_function('xattr.clear', [NO_FILE]),
'ERROR: File not found: {0}'.format(NO_FILE))
if __name__ == '__main__':
from integration import run_tests
run_tests(MacXattrModuleTest)

View file

@ -7,11 +7,7 @@ from __future__ import absolute_import
import time
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class MineTest(integration.ModuleCase):
@ -147,7 +143,3 @@ class MineTest(integration.ModuleCase):
['minion', 'test.echo']
)
self.assertEqual(ret_echo_stays['minion'], 'foo')
if __name__ == '__main__':
from integration import run_tests
run_tests(MineTest)

View file

@ -5,15 +5,11 @@ from __future__ import absolute_import
import logging
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath
)
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
from salt.modules import mysql as mysqlmod
@ -1633,7 +1629,3 @@ class MysqlModuleUserGrantTest(integration.ModuleCase,
"GRANT USAGE ON *.* TO ''@'localhost'",
"GRANT DELETE ON `test ``(:=salteeb)`.* TO ''@'localhost'"
])
if __name__ == '__main__':
from integration import run_tests
run_tests(MysqlModuleDbTest, MysqlModuleUserTest)

View file

@ -8,12 +8,11 @@ from __future__ import absolute_import
import time
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
@ -111,8 +110,3 @@ class Nilrt_ipModuleTest(integration.ModuleCase):
self.assertEqual(interface['ipv4']['address'], '192.168.10.4')
self.assertEqual(interface['ipv4']['netmask'], '255.255.255.0')
self.assertEqual(interface['ipv4']['gateway'], '192.168.10.1')
if __name__ == '__main__':
from integration import run_tests
run_tests(Nilrt_ipModuleTest)

View file

@ -5,15 +5,9 @@ from __future__ import absolute_import
from distutils.version import LooseVersion # pylint: disable=import-error,no-name-in-module
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
ensure_in_syspath,
requires_network
)
ensure_in_syspath('../../')
# Import salt libs
import integration
from tests.support.helpers import requires_network
GIT_PYTHON = '0.3.2'
HAS_GIT_PYTHON = False
@ -123,7 +117,3 @@ class PillarModuleTest(integration.ModuleCase):
self.assertDictContainsSubset(
{'knights': ['Lancelot', 'Galahad', 'Bedevere', 'Robin']},
get_items)
if __name__ == '__main__':
from integration import run_tests
run_tests(PillarModuleTest)

View file

@ -15,12 +15,10 @@ import re
import tempfile
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
@ -438,8 +436,3 @@ class PipModuleTest(integration.ModuleCase):
shutil.rmtree(self.venv_test_dir)
if os.path.isdir(self.pip_temp):
shutil.rmtree(self.pip_temp)
if __name__ == '__main__':
from integration import run_tests
run_tests(PipModuleTest)

View file

@ -3,16 +3,12 @@
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
from tests.support.helpers import (
destructiveTest,
requires_network,
requires_salt_modules,
ensure_in_syspath
)
ensure_in_syspath('../../')
# Import salt libs
import integration
class PkgModuleTest(integration.ModuleCase,
@ -302,8 +298,3 @@ class PkgModuleTest(integration.ModuleCase,
self.assertNotEqual(ret, {})
if 'changes' in ret:
self.assertNotEqual(ret['changes'], {})
if __name__ == '__main__':
from integration import run_tests
run_tests(PkgModuleTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import, print_function
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class PublishModuleTest(integration.ModuleCase,
@ -143,8 +139,3 @@ class PublishModuleTest(integration.ModuleCase,
['minion', 'cmd.run', ['echo foo']]
)
self.assertEqual(ret, {})
if __name__ == '__main__':
from integration import run_tests
run_tests(PublishModuleTest)

View file

@ -12,12 +12,9 @@ import string
import random
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import destructiveTest, ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
from tests.support.helpers import destructiveTest
# Import 3rd-party libs
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
@ -81,8 +78,3 @@ class PwUserModuleTest(integration.ModuleCase):
except AssertionError:
self.run_function('user.delete', [uname, True, True])
raise
if __name__ == '__main__':
from integration import run_tests
run_tests(PwUserModuleTest)

View file

@ -5,13 +5,9 @@ from __future__ import absolute_import
import os
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, requires_salt_modules
ensure_in_syspath('../../')
# Import salt libs
import integration
from tests.support.helpers import requires_salt_modules
@skipIf(os.geteuid() != 0, 'You must be root to run this test')
@ -28,8 +24,3 @@ class RabbitModuleTest(integration.ModuleCase):
'''
ret = self.run_function('rabbitmq.user_exists', ['null_user'])
self.assertEqual(ret, False)
if __name__ == '__main__':
from integration import run_tests
run_tests(RabbitModuleTest)

View file

@ -8,14 +8,6 @@ from __future__ import absolute_import
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
NO_MOCK,
NO_MOCK_REASON
)
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Libs
import salt.utils.http
@ -36,7 +28,6 @@ def check_status():
@skipIf(not check_status(), 'random.org is not available')
@skipIf(NO_MOCK, NO_MOCK_REASON)
class RandomOrgTestCase(TestCase):
'''
Test cases for salt.modules.random_org
@ -307,8 +298,3 @@ class RandomOrgTestCase(TestCase):
api_version='1',
number=5, size=8,
format='hex'), ret6)
if __name__ == '__main__':
from integration import run_tests
run_tests(RandomOrgTestCase, needs_daemon=False)

View file

@ -8,12 +8,7 @@ from __future__ import absolute_import
import time
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
import tests.integration as integration
class SaltUtilModuleTest(integration.ModuleCase):
@ -154,9 +149,3 @@ class SaltUtilSyncModuleTest(integration.ModuleCase):
ret = self.run_function('saltutil.sync_all', extmod_whitelist={'modules': ['runtests_decorators']},
extmod_blacklist={'modules': ['runtests_decorators']})
self.assertEqual(ret, expected_return)
if __name__ == '__main__':
from integration import run_tests
run_tests(SaltUtilModuleTest)
run_tests(SaltUtilSyncModuleTest)

View file

@ -10,14 +10,13 @@ import string
import os
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, destructiveTest
from salt.ext.six.moves import range
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
from salt.ext.six.moves import range
@skipIf(not salt.utils.is_linux(), 'These tests can only be run on linux')
@ -232,8 +231,3 @@ class ShadowModuleTest(integration.ModuleCase):
#restore shadow file
with salt.utils.fopen('/etc/shadow', 'w') as sFile:
sFile.write(shadow)
if __name__ == '__main__':
from integration import run_tests
run_tests(ShadowModuleTest)

View file

@ -9,13 +9,11 @@ import os
import shutil
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath, skip_if_binaries_missing
ensure_in_syspath('../../')
from tests.support.helpers import skip_if_binaries_missing
# Import salt libs
import integration
import salt.utils
import salt.utils.http
@ -239,8 +237,3 @@ class SSHModuleTest(integration.ModuleCase):
exc, ret
)
)
if __name__ == '__main__':
from integration import run_tests
run_tests(SSHModuleTest)

View file

@ -9,12 +9,10 @@ import threading
import time
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
@ -1237,8 +1235,3 @@ class StateModuleTest(integration.ModuleCase,
self.assertIn('Attempt 4:', state_run[retry_state]['comment'])
self.assertNotIn('Attempt 15:', state_run[retry_state]['comment'])
self.assertEqual(state_run[retry_state]['result'], True)
if __name__ == '__main__':
from integration import run_tests
run_tests(StateModuleTest)

View file

@ -7,12 +7,10 @@ import time
import subprocess
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
@ -225,8 +223,3 @@ class SupervisordModuleTest(integration.ModuleCase):
'supervisord.status', ['sleep_service'],
conf_file=self.supervisor_conf, bin_env=self.venv_dir)
self.assertTrue(ret)
if __name__ == '__main__':
from integration import run_tests
run_tests(SupervisordModuleTest)

View file

@ -5,12 +5,8 @@ from __future__ import absolute_import
import sys
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
class SysctlModuleTest(integration.ModuleCase):
@ -53,8 +49,3 @@ class SysctlModuleTest(integration.ModuleCase):
self.assertEqual(
ret.get('kern.ostype'), 'Darwin', 'Incorrect kern.ostype'
)
if __name__ == '__main__':
from integration import run_tests
run_tests(SysctlModuleTest)

View file

@ -4,11 +4,7 @@
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import tests.integration as integration
class SysModuleTest(integration.ModuleCase):
@ -30,8 +26,3 @@ class SysModuleTest(integration.ModuleCase):
'\n'.join([' - {0}'.format(f) for f in ret['missing_cli_example']]),
)
)
if __name__ == '__main__':
from integration import run_tests
run_tests(SysModuleTest)

View file

@ -9,19 +9,14 @@ import signal
import subprocess
# Import Salt Testing libs
import tests.integration as integration
from tests.support.unit import skipIf
from tests.support.helpers import (
destructiveTest,
ensure_in_syspath
)
from salt.ext.six.moves import range
ensure_in_syspath('../../')
from tests.support.helpers import destructiveTest
# Import salt libs
import integration
import salt.utils
import salt.states.file
from salt.ext.six.moves import range
log = logging.getLogger(__name__)
@ -338,7 +333,3 @@ class SystemModuleTest(integration.ModuleCase):
if self.run_function('grains.get', ['os_family']) == 'NILinuxRT':
self.assertTrue(self.run_function('system._has_settable_hwclock'))
self.assertTrue(self._hwclock_has_compare())
if __name__ == '__main__':
from integration import run_tests
run_tests(SystemModuleTest)

Some files were not shown because too many files have changed in this diff Show more