From: Swaraj Kumar Date: Mon, 21 Apr 2025 08:01:09 +0000 (+0530) Subject: Test cases for FG controller X-Git-Tag: 4.0.0~6 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F14328%2F3;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: I7dee5471b1b7fb84f29c079595a8eb9117f675aa Signed-off-by: Swaraj Kumar --- diff --git a/tests/test_featuregroupcontroller.py b/tests/test_featuregroupcontroller.py index 68804af..25455ad 100644 --- a/tests/test_featuregroupcontroller.py +++ b/tests/test_featuregroupcontroller.py @@ -59,4 +59,11 @@ class TestCreateFeatureGroup: 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 + + @patch('trainingmgr.schemas.featuregroup_schema.FeatureGroupSchema.load', side_effect=Exception("unexpected fail")) + def test_generic_exception(self, mock_load, client): + response = client.post("/featureGroup", json={}) + assert response.status_code == 500 + expected = ProblemDetails(500, "Internal Server Error", "unexpected fail").to_dict() assert response.get_json() == expected \ No newline at end of file