@@ -323,4 +323,40 @@ def test_empty_detector_params(self, client: TestClient):
323
323
resp = client .post ("/api/v1/text/contents" , json = payload )
324
324
assert resp .status_code == 200
325
325
# Should return empty list since no detectors are specified
326
- assert resp .json ()[0 ] == []
326
+ assert resp .json ()[0 ] == []
327
+
328
+ def test_multiple_invalid_file_types (self , client : TestClient ):
329
+ """Test multiple invalid file types to ensure all errors are handled"""
330
+ payload = {
331
+ "contents" : ['test content' ],
332
+ "detector_params" : {"file_type" : ["invalid_type_1" , "invalid_type_2" ]}
333
+ }
334
+ resp = client .post ("/api/v1/text/contents" , json = payload )
335
+ assert resp .status_code == 400
336
+ data = resp .json ()
337
+ assert "message" in data
338
+ assert "Unrecognized file type" in data ["message" ]
339
+
340
+ def test_mixed_valid_invalid_file_types (self , client : TestClient ):
341
+ """Test mixing valid and invalid file types"""
342
+ payload = {
343
+ "contents" : ['{a: 1, b: 2}' ],
344
+ "detector_params" : {"file_type" : ["json" , "invalid_type" ]}
345
+ }
346
+ resp = client .post ("/api/v1/text/contents" , json = payload )
347
+ assert resp .status_code == 400
348
+ data = resp .json ()
349
+ assert "message" in data
350
+ assert "Unrecognized file type" in data ["message" ]
351
+
352
+ def test_case_sensitivity_file_types (self , client : TestClient ):
353
+ """Test case sensitivity of file types"""
354
+ payload = {
355
+ "contents" : ['{"a": 1}' ],
356
+ "detector_params" : {"file_type" : ["JSON" ]} # uppercase
357
+ }
358
+ resp = client .post ("/api/v1/text/contents" , json = payload )
359
+ assert resp .status_code == 400
360
+ data = resp .json ()
361
+ assert "message" in data
362
+ assert "Unrecognized file type" in data ["message" ]
0 commit comments