1
0
Fork 0
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:
Felix Fontein 2020-03-25 23:37:34 +01:00 committed by GitHub
parent a5627744f1
commit 76880e2403
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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):