From 039dad02d5129f2021af0a5917c9ddd38ca61cb8 Mon Sep 17 00:00:00 2001 From: Samuele Lenticchia Date: Thu, 6 Jun 2024 11:32:13 +0200 Subject: [PATCH 1/4] AVB-759: Add ticket.aisle field --- livestyled/models/ticket.py | 15 ++++++++++----- livestyled/schemas/ticket.py | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/livestyled/models/ticket.py b/livestyled/models/ticket.py index 2559391..3e4424e 100644 --- a/livestyled/models/ticket.py +++ b/livestyled/models/ticket.py @@ -59,7 +59,8 @@ def __init__( additional_fields=[], printed=True, timezone=None, - ticket_type='ticket' + ticket_type='ticket', + aisle=None, ): self.id = id self.external_ticket_id = external_ticket_id @@ -172,6 +173,7 @@ def __init__( self.printed = printed self.timezone = timezone self.ticket_type = ticket_type + self.aisle = aisle @classmethod def placeholder( @@ -228,7 +230,8 @@ def placeholder( additional_fields=[], printed=True, timezone=None, - ticket_type='ticket' + ticket_type='ticket', + aisle=None, ) @classmethod @@ -280,7 +283,8 @@ def create_new( additional_fields=None, printed=True, timezone=None, - ticket_type='ticket' + ticket_type='ticket', + aisle=None, ): if additional_fields is None: additional_fields = [] @@ -334,7 +338,8 @@ def create_new( additional_fields=additional_fields, printed=printed, timezone=timezone, - ticket_type=ticket_type + ticket_type=ticket_type, + aisle=aisle, ) if isinstance(user, (str, int)): user = User.placeholder(id=user) @@ -403,7 +408,7 @@ def diff(self, existing): 'redeemer_email', 'parent_ticket', 'shared_at', 'legal_long_text', 'legal_short_text', 'map_url', 'map_image_url', 'ticket_integration', 'entrance', 'row', 'section', 'price_code', 'price_type', 'external_customer_ref', 'venue', 'event', 'event_date', 'currency', 'external_card_ref', - 'additional_fields', 'printed', 'timezone', 'ticket_type' + 'additional_fields', 'printed', 'timezone', 'ticket_type', 'aisle' ) for field in fields: current = getattr(existing, field) diff --git a/livestyled/schemas/ticket.py b/livestyled/schemas/ticket.py index 2ff0851..0acd027 100644 --- a/livestyled/schemas/ticket.py +++ b/livestyled/schemas/ticket.py @@ -102,3 +102,4 @@ class Meta: printed = fields.Boolean(allow_none=True, required=False, missing=True) timezone = fields.String(allow_none=True, required=False, missing=None) ticket_type = fields.String(data_key='ticketType', required=False, allow_none=False) + aisle = fields.String(data_key='aisle', required=False, allow_none=False) From a77fa4c7699d346a3cb54393415544308be82788 Mon Sep 17 00:00:00 2001 From: Samuele Lenticchia Date: Thu, 6 Jun 2024 13:01:36 +0200 Subject: [PATCH 2/4] AVB-759: Fix tests --- livestyled/schemas/tests/fixtures/example_ticket.json | 3 ++- .../schemas/tests/fixtures/example_ticket_shared.json | 3 ++- .../tests/fixtures/example_ticket_shared_redeemed.json | 3 ++- .../fixtures/example_ticket_with_event_and_venue.json | 3 ++- livestyled/schemas/tests/test_ticket.py | 7 +++++++ livestyled/tests/test_resource_client_ticket.py | 9 ++++++--- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/livestyled/schemas/tests/fixtures/example_ticket.json b/livestyled/schemas/tests/fixtures/example_ticket.json index 09ccf32..1ca7992 100644 --- a/livestyled/schemas/tests/fixtures/example_ticket.json +++ b/livestyled/schemas/tests/fixtures/example_ticket.json @@ -47,5 +47,6 @@ "sort": 0 } ], - "ticketType": "ticket" + "ticketType": "ticket", + "aisle": "aisle" } diff --git a/livestyled/schemas/tests/fixtures/example_ticket_shared.json b/livestyled/schemas/tests/fixtures/example_ticket_shared.json index bcfba43..e705da6 100644 --- a/livestyled/schemas/tests/fixtures/example_ticket_shared.json +++ b/livestyled/schemas/tests/fixtures/example_ticket_shared.json @@ -21,5 +21,6 @@ "shareCode": "ABCDEF12345", "sharedAt": "2019-05-24T12:41:22+00:00", "sharerEmail": "test@livestyled.com", - "ticketType": "ticket" + "ticketType": "ticket", + "aisle": "aisle" } \ No newline at end of file diff --git a/livestyled/schemas/tests/fixtures/example_ticket_shared_redeemed.json b/livestyled/schemas/tests/fixtures/example_ticket_shared_redeemed.json index 46132dc..7df69e6 100644 --- a/livestyled/schemas/tests/fixtures/example_ticket_shared_redeemed.json +++ b/livestyled/schemas/tests/fixtures/example_ticket_shared_redeemed.json @@ -24,5 +24,6 @@ "redeemerEmail": "someoneelse@livestyled.com", "redeemedAt": "2019-05-24T13:41:22+00:00", "redeemer": "/v4/users/1234", - "ticketType": "ticket" + "ticketType": "ticket", + "aisle": "aisle" } \ No newline at end of file diff --git a/livestyled/schemas/tests/fixtures/example_ticket_with_event_and_venue.json b/livestyled/schemas/tests/fixtures/example_ticket_with_event_and_venue.json index f9e1f7d..15f6207 100644 --- a/livestyled/schemas/tests/fixtures/example_ticket_with_event_and_venue.json +++ b/livestyled/schemas/tests/fixtures/example_ticket_with_event_and_venue.json @@ -53,5 +53,6 @@ "clientEmail": "hakan.goransson@stockholmlive.com", "clientId": "hakan.goransson@stockholmlive.com" }, - "ticketType": "ticket" + "ticketType": "ticket", + "aisle": "aisle" } \ No newline at end of file diff --git a/livestyled/schemas/tests/test_ticket.py b/livestyled/schemas/tests/test_ticket.py index 09eee6e..20b2597 100644 --- a/livestyled/schemas/tests/test_ticket.py +++ b/livestyled/schemas/tests/test_ticket.py @@ -92,6 +92,7 @@ def test_deserialize_ticket(): 'printed': True, 'timezone': None, 'ticket_type': 'ticket', + 'aisle': 'aisle', } @@ -152,6 +153,7 @@ def test_deserialize_ticket_shared(): 'printed': True, 'timezone': None, 'ticket_type': 'ticket', + 'aisle': 'aisle', } @@ -212,6 +214,7 @@ def test_deserialize_ticket_shared_redeemed(): 'printed': True, 'timezone': None, 'ticket_type': 'ticket', + 'aisle': 'aisle', } @@ -286,6 +289,7 @@ def test_deserialize_ticket_with_event_and_venue(): 'printed': True, 'timezone': None, 'ticket_type': 'ticket', + 'aisle': 'aisle', } @@ -300,6 +304,7 @@ def test_serialize_ticket(): event=9999, user=8888, ticket_type='ticket', + aisle='aisle', ) serialized_ticket = TicketSchema().dump(ticket) assert serialized_ticket == { @@ -354,6 +359,7 @@ def test_serialize_ticket(): 'printed': True, 'timezone': None, 'ticketType': 'ticket', + 'aisle': 'aisle', } @@ -427,6 +433,7 @@ def get_ticket(data: Dict or None = None): ], 'timezone': None, 'ticket_type': 'ticket', + 'aisle': 'aisle', } if data: diff --git a/livestyled/tests/test_resource_client_ticket.py b/livestyled/tests/test_resource_client_ticket.py index 49b5f30..609cb4a 100644 --- a/livestyled/tests/test_resource_client_ticket.py +++ b/livestyled/tests/test_resource_client_ticket.py @@ -57,7 +57,8 @@ def test_get_ticket(requests_mock): assert ticket.venue_name is None assert ticket.venue_room is None assert ticket.redeemed_at is None - assert ticket.ticket_type is 'ticket' + assert ticket.ticket_type == 'ticket' + assert ticket.aisle is None def test_get_ticket_shared(requests_mock): @@ -104,7 +105,8 @@ def test_get_ticket_shared(requests_mock): assert ticket.venue_name is None assert ticket.venue_room is None assert ticket.redeemed_at is None - assert ticket.ticket_type is 'ticket' + assert ticket.ticket_type == 'ticket' + assert ticket.aisle is None def test_get_ticket_shared_redeemed(requests_mock): @@ -152,7 +154,8 @@ def test_get_ticket_shared_redeemed(requests_mock): assert ticket.venue_name is None assert ticket.venue_room is None assert ticket.redeemed_at == datetime(2019, 5, 24, 13, 41, 22, tzinfo=timezone(timedelta(0), '+0000')) - assert ticket.ticket_type is 'ticket' + assert ticket.ticket_type == 'ticket' + assert ticket.aisle is None def test_create_ticket(requests_mock): From 8c812cdfd4bcbcbf1e21f8716938d66e3b4aaef8 Mon Sep 17 00:00:00 2001 From: Samuele Lenticchia Date: Thu, 6 Jun 2024 14:24:03 +0200 Subject: [PATCH 3/4] AVB-759: Allow none for aisle field --- livestyled/schemas/ticket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/livestyled/schemas/ticket.py b/livestyled/schemas/ticket.py index 0acd027..b0dc02b 100644 --- a/livestyled/schemas/ticket.py +++ b/livestyled/schemas/ticket.py @@ -102,4 +102,4 @@ class Meta: printed = fields.Boolean(allow_none=True, required=False, missing=True) timezone = fields.String(allow_none=True, required=False, missing=None) ticket_type = fields.String(data_key='ticketType', required=False, allow_none=False) - aisle = fields.String(data_key='aisle', required=False, allow_none=False) + aisle = fields.String(data_key='aisle', required=False, allow_none=True) From ec3507fb041bd21caae3876cfe6b450b55dddd6c Mon Sep 17 00:00:00 2001 From: Samuele Lenticchia Date: Thu, 6 Jun 2024 15:26:27 +0200 Subject: [PATCH 4/4] AVB-759: Increase version --- livestyled/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/livestyled/__init__.py b/livestyled/__init__.py index 4b922b3..a314565 100644 --- a/livestyled/__init__.py +++ b/livestyled/__init__.py @@ -1 +1 @@ -__version__ = '1.4.10' +__version__ = '1.4.11'