mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix more plugin unit tests. (#51)
This commit is contained in:
parent
a5627744f1
commit
76880e2403
3 changed files with 5 additions and 5 deletions
2
tests/unit/plugins/cache/test_memcached.py
vendored
2
tests/unit/plugins/cache/test_memcached.py
vendored
|
@ -32,4 +32,4 @@ def test_memcached_cachemodule():
|
|||
|
||||
|
||||
def test_memcached_cachemodule_with_loader():
|
||||
assert isinstance(cache_loader.get('memcached'), MemcachedCache)
|
||||
assert isinstance(cache_loader.get('community.general.memcached'), MemcachedCache)
|
||||
|
|
2
tests/unit/plugins/cache/test_redis.py
vendored
2
tests/unit/plugins/cache/test_redis.py
vendored
|
@ -33,4 +33,4 @@ def test_redis_cachemodule():
|
|||
|
||||
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)
|
||||
assert isinstance(cache_loader.get('community.general.redis', **{'_uri': '127.0.0.1:6379:1'}), RedisCache)
|
||||
|
|
|
@ -65,7 +65,7 @@ def super_switcher(scope="function", autouse=True):
|
|||
|
||||
|
||||
def test_lookup_multiple_obj(dummy_credentials):
|
||||
avi_lookup = lookup_loader.get('avi')
|
||||
avi_lookup = lookup_loader.get('community.general.avi')
|
||||
avi_mock = MagicMock()
|
||||
avi_mock.return_value.get.return_value.json.return_value = data["mock_multiple_obj"]
|
||||
with patch.object(avi, 'ApiSession', avi_mock):
|
||||
|
@ -75,7 +75,7 @@ def test_lookup_multiple_obj(dummy_credentials):
|
|||
|
||||
|
||||
def test_lookup_single_obj(dummy_credentials):
|
||||
avi_lookup = lookup_loader.get('avi')
|
||||
avi_lookup = lookup_loader.get('community.general.avi')
|
||||
avi_mock = MagicMock()
|
||||
avi_mock.return_value.get_object_by_name.return_value = data["mock_single_obj"]
|
||||
with patch.object(avi, 'ApiSession', avi_mock):
|
||||
|
@ -85,7 +85,7 @@ def test_lookup_single_obj(dummy_credentials):
|
|||
|
||||
|
||||
def test_invalid_lookup(dummy_credentials):
|
||||
avi_lookup = lookup_loader.get('avi')
|
||||
avi_lookup = lookup_loader.get('community.general.avi')
|
||||
avi_mock = MagicMock()
|
||||
with pytest.raises(AnsibleError):
|
||||
with patch.object(avi, 'ApiSession', avi_mock):
|
||||
|
|
Loading…
Reference in a new issue