Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/cache/test_redis.py

raw
1 # Copyright (c) 2012-2015, Michael DeHaan <[email protected]>
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 # Make coding more python3-ish
6 from __future__ import annotations
7
8 import pytest
9
10 pytest.importorskip("redis")
11
12 from ansible.plugins.loader import cache_loader
13
14 from ansible_collections.community.general.plugins.cache.redis import CacheModule as RedisCache
15
16
17 def test_redis_cachemodule():
18 # The _uri option is required for the redis plugin
19 connection = "127.0.0.1:6379:1"
20 assert isinstance(cache_loader.get("community.general.redis", **{"_uri": connection}), RedisCache)
21
22
23 def test_redis_cachemodule_2():
24 # The _uri option is required for the redis plugin
25 connection = "[::1]:6379:1"
26 assert isinstance(cache_loader.get("community.general.redis", **{"_uri": connection}), RedisCache)