@@ -44,7 +44,9 @@ def handler(self):
4444
4545 def test_validation_error_http (self , handler ):
4646 """Test validation error HTTP response returns safe message, keeps field-level details."""
47- exception = ValidationError ("Internal field path: user.secret_token" , details = {"field" : "name" })
47+ exception = ValidationError (
48+ "Internal field path: user.secret_token" , details = {"field" : "name" }
49+ )
4850
4951 response = handler .handle_error_for_http (exception )
5052
@@ -96,7 +98,9 @@ def test_request_not_found_http(self, handler):
9698
9799 def test_request_validation_http (self , handler ):
98100 """Test request validation error HTTP response returns safe message, keeps field details."""
99- exception = RequestValidationError ("Invalid request: count must be <= 500" , details = {"field" : "count" })
101+ exception = RequestValidationError (
102+ "Invalid request: count must be <= 500" , details = {"field" : "count" }
103+ )
100104
101105 response = handler .handle_error_for_http (exception )
102106
@@ -121,7 +125,9 @@ def test_machine_not_found_http(self, handler):
121125
122126 def test_machine_validation_http (self , handler ):
123127 """Test machine validation error HTTP response returns safe message, keeps field details."""
124- exception = MachineValidationError ("Invalid machine: internal type code 0x3F" , details = {"field" : "type" })
128+ exception = MachineValidationError (
129+ "Invalid machine: internal type code 0x3F" , details = {"field" : "type" }
130+ )
125131
126132 response = handler .handle_error_for_http (exception )
127133
@@ -147,7 +153,8 @@ def test_template_not_found_http(self, handler):
147153 def test_template_validation_http (self , handler ):
148154 """Test template validation error HTTP response returns safe message, keeps field details."""
149155 exception = TemplateValidationError (
150- "Invalid template: internal path /etc/templates/secret.yaml" , details = {"field" : "config" }
156+ "Invalid template: internal path /etc/templates/secret.yaml" ,
157+ details = {"field" : "config" },
151158 )
152159
153160 response = handler .handle_error_for_http (exception )
@@ -161,7 +168,9 @@ def test_template_validation_http(self, handler):
161168
162169 def test_infrastructure_error_http (self , handler ):
163170 """Test infrastructure error HTTP response does not leak original_error to client."""
164- exception = InfrastructureError ("Database connection failed: host=internal-db.corp port=5432" )
171+ exception = InfrastructureError (
172+ "Database connection failed: host=internal-db.corp port=5432"
173+ )
165174
166175 response = handler .handle_error_for_http (exception )
167176
@@ -174,7 +183,9 @@ def test_infrastructure_error_http(self, handler):
174183
175184 def test_configuration_error_http (self , handler ):
176185 """Test configuration error HTTP response does not leak original_error to client."""
177- exception = ConfigurationError ("Invalid config: secret_key=abc123 at path /etc/orb/config.yaml" )
186+ exception = ConfigurationError (
187+ "Invalid config: secret_key=abc123 at path /etc/orb/config.yaml"
188+ )
178189
179190 response = handler .handle_error_for_http (exception )
180191
@@ -255,7 +266,9 @@ def test_infrastructure_error_does_not_leak_secret_to_client_but_logs_it(self, h
255266 original_logger = handler ._logger
256267
257268 mock_logger = MagicMock ()
258- mock_logger .error .side_effect = lambda * args , ** kwargs : log_calls .append (("error" , args , kwargs ))
269+ mock_logger .error .side_effect = lambda * args , ** kwargs : log_calls .append (
270+ ("error" , args , kwargs )
271+ )
259272 handler ._logger = mock_logger
260273
261274 try :
@@ -275,9 +288,7 @@ def test_infrastructure_error_does_not_leak_secret_to_client_but_logs_it(self, h
275288
276289 def test_duplicate_error_does_not_leak_raw_message (self , handler ):
277290 """DuplicateError returns a generic safe message; raw detail stays out of response."""
278- exception = DuplicateError (
279- "Duplicate key: machine_id=m-secret-prod-123 in table machines"
280- )
291+ exception = DuplicateError ("Duplicate key: machine_id=m-secret-prod-123 in table machines" )
281292
282293 response = handler .handle_error_for_http (exception )
283294
0 commit comments