Test cases for FG controller 01/14301/5
authorSwaraj Kumar <swaraj.kumar@samsung.com>
Fri, 4 Apr 2025 09:55:42 +0000 (15:25 +0530)
committerSwaraj Kumar <swaraj.kumar@samsung.com>
Tue, 15 Apr 2025 11:16:58 +0000 (11:16 +0000)
Implement Error Handling in Responses in all the components of AIMLFW

Issue Id- AIMLFW-181
Change-Id: Ib3f6aa3f5fa9131578513b14b000ad9d923b8643
Signed-off-by: Swaraj Kumar <swaraj.kumar@samsung.com>
tests/test_featuregroupcontroller.py

index d0b2890..888f680 100644 (file)
@@ -39,3 +39,10 @@ class TestCreateFeatureGroup:
         assert response.status_code == 400
         expected = ProblemDetails(400, "Bad Request", "Failed to create the feature group since feature group not valid").to_dict()
         assert response.get_json() == expected
+
+    @patch('trainingmgr.schemas.featuregroup_schema.FeatureGroupSchema.load', side_effect=ValidationError("Invalid format"))
+    def test_validation_error(self, mock_load, client):
+        response = client.post("/featureGroup", json={})
+        assert response.status_code == 400
+        expected = ProblemDetails(400, "Validation Error", "Invalid format").to_dict()
+        assert response.get_json() == expected