1+ from tokenize import group
2+
13import pytest
24from unittest .mock import Mock , patch
35from .should_ratelimit import process_should_ratelimit
@@ -22,6 +24,7 @@ def test_process_should_ratelimit(should_ratelimit, expected_call):
2224 },
2325 "remote_address" : "192.168.1.1" ,
2426 "user" : {"id" : 1 , "name" : "Test User" },
27+ "group" : "123" ,
2528 }
2629
2730 with patch (
@@ -37,6 +40,7 @@ def test_process_should_ratelimit(should_ratelimit, expected_call):
3740 remote_address = data ["remote_address" ],
3841 user = data ["user" ],
3942 connection_manager = connection_manager ,
43+ group = "123"
4044 )
4145
4246
@@ -51,6 +55,7 @@ def test_process_should_ratelimit_no_connection_manager():
5155 },
5256 "remote_address" : "192.168.1.1" ,
5357 "user" : {"id" : 1 , "name" : "Test User" },
58+ "group" : None ,
5459 }
5560
5661 # Act
@@ -72,6 +77,7 @@ def test_process_should_ratelimit_multiple_calls():
7277 },
7378 "remote_address" : "192.168.1.1" ,
7479 "user" : {"id" : 1 , "name" : "Test User" },
80+ "group" : None ,
7581 }
7682
7783 with patch (
@@ -88,6 +94,7 @@ def test_process_should_ratelimit_multiple_calls():
8894 remote_address = data ["remote_address" ],
8995 user = data ["user" ],
9096 connection_manager = connection_manager ,
97+ group = None
9198 )
9299
93100
@@ -104,6 +111,7 @@ def test_process_should_ratelimit_with_different_connection_manager():
104111 },
105112 "remote_address" : "192.168.1.1" ,
106113 "user" : {"id" : 1 , "name" : "Test User" },
114+ "group" : None ,
107115 }
108116
109117 with patch (
@@ -120,10 +128,12 @@ def test_process_should_ratelimit_with_different_connection_manager():
120128 remote_address = data ["remote_address" ],
121129 user = data ["user" ],
122130 connection_manager = connection_manager1 ,
131+ group = None ,
123132 )
124133 mock_should_ratelimit .assert_any_call (
125134 route_metadata = data ["route_metadata" ],
126135 remote_address = data ["remote_address" ],
127136 user = data ["user" ],
128137 connection_manager = connection_manager2 ,
138+ group = None ,
129139 )
0 commit comments