From 3f64310217db3d04c66be289f377cdb3a4476835 Mon Sep 17 00:00:00 2001 From: Swaraj Kumar Date: Mon, 21 Apr 2025 13:29:41 +0530 Subject: [PATCH] Test cases for FG controller Implement Error Handling in Responses in all the components of AIMLFW Issue Id: AIMLFW-181 Change-Id: Ie24647e08666c97d9baa1e21fc13f06b99b775b5 Signed-off-by: Swaraj Kumar --- tests/test_featuregroupcontroller.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_featuregroupcontroller.py b/tests/test_featuregroupcontroller.py index 41fcdb9..68804af 100644 --- a/tests/test_featuregroupcontroller.py +++ b/tests/test_featuregroupcontroller.py @@ -53,3 +53,10 @@ class TestCreateFeatureGroup: assert response.status_code == 409 expected = ProblemDetails(409, "Conflict", "feature group already exist").to_dict() assert response.get_json() == expected + + @patch('trainingmgr.schemas.featuregroup_schema.FeatureGroupSchema.load', side_effect=DBException("some DB error")) + def test_db_exception(self, mock_load, client): + response = client.post("/featureGroup", json={}) + assert response.status_code == 400 + expected = ProblemDetails(400, "Bad Request", "some DB error").to_dict() + assert response.get_json() == expected \ No newline at end of file -- 2.16.6