@@ -99,13 +99,13 @@ def test_authorization_conflict_basic_auth(self, caplog):
9999
100100 # Authorization should be blocked, X-Tenant-Id should pass through
101101 expected = {
102- "Content-Type" : "application/json" ,
102+ "Content-Type" : "application/json" ,
103103 "X-Tenant-Id" : "acme-corp"
104104 }
105105 assert result == expected
106-
106+
107107 # Check warning was logged
108- assert any ("Skipping Authorization header passthrough due to basic auth" in record .message
108+ assert any ("Skipping Authorization header passthrough due to basic auth" in record .message
109109 for record in caplog .records )
110110
111111 def test_authorization_conflict_bearer_auth (self , caplog ):
@@ -158,7 +158,7 @@ def test_base_header_conflict_prevention(self, caplog):
158158 assert result == expected
159159
160160 # Check conflict warning was logged
161- assert any ("conflicts with pre-defined headers" in record .message
161+ assert any ("conflicts with pre-defined headers" in record .message
162162 for record in caplog .records )
163163
164164 def test_case_insensitive_header_matching (self ):
@@ -170,7 +170,7 @@ def test_case_insensitive_header_matching(self):
170170
171171 # Request headers are expected to be normalized to lowercase
172172 request_headers = {
173- "x-tenant-id" : "mixed-case-value" , # Lowercase key
173+ "x-tenant-id" : "mixed-case-value" , # Lowercase key
174174 "authorization" : "bearer lowercase-header"
175175 }
176176 base_headers = {}
@@ -237,7 +237,7 @@ def test_none_allowed_headers(self):
237237 # Mock settings fallback
238238 with patch ('mcpgateway.utils.passthrough_headers.settings' ) as mock_settings :
239239 mock_settings .default_passthrough_headers = ["X-Default" ]
240-
240+
241241 result = get_passthrough_headers (request_headers , base_headers , mock_db )
242242
243243 # Should fall back to settings, but request doesn't have X-Default
@@ -255,7 +255,7 @@ def test_no_global_config_fallback_to_settings(self):
255255 # Mock settings fallback
256256 with patch ('mcpgateway.utils.passthrough_headers.settings' ) as mock_settings :
257257 mock_settings .default_passthrough_headers = ["X-Default" ]
258-
258+
259259 result = get_passthrough_headers (request_headers , base_headers , mock_db )
260260
261261 expected = {
@@ -311,7 +311,7 @@ def test_base_headers_not_modified(self):
311311
312312 # Original base_headers should not be modified
313313 assert base_headers == original_base
314-
314+
315315 # Result should include both base and passthrough headers
316316 assert "Content-Type" in result
317317 assert "X-Tenant-Id" in result
@@ -328,7 +328,7 @@ def test_multiple_auth_type_conflicts(self, caplog):
328328
329329 # Test with different auth types
330330 auth_types = ["basic" , "bearer" , "api-key" , None ]
331-
331+
332332 for auth_type in auth_types :
333333 caplog .clear ()
334334 mock_gateway = Mock (spec = DbGateway )
@@ -418,8 +418,8 @@ def test_logging_levels(self, caplog):
418418
419419 # Should have warnings for: missing header, auth conflict, base header conflict
420420 warning_messages = [record .message for record in caplog .records if record .levelno == logging .WARNING ]
421-
421+
422422 assert len (warning_messages ) == 3
423423 assert any ("not found in request headers" in msg for msg in warning_messages )
424424 assert any ("due to basic auth" in msg for msg in warning_messages )
425- assert any ("conflicts with pre-defined headers" in msg for msg in warning_messages )
425+ assert any ("conflicts with pre-defined headers" in msg for msg in warning_messages )
0 commit comments