Test cases for FG controller 02/14302/5
authorSwaraj Kumar <swaraj.kumar@samsung.com>
Fri, 4 Apr 2025 09:56:57 +0000 (15:26 +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: Ibdd1722ba8ca8be2984e1e8bb5170325dc989b96
Signed-off-by: Swaraj Kumar <swaraj.kumar@samsung.com>
tests/test_featuregroupcontroller.py

index 888f680..41fcdb9 100644 (file)
@@ -46,3 +46,10 @@ class TestCreateFeatureGroup:
         assert response.status_code == 400
         expected = ProblemDetails(400, "Validation Error", "Invalid format").to_dict()
         assert response.get_json() == expected
+
+    @patch('trainingmgr.schemas.featuregroup_schema.FeatureGroupSchema.load', side_effect=DBException("feature group already exist"))
+    def test_conflict_error(self, mock_load, client):
+        response = client.post("/featureGroup", json={})
+        assert response.status_code == 409
+        expected = ProblemDetails(409, "Conflict", "feature group already exist").to_dict()
+        assert response.get_json() == expected