From: Swaraj Kumar Date: Fri, 4 Apr 2025 09:56:57 +0000 (+0530) Subject: Test cases for FG controller X-Git-Tag: 4.0.0~9 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=9ba671c01c70147f36bdf6d67a6a7e7515acbfe2;p=aiml-fw%2Fawmf%2Ftm.git Test cases for FG controller Implement Error Handling in Responses in all the components of AIMLFW Issue Id- AIMLFW-181 Change-Id: Ibdd1722ba8ca8be2984e1e8bb5170325dc989b96 Signed-off-by: Swaraj Kumar --- diff --git a/tests/test_featuregroupcontroller.py b/tests/test_featuregroupcontroller.py index 888f680..41fcdb9 100644 --- a/tests/test_featuregroupcontroller.py +++ b/tests/test_featuregroupcontroller.py @@ -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