Skip to content

Commit

Permalink
Support overriding or using the season status in batch
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Nov 22, 2024
1 parent f818707 commit 1ad8db7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion seatsio/events/changeObjectStatusRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions seatsio/events/statusChangeRequest.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 13 additions & 0 deletions tests/events/testChangeObjectStatusInBatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 1ad8db7

Please sign in to comment.