diff --git a/ofsc/models/__init__.py b/ofsc/models/__init__.py index ebf86b5..91270fa 100644 --- a/ofsc/models/__init__.py +++ b/ofsc/models/__init__.py @@ -325,7 +325,7 @@ class BulkUpdateError(BaseModel): class BulkUpdateWarning(BaseModel): code: Optional[int] = None - message: Optional[int] = None + message: Optional[str] = None class BulkUpdateResult(BaseModel): diff --git a/tests/test_model.py b/tests/test_model.py index 68251c1..30fb88b 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -8,6 +8,7 @@ from ofsc.models import ( ActivityType, ActivityTypeGroup, + BulkUpdateResponse, CapacityArea, CapacityAreaListResponse, CapacityCategoryListResponse, @@ -25,6 +26,26 @@ ) +def test_bulk_update_response_accepts_string_warning_message(): + raw = { + "results": [ + { + "activityKeys": {"activityId": 4225, "apptNumber": "0010a000019oDas"}, + "operationsPerformed": ["updateProperties", "updatePosition"], + "warnings": [ + {"code": 1, "message": "Activity moved to a non-scheduled bucket"}, + ], + }, + ], + } + + response = BulkUpdateResponse.model_validate(raw) + + warning = response.results[0].warnings[0] + assert warning.code == 1 + assert warning.message == "Activity moved to a non-scheduled bucket" + + def test_translation_model_base(): base = {"language": "en", "name": "Estimate", "languageISO": "en-US"} obj = Translation.model_validate(base)