From: Swaraj Kumar Date: Fri, 4 Apr 2025 09:55:42 +0000 (+0530) Subject: Test cases for FG controller X-Git-Tag: 4.0.0~10 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=96c248de870afa5d034be2161edd6b166afa92ff;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: Ib3f6aa3f5fa9131578513b14b000ad9d923b8643 Signed-off-by: Swaraj Kumar --- diff --git a/tests/test_featuregroupcontroller.py b/tests/test_featuregroupcontroller.py index d0b2890..888f680 100644 --- a/tests/test_featuregroupcontroller.py +++ b/tests/test_featuregroupcontroller.py @@ -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