From 96c248de870afa5d034be2161edd6b166afa92ff Mon Sep 17 00:00:00 2001 From: Swaraj Kumar Date: Fri, 4 Apr 2025 15:25:42 +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: Ib3f6aa3f5fa9131578513b14b000ad9d923b8643 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 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 -- 2.16.6