|
|
@ -19,7 +19,8 @@
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.compat.tests import unittest
|
|
|
|
from ansible.compat.tests import unittest, mock
|
|
|
|
|
|
|
|
from ansible.plugins.cache import FactCache
|
|
|
|
from ansible.plugins.cache.base import BaseCacheModule
|
|
|
|
from ansible.plugins.cache.base import BaseCacheModule
|
|
|
|
from ansible.plugins.cache.memory import CacheModule as MemoryCache
|
|
|
|
from ansible.plugins.cache.memory import CacheModule as MemoryCache
|
|
|
|
|
|
|
|
|
|
|
@ -42,6 +43,20 @@ else:
|
|
|
|
from ansible.plugins.cache.redis import CacheModule as RedisCache
|
|
|
|
from ansible.plugins.cache.redis import CacheModule as RedisCache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestFactCache(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
|
|
|
|
with mock.patch('ansible.constants.CACHE_PLUGIN', 'memory'):
|
|
|
|
|
|
|
|
self.cache = FactCache()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_copy(self):
|
|
|
|
|
|
|
|
self.cache['avocado'] = 'fruit'
|
|
|
|
|
|
|
|
self.cache['daisy'] = 'flower'
|
|
|
|
|
|
|
|
a_copy = self.cache.copy()
|
|
|
|
|
|
|
|
self.assertEqual(type(a_copy), dict)
|
|
|
|
|
|
|
|
self.assertEqual(a_copy, dict(avocado='fruit', daisy='flower'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestAbstractClass(unittest.TestCase):
|
|
|
|
class TestAbstractClass(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
def setUp(self):
|
|
|
|