From 04666c9fa1eb2f367cf3b1c9c6853828bdcb813f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 28 Feb 2020 20:29:41 -0800 Subject: [PATCH] Clean up unit tests to assist with migration. (#67875) * Split out cache plugin unit tests. * Rename unit tests to match code under test. * Relocate unit test code to match code under test. * Another rename. * Update sanity ignores. --- test/sanity/ignore.txt | 20 +- .../{plugins => }/inventory/test_group.py | 0 .../{plugins => }/inventory/test_host.py | 0 .../network/netscaler/test_netscaler.py} | 0 ..._rabbimq_user.py => test_rabbitmq_user.py} | 0 ..._command.py => test_eric_eccli_command.py} | 0 .../network/nxos/test_nxos_pim_interface.py | 153 +++++++++++++++ .../nxos/test_nxos_pim_interface_bfd.py | 177 ------------------ ...nyx_protocols.py => test_onyx_protocol.py} | 0 ...st_onyx_ptp.py => test_onyx_ptp_global.py} | 0 ...{test_linux_mountinfo.py => test_mount.py} | 0 test/units/plugins/cache/test_cache.py | 35 ---- test/units/plugins/cache/test_memcached.py | 35 ++++ test/units/plugins/cache/test_redis.py | 36 ++++ .../filter/{test_uuid.py => test_core.py} | 0 ...test_strategy_linear.py => test_linear.py} | 0 ...test_strategy_base.py => test_strategy.py} | 0 17 files changed, 234 insertions(+), 222 deletions(-) rename test/units/{plugins => }/inventory/test_group.py (100%) rename test/units/{plugins => }/inventory/test_host.py (100%) rename test/units/{modules/network/netscaler/test_netscaler_module_utils.py => module_utils/network/netscaler/test_netscaler.py} (100%) rename test/units/modules/messaging/rabbitmq/{test_rabbimq_user.py => test_rabbitmq_user.py} (100%) rename test/units/modules/network/eric_eccli/{test_eccli_command.py => test_eric_eccli_command.py} (100%) delete mode 100644 test/units/modules/network/nxos/test_nxos_pim_interface_bfd.py rename test/units/modules/network/onyx/{test_onyx_protocols.py => test_onyx_protocol.py} (100%) rename test/units/modules/network/onyx/{test_onyx_ptp.py => test_onyx_ptp_global.py} (100%) rename test/units/modules/system/{test_linux_mountinfo.py => test_mount.py} (100%) create mode 100644 test/units/plugins/cache/test_memcached.py create mode 100644 test/units/plugins/cache/test_redis.py rename test/units/plugins/filter/{test_uuid.py => test_core.py} (100%) rename test/units/plugins/strategy/{test_strategy_linear.py => test_linear.py} (100%) rename test/units/plugins/strategy/{test_strategy_base.py => test_strategy.py} (100%) diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index bdcd9009588..406622b3beb 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -8297,6 +8297,10 @@ test/units/contrib/inventory/test_vmware_inventory.py future-import-boilerplate test/units/contrib/inventory/test_vmware_inventory.py metaclass-boilerplate test/units/contrib/inventory/test_vmware_inventory.py pylint:blacklisted-name test/units/executor/test_play_iterator.py pylint:blacklisted-name +test/units/inventory/test_group.py future-import-boilerplate +test/units/inventory/test_group.py metaclass-boilerplate +test/units/inventory/test_host.py future-import-boilerplate +test/units/inventory/test_host.py metaclass-boilerplate test/units/mock/path.py future-import-boilerplate test/units/mock/path.py metaclass-boilerplate test/units/mock/yaml_helper.py future-import-boilerplate @@ -8361,6 +8365,8 @@ test/units/module_utils/network/ftd/test_fdm_swagger_with_real_data.py future-im test/units/module_utils/network/ftd/test_fdm_swagger_with_real_data.py metaclass-boilerplate test/units/module_utils/network/ftd/test_upsert_functionality.py future-import-boilerplate test/units/module_utils/network/ftd/test_upsert_functionality.py metaclass-boilerplate +test/units/module_utils/network/netscaler/test_netscaler.py future-import-boilerplate +test/units/module_utils/network/netscaler/test_netscaler.py metaclass-boilerplate test/units/module_utils/network/nso/test_nso.py metaclass-boilerplate test/units/module_utils/parsing/test_convert_bool.py future-import-boilerplate test/units/module_utils/postgresql/test_postgres.py future-import-boilerplate @@ -8416,8 +8422,8 @@ test/units/modules/cloud/xenserver/FakeXenAPI.py metaclass-boilerplate test/units/modules/conftest.py future-import-boilerplate test/units/modules/conftest.py metaclass-boilerplate test/units/modules/files/test_copy.py future-import-boilerplate -test/units/modules/messaging/rabbitmq/test_rabbimq_user.py future-import-boilerplate -test/units/modules/messaging/rabbitmq/test_rabbimq_user.py metaclass-boilerplate +test/units/modules/messaging/rabbitmq/test_rabbitmq_user.py future-import-boilerplate +test/units/modules/messaging/rabbitmq/test_rabbitmq_user.py metaclass-boilerplate test/units/modules/monitoring/test_circonus_annotation.py future-import-boilerplate test/units/modules/monitoring/test_circonus_annotation.py metaclass-boilerplate test/units/modules/monitoring/test_icinga2_feature.py future-import-boilerplate @@ -8468,8 +8474,6 @@ test/units/modules/network/netscaler/test_netscaler_lb_monitor.py future-import- test/units/modules/network/netscaler/test_netscaler_lb_monitor.py metaclass-boilerplate test/units/modules/network/netscaler/test_netscaler_lb_vserver.py future-import-boilerplate test/units/modules/network/netscaler/test_netscaler_lb_vserver.py metaclass-boilerplate -test/units/modules/network/netscaler/test_netscaler_module_utils.py future-import-boilerplate -test/units/modules/network/netscaler/test_netscaler_module_utils.py metaclass-boilerplate test/units/modules/network/netscaler/test_netscaler_nitro_request.py future-import-boilerplate test/units/modules/network/netscaler/test_netscaler_nitro_request.py metaclass-boilerplate test/units/modules/network/netscaler/test_netscaler_save_config.py future-import-boilerplate @@ -8707,8 +8711,8 @@ test/units/modules/system/test_java_keystore.py metaclass-boilerplate test/units/modules/system/test_known_hosts.py future-import-boilerplate test/units/modules/system/test_known_hosts.py metaclass-boilerplate test/units/modules/system/test_known_hosts.py pylint:ansible-bad-function -test/units/modules/system/test_linux_mountinfo.py future-import-boilerplate -test/units/modules/system/test_linux_mountinfo.py metaclass-boilerplate +test/units/modules/system/test_mount.py future-import-boilerplate +test/units/modules/system/test_mount.py metaclass-boilerplate test/units/modules/system/test_pamd.py metaclass-boilerplate test/units/modules/system/test_parted.py future-import-boilerplate test/units/modules/system/test_systemd.py future-import-boilerplate @@ -8735,10 +8739,6 @@ test/units/plugins/httpapi/test_ftd.py future-import-boilerplate test/units/plugins/httpapi/test_ftd.py metaclass-boilerplate test/units/plugins/inventory/test_constructed.py future-import-boilerplate test/units/plugins/inventory/test_constructed.py metaclass-boilerplate -test/units/plugins/inventory/test_group.py future-import-boilerplate -test/units/plugins/inventory/test_group.py metaclass-boilerplate -test/units/plugins/inventory/test_host.py future-import-boilerplate -test/units/plugins/inventory/test_host.py metaclass-boilerplate test/units/plugins/loader_fixtures/import_fixture.py future-import-boilerplate test/units/plugins/shell/test_cmd.py future-import-boilerplate test/units/plugins/shell/test_cmd.py metaclass-boilerplate diff --git a/test/units/plugins/inventory/test_group.py b/test/units/inventory/test_group.py similarity index 100% rename from test/units/plugins/inventory/test_group.py rename to test/units/inventory/test_group.py diff --git a/test/units/plugins/inventory/test_host.py b/test/units/inventory/test_host.py similarity index 100% rename from test/units/plugins/inventory/test_host.py rename to test/units/inventory/test_host.py diff --git a/test/units/modules/network/netscaler/test_netscaler_module_utils.py b/test/units/module_utils/network/netscaler/test_netscaler.py similarity index 100% rename from test/units/modules/network/netscaler/test_netscaler_module_utils.py rename to test/units/module_utils/network/netscaler/test_netscaler.py diff --git a/test/units/modules/messaging/rabbitmq/test_rabbimq_user.py b/test/units/modules/messaging/rabbitmq/test_rabbitmq_user.py similarity index 100% rename from test/units/modules/messaging/rabbitmq/test_rabbimq_user.py rename to test/units/modules/messaging/rabbitmq/test_rabbitmq_user.py diff --git a/test/units/modules/network/eric_eccli/test_eccli_command.py b/test/units/modules/network/eric_eccli/test_eric_eccli_command.py similarity index 100% rename from test/units/modules/network/eric_eccli/test_eccli_command.py rename to test/units/modules/network/eric_eccli/test_eric_eccli_command.py diff --git a/test/units/modules/network/nxos/test_nxos_pim_interface.py b/test/units/modules/network/nxos/test_nxos_pim_interface.py index 41bab3d8cdf..0248d774012 100644 --- a/test/units/modules/network/nxos/test_nxos_pim_interface.py +++ b/test/units/modules/network/nxos/test_nxos_pim_interface.py @@ -94,3 +94,156 @@ class TestNxosIPInterfaceModule(TestNxosModule): def test_nxos_pim_interface_ip_absent(self): set_module_args(dict(interface='eth2/1', state='absent')) self.execute_module(changed=False, commands=[]) + + +class TestNxosPimInterfaceBfdModule(TestNxosModule): + + module = nxos_pim_interface + + def setUp(self): + super(TestNxosPimInterfaceBfdModule, self).setUp() + + self.mock_get_interface_mode = patch('ansible.modules.network.nxos.nxos_pim_interface.get_interface_mode') + self.get_interface_mode = self.mock_get_interface_mode.start() + + self.mock_get_config = patch('ansible.modules.network.nxos.nxos_pim_interface.get_config') + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch('ansible.modules.network.nxos.nxos_pim_interface.load_config') + self.load_config = self.mock_load_config.start() + + self.mock_run_commands = patch('ansible.modules.network.nxos.nxos_pim_interface.run_commands') + self.run_commands = self.mock_run_commands.start() + + def tearDown(self): + super(TestNxosPimInterfaceBfdModule, self).tearDown() + self.mock_get_interface_mode.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_run_commands.stop() + + def load_fixtures(self, commands=None, device=''): + self.load_config.return_value = None + + def test_bfd_1(self): + # default (None) -> enable + self.get_config.return_value = None + set_module_args(dict(interface='eth2/1', bfd='enable')) + self.execute_module( + changed=True, + commands=[ + 'interface eth2/1', + 'ip pim bfd-instance', + ]) + + # default (None) -> disable + set_module_args(dict(interface='eth2/1', bfd='disable')) + self.execute_module( + changed=True, + commands=[ + 'interface eth2/1', + 'ip pim bfd-instance disable', + ]) + + # default (None) -> default (None) (idempotence) + set_module_args(dict(interface='eth2/1', bfd='default')) + self.execute_module(changed=False,) + + # default (None) -> interface state 'default' + set_module_args(dict(interface='Ethernet9/3', state='default')) + self.execute_module(changed=False,) + + # default (None) -> interface state 'absent' + set_module_args(dict(interface='Ethernet9/3', state='absent')) + self.execute_module(changed=False,) + + def test_bfd_2(self): + # From disable + self.get_config.return_value = ''' + interface Ethernet9/2 + ip pim bfd-instance disable + ''' + # disable -> enable + set_module_args(dict(interface='Ethernet9/2', bfd='enable')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/2', + 'ip pim bfd-instance', + ]) + + # disable -> disable (idempotence) + set_module_args(dict(interface='Ethernet9/2', bfd='disable')) + self.execute_module(changed=False,) + + # disable -> default (None) + set_module_args(dict(interface='Ethernet9/2', bfd='default')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/2', + 'no ip pim bfd-instance', + ]) + # disable -> interface state 'default' + set_module_args(dict(interface='Ethernet9/3', state='default')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/3', + 'no ip pim bfd-instance', + ]) + + # disable -> interface state 'absent' + set_module_args(dict(interface='Ethernet9/3', state='absent')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/3', + 'no ip pim bfd-instance', + ]) + + def test_bfd_3(self): + # From enable + self.get_config.return_value = ''' + interface Ethernet9/2 + ip pim bfd-instance + ''' + # enable -> disabled + set_module_args(dict(interface='Ethernet9/3', bfd='disable')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/3', + 'ip pim bfd-instance disable', + ]) + + # enable -> enable (idempotence) + set_module_args(dict(interface='Ethernet9/3', bfd='enable')) + self.execute_module(changed=False,) + + # enable -> default (None) + set_module_args(dict(interface='Ethernet9/3', bfd='default')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/3', + 'no ip pim bfd-instance', + ]) + + # enable -> interface state 'default' + set_module_args(dict(interface='Ethernet9/3', state='default')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/3', + 'no ip pim bfd-instance', + ]) + + # enable -> interface state 'absent' + set_module_args(dict(interface='Ethernet9/3', state='absent')) + self.execute_module( + changed=True, + commands=[ + 'interface Ethernet9/3', + 'no ip pim bfd-instance', + ]) diff --git a/test/units/modules/network/nxos/test_nxos_pim_interface_bfd.py b/test/units/modules/network/nxos/test_nxos_pim_interface_bfd.py deleted file mode 100644 index 05375099e1c..00000000000 --- a/test/units/modules/network/nxos/test_nxos_pim_interface_bfd.py +++ /dev/null @@ -1,177 +0,0 @@ -# (c) 2019 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.nxos import nxos_pim_interface -from .nxos_module import TestNxosModule, set_module_args - - -class TestNxosPimInterfaceBfdModule(TestNxosModule): - - module = nxos_pim_interface - - def setUp(self): - super(TestNxosPimInterfaceBfdModule, self).setUp() - - self.mock_get_interface_mode = patch('ansible.modules.network.nxos.nxos_pim_interface.get_interface_mode') - self.get_interface_mode = self.mock_get_interface_mode.start() - - self.mock_get_config = patch('ansible.modules.network.nxos.nxos_pim_interface.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.nxos.nxos_pim_interface.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_run_commands = patch('ansible.modules.network.nxos.nxos_pim_interface.run_commands') - self.run_commands = self.mock_run_commands.start() - - def tearDown(self): - super(TestNxosPimInterfaceBfdModule, self).tearDown() - self.mock_get_interface_mode.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_run_commands.stop() - - def load_fixtures(self, commands=None, device=''): - self.load_config.return_value = None - - def test_bfd_1(self): - # default (None) -> enable - self.get_config.return_value = None - set_module_args(dict(interface='eth2/1', bfd='enable')) - self.execute_module( - changed=True, - commands=[ - 'interface eth2/1', - 'ip pim bfd-instance', - ]) - - # default (None) -> disable - set_module_args(dict(interface='eth2/1', bfd='disable')) - self.execute_module( - changed=True, - commands=[ - 'interface eth2/1', - 'ip pim bfd-instance disable', - ]) - - # default (None) -> default (None) (idempotence) - set_module_args(dict(interface='eth2/1', bfd='default')) - self.execute_module(changed=False,) - - # default (None) -> interface state 'default' - set_module_args(dict(interface='Ethernet9/3', state='default')) - self.execute_module(changed=False,) - - # default (None) -> interface state 'absent' - set_module_args(dict(interface='Ethernet9/3', state='absent')) - self.execute_module(changed=False,) - - def test_bfd_2(self): - # From disable - self.get_config.return_value = ''' - interface Ethernet9/2 - ip pim bfd-instance disable - ''' - # disable -> enable - set_module_args(dict(interface='Ethernet9/2', bfd='enable')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/2', - 'ip pim bfd-instance', - ]) - - # disable -> disable (idempotence) - set_module_args(dict(interface='Ethernet9/2', bfd='disable')) - self.execute_module(changed=False,) - - # disable -> default (None) - set_module_args(dict(interface='Ethernet9/2', bfd='default')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/2', - 'no ip pim bfd-instance', - ]) - # disable -> interface state 'default' - set_module_args(dict(interface='Ethernet9/3', state='default')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/3', - 'no ip pim bfd-instance', - ]) - - # disable -> interface state 'absent' - set_module_args(dict(interface='Ethernet9/3', state='absent')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/3', - 'no ip pim bfd-instance', - ]) - - def test_bfd_3(self): - # From enable - self.get_config.return_value = ''' - interface Ethernet9/2 - ip pim bfd-instance - ''' - # enable -> disabled - set_module_args(dict(interface='Ethernet9/3', bfd='disable')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/3', - 'ip pim bfd-instance disable', - ]) - - # enable -> enable (idempotence) - set_module_args(dict(interface='Ethernet9/3', bfd='enable')) - self.execute_module(changed=False,) - - # enable -> default (None) - set_module_args(dict(interface='Ethernet9/3', bfd='default')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/3', - 'no ip pim bfd-instance', - ]) - - # enable -> interface state 'default' - set_module_args(dict(interface='Ethernet9/3', state='default')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/3', - 'no ip pim bfd-instance', - ]) - - # enable -> interface state 'absent' - set_module_args(dict(interface='Ethernet9/3', state='absent')) - self.execute_module( - changed=True, - commands=[ - 'interface Ethernet9/3', - 'no ip pim bfd-instance', - ]) diff --git a/test/units/modules/network/onyx/test_onyx_protocols.py b/test/units/modules/network/onyx/test_onyx_protocol.py similarity index 100% rename from test/units/modules/network/onyx/test_onyx_protocols.py rename to test/units/modules/network/onyx/test_onyx_protocol.py diff --git a/test/units/modules/network/onyx/test_onyx_ptp.py b/test/units/modules/network/onyx/test_onyx_ptp_global.py similarity index 100% rename from test/units/modules/network/onyx/test_onyx_ptp.py rename to test/units/modules/network/onyx/test_onyx_ptp_global.py diff --git a/test/units/modules/system/test_linux_mountinfo.py b/test/units/modules/system/test_mount.py similarity index 100% rename from test/units/modules/system/test_linux_mountinfo.py rename to test/units/modules/system/test_mount.py diff --git a/test/units/plugins/cache/test_cache.py b/test/units/plugins/cache/test_cache.py index b8ea1f334ed..1f16b806fe0 100644 --- a/test/units/plugins/cache/test_cache.py +++ b/test/units/plugins/cache/test_cache.py @@ -26,24 +26,6 @@ from ansible.plugins.cache.base import BaseCacheModule from ansible.plugins.cache.memory import CacheModule as MemoryCache from ansible.plugins.loader import cache_loader -HAVE_MEMCACHED = True -try: - import memcache -except ImportError: - HAVE_MEMCACHED = False -else: - # Use an else so that the only reason we skip this is for lack of - # memcached, not errors importing the plugin - from ansible.plugins.cache.memcached import CacheModule as MemcachedCache - -HAVE_REDIS = True -try: - import redis -except ImportError: - HAVE_REDIS = False -else: - from ansible.plugins.cache.redis import CacheModule as RedisCache - import pytest @@ -178,25 +160,8 @@ class TestAbstractClass(unittest.TestCase): self.assertIsInstance(CacheModule3(), CacheModule3) - @unittest.skipUnless(HAVE_MEMCACHED, 'python-memcached module not installed') - def test_memcached_cachemodule(self): - self.assertIsInstance(MemcachedCache(), MemcachedCache) - - @unittest.skipUnless(HAVE_MEMCACHED, 'python-memcached module not installed') - def test_memcached_cachemodule_with_loader(self): - self.assertIsInstance(cache_loader.get('memcached'), MemcachedCache) - def test_memory_cachemodule(self): self.assertIsInstance(MemoryCache(), MemoryCache) def test_memory_cachemodule_with_loader(self): self.assertIsInstance(cache_loader.get('memory'), MemoryCache) - - @unittest.skipUnless(HAVE_REDIS, 'Redis python module not installed') - def test_redis_cachemodule(self): - self.assertIsInstance(RedisCache(), RedisCache) - - @unittest.skipUnless(HAVE_REDIS, 'Redis python module not installed') - def test_redis_cachemodule_with_loader(self): - # The _uri option is required for the redis plugin - self.assertIsInstance(cache_loader.get('redis', **{'_uri': '127.0.0.1:6379:1'}), RedisCache) diff --git a/test/units/plugins/cache/test_memcached.py b/test/units/plugins/cache/test_memcached.py new file mode 100644 index 00000000000..5e997a77290 --- /dev/null +++ b/test/units/plugins/cache/test_memcached.py @@ -0,0 +1,35 @@ +# (c) 2012-2015, Michael DeHaan +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import pytest + +pytest.importorskip('memcache') + +from ansible.plugins.loader import cache_loader +from ansible.plugins.cache.memcached import CacheModule as MemcachedCache + + +def test_memcached_cachemodule(): + assert isinstance(MemcachedCache(), MemcachedCache) + + +def test_memcached_cachemodule_with_loader(): + assert isinstance(cache_loader.get('memcached'), MemcachedCache) diff --git a/test/units/plugins/cache/test_redis.py b/test/units/plugins/cache/test_redis.py new file mode 100644 index 00000000000..3b242304f97 --- /dev/null +++ b/test/units/plugins/cache/test_redis.py @@ -0,0 +1,36 @@ +# (c) 2012-2015, Michael DeHaan +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import pytest + +pytest.importorskip('redis') + +from ansible.plugins.loader import cache_loader +from ansible.plugins.cache.redis import CacheModule as RedisCache + + +def test_redis_cachemodule(): + assert isinstance(RedisCache(), RedisCache) + + +def test_redis_cachemodule_with_loader(): + # The _uri option is required for the redis plugin + assert isinstance(cache_loader.get('redis', **{'_uri': '127.0.0.1:6379:1'}), RedisCache) diff --git a/test/units/plugins/filter/test_uuid.py b/test/units/plugins/filter/test_core.py similarity index 100% rename from test/units/plugins/filter/test_uuid.py rename to test/units/plugins/filter/test_core.py diff --git a/test/units/plugins/strategy/test_strategy_linear.py b/test/units/plugins/strategy/test_linear.py similarity index 100% rename from test/units/plugins/strategy/test_strategy_linear.py rename to test/units/plugins/strategy/test_linear.py diff --git a/test/units/plugins/strategy/test_strategy_base.py b/test/units/plugins/strategy/test_strategy.py similarity index 100% rename from test/units/plugins/strategy/test_strategy_base.py rename to test/units/plugins/strategy/test_strategy.py