mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-16 16:00:17 +02:00
Use new Redis in tests
This commit is contained in:
parent
61c3d8964b
commit
a33c474b35
@ -18,7 +18,7 @@ MODULE_PATH = "allianceauth.authentication.task_statistics.event_series"
|
|||||||
class TestEventSeries(TestCase):
|
class TestEventSeries(TestCase):
|
||||||
def test_should_abort_without_redis_client(self):
|
def test_should_abort_without_redis_client(self):
|
||||||
# when
|
# when
|
||||||
with patch(MODULE_PATH + ".cache.get_master_client") as mock:
|
with patch(MODULE_PATH + ".get_redis_connection") as mock:
|
||||||
mock.return_value = None
|
mock.return_value = None
|
||||||
events = EventSeries("dummy")
|
events = EventSeries("dummy")
|
||||||
# then
|
# then
|
||||||
@ -27,8 +27,8 @@ class TestEventSeries(TestCase):
|
|||||||
|
|
||||||
def test_should_disable_itself_if_redis_not_available_1(self):
|
def test_should_disable_itself_if_redis_not_available_1(self):
|
||||||
# when
|
# when
|
||||||
with patch(MODULE_PATH + ".cache.get_master_client") as mock_get_master_client:
|
with patch(MODULE_PATH + ".get_redis_connection") as mock_get_redis_connection:
|
||||||
mock_get_master_client.return_value.ping.side_effect = RedisError
|
mock_get_redis_connection.return_value.ping.side_effect = RedisError
|
||||||
events = EventSeries("dummy")
|
events = EventSeries("dummy")
|
||||||
# then
|
# then
|
||||||
self.assertIsInstance(events._redis, _RedisStub)
|
self.assertIsInstance(events._redis, _RedisStub)
|
||||||
@ -36,8 +36,8 @@ class TestEventSeries(TestCase):
|
|||||||
|
|
||||||
def test_should_disable_itself_if_redis_not_available_2(self):
|
def test_should_disable_itself_if_redis_not_available_2(self):
|
||||||
# when
|
# when
|
||||||
with patch(MODULE_PATH + ".cache.get_master_client") as mock_get_master_client:
|
with patch(MODULE_PATH + ".get_redis_connection") as mock_get_redis_connection:
|
||||||
mock_get_master_client.return_value.ping.return_value = False
|
mock_get_redis_connection.return_value.ping.return_value = False
|
||||||
events = EventSeries("dummy")
|
events = EventSeries("dummy")
|
||||||
# then
|
# then
|
||||||
self.assertIsInstance(events._redis, _RedisStub)
|
self.assertIsInstance(events._redis, _RedisStub)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user