Skip to content

Commit e2871c6

Browse files
committed
test with the set_rate_limit_group
1 parent 2325aff commit e2871c6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aikido_zen/middleware/init_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from aikido_zen.context import current_context, Context, get_current_context
55
from aikido_zen.thread.thread_cache import ThreadCache, get_cache
66
from . import should_block_request
7+
from .. import set_rate_limit_group
78

89

910
@pytest.fixture(autouse=True)
@@ -36,6 +37,7 @@ def set_context(user=None, executed_middleware=False):
3637
"source": "flask",
3738
"route": "/posts/:id",
3839
"user": user,
40+
"rate_limit_group": None,
3941
"executed_middleware": executed_middleware,
4042
}
4143
).set_as_current_context()
@@ -75,6 +77,7 @@ def test_with_context_with_cache():
7577

7678
def test_cache_comms_with_endpoints():
7779
set_context(user={"id": "456"})
80+
set_rate_limit_group("my_group")
7881
thread_cache = get_cache()
7982
thread_cache.config.blocked_uids = ["123"]
8083
thread_cache.config.endpoints = [
@@ -145,7 +148,7 @@ def test_cache_comms_with_endpoints():
145148
"url": "http://localhost:4000",
146149
},
147150
"user": {"id": "456"},
148-
"group": None,
151+
"group": "my_group",
149152
"remote_address": "::1",
150153
},
151154
receive=True,

0 commit comments

Comments
 (0)