From 1ad8db76d0235e8dab4efc8c57a2e6d87d2019d4 Mon Sep 17 00:00:00 2001 From: mroloux Date: Fri, 22 Nov 2024 09:09:28 +0100 Subject: [PATCH] Support overriding or using the season status in batch --- seatsio/events/changeObjectStatusRequest.py | 2 +- seatsio/events/statusChangeRequest.py | 2 ++ tests/events/testChangeObjectStatusInBatch.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/seatsio/events/changeObjectStatusRequest.py b/seatsio/events/changeObjectStatusRequest.py index 6f1b549..f66aea3 100644 --- a/seatsio/events/changeObjectStatusRequest.py +++ b/seatsio/events/changeObjectStatusRequest.py @@ -8,7 +8,7 @@ def __init__(self, type, object_or_objects, status, hold_token, order_id, event_ self.objects = self.__normalize_objects(object_or_objects) if type is not None: self.type = type - if type is not 'RELEASE': + if status is not None: self.status = status if hold_token: self.holdToken = hold_token diff --git a/seatsio/events/statusChangeRequest.py b/seatsio/events/statusChangeRequest.py index cd13e2a..83e9185 100644 --- a/seatsio/events/statusChangeRequest.py +++ b/seatsio/events/statusChangeRequest.py @@ -1,6 +1,8 @@ class StatusChangeRequest: TYPE_CHANGE_STATUS_TO = "CHANGE_STATUS_TO" RELEASE = "RELEASE" + OVERRIDE_SEASON_STATUS = "OVERRIDE_SEASON_STATUS" + USE_SEASON_STATUS = "USE_SEASON_STATUS" def __init__(self, event_key, object_or_objects, status=None, hold_token=None, order_id=None, keep_extra_data=None, ignore_channels=None, channel_keys=None, allowed_previous_statuses=None, rejected_previous_statuses=None, type=None): self.type = type diff --git a/tests/events/testChangeObjectStatusInBatch.py b/tests/events/testChangeObjectStatusInBatch.py index 99d9fa0..e7b1ddd 100644 --- a/tests/events/testChangeObjectStatusInBatch.py +++ b/tests/events/testChangeObjectStatusInBatch.py @@ -89,3 +89,16 @@ def test_release(self): assert_that(self.client.events.retrieve_object_info(event.key, "A-1").status).is_equal_to(EventObjectInfo.FREE) assert_that(res[0].objects["A-1"].status).is_equal_to(EventObjectInfo.FREE) + + def test_override_season_status(self): + chart_key = self.create_test_chart() + season = self.client.seasons.create(chart_key, event_keys=["event1"]) + self.client.events.book(season.key, ["A-1", "A-2"]) + + res = self.client.events.change_object_status_in_batch([ + StatusChangeRequest("event1", ["A-1"], type=StatusChangeRequest.OVERRIDE_SEASON_STATUS) + ]) + + assert_that(res[0].objects["A-1"].status).is_equal_to(EventObjectInfo.FREE) + a1_status = self.client.events.retrieve_object_info("event1", "A-1").status + assert_that(a1_status).is_equal_to(EventObjectInfo.FREE)