From 19af7a060649a9cf8d3874a656d87f28d566806a Mon Sep 17 00:00:00 2001 From: Ching Wei Kang Date: Tue, 16 Jun 2026 20:54:53 -0500 Subject: [PATCH] fix: accept string bulk update warning messages --- ofsc/models/__init__.py | 2 +- tests/test_model.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) 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)