diff --git a/tests/helpers.py b/tests/helpers.py index 246d96bf..9a431371 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -239,6 +239,10 @@ def random_string(n=5): ) +def random_int(start=2147483647, stop=None, step=1): + return random.randrange(start, stop, step) + + def gen_challenge( db, name="chal_name", diff --git a/tests/utils/test_events.py b/tests/utils/test_events.py index e3bc9bcb..1752376d 100644 --- a/tests/utils/test_events.py +++ b/tests/utils/test_events.py @@ -89,10 +89,10 @@ def test_event_endpoint_is_event_stream(): def test_redis_event_manager_installed(): """Test that RedisEventManager is installed on the Flask app""" - # TODO: This test is flaky. + class RedisConfig(TestingConfig): - REDIS_URL = "redis://localhost:6379" - CACHE_REDIS_URL = "redis://localhost:6379" + REDIS_URL = "redis://localhost:6379/1" + CACHE_REDIS_URL = "redis://localhost:6379/1" CACHE_TYPE = "redis" try: @@ -107,10 +107,10 @@ def test_redis_event_manager_installed(): def test_redis_event_manager_subscription(): """Test that RedisEventManager subscribing works.""" - # TODO: This test is flaky. + class RedisConfig(TestingConfig): - REDIS_URL = "redis://localhost:6379" - CACHE_REDIS_URL = "redis://localhost:6379" + REDIS_URL = "redis://localhost:6379/2" + CACHE_REDIS_URL = "redis://localhost:6379/2" CACHE_TYPE = "redis" try: @@ -152,10 +152,10 @@ def test_redis_event_manager_subscription(): def test_redis_event_manager_publish(): """Test that RedisEventManager publishing to clients works.""" - # TODO: This test is flaky. + class RedisConfig(TestingConfig): - REDIS_URL = "redis://localhost:6379" - CACHE_REDIS_URL = "redis://localhost:6379" + REDIS_URL = "redis://localhost:6379/3" + CACHE_REDIS_URL = "redis://localhost:6379/3" CACHE_TYPE = "redis" try: