db_modeling_for_capi #5

Merged
jonas merged 23 commits from db_modeling_for_capi into main 2025-10-10 14:57:52 +00:00
Showing only changes of commit 1b3ebb3cad - Show all commits

View File

@@ -91,7 +91,7 @@ def sample_reservation(sample_customer):
num_children=1, num_children=1,
children_ages=[8], children_ages=[8],
offer="Christmas Special", offer="Christmas Special",
created_at=datetime.now(UTC), created_at=datetime(2024, 11, 1, 12, 0, 0, tzinfo=UTC),
utm_source="google", utm_source="google",
utm_medium="cpc", utm_medium="cpc",
utm_campaign="winter2024", utm_campaign="winter2024",
@@ -109,8 +109,6 @@ def sample_reservation(sample_customer):
children_csv = ",".join(str(int(a)) for a in children_list) if children_list else "" children_csv = ",".join(str(int(a)) for a in children_list) if children_list else ""
data["children_ages"] = children_csv data["children_ages"] = children_csv
print(data)
return Reservation( return Reservation(
id=1, id=1,
customer_id=1, customer_id=1,
@@ -141,7 +139,7 @@ def minimal_reservation(minimal_customer):
num_children=0, num_children=0,
children_ages=[], children_ages=[],
hotel_code="HOTEL123", hotel_code="HOTEL123",
created_at=datetime.now(UTC), created_at=datetime(2024, 12, 2, 12, 0, 0, tzinfo=UTC),
hotel_name="Alpine Paradise Resort", hotel_name="Alpine Paradise Resort",
) )
@@ -169,7 +167,7 @@ def read_request_xml():
Version="8.000"> Version="8.000">
<ReadRequests> <ReadRequests>
<HotelReadRequest HotelCode="HOTEL123" HotelName="Alpine Paradise Resort"> <HotelReadRequest HotelCode="HOTEL123" HotelName="Alpine Paradise Resort">
<SelectionCriteria Start="2024-12-01" End="2025-01-31"/> <SelectionCriteria Start="2024-10-01" End="2025-01-31"/>
</HotelReadRequest> </HotelReadRequest>
</ReadRequests> </ReadRequests>
</OTA_ReadRQ>""" </OTA_ReadRQ>"""
@@ -334,7 +332,7 @@ class TestXMLParsing:
assert hotel_req.hotel_code == "HOTEL123" assert hotel_req.hotel_code == "HOTEL123"
assert hotel_req.hotel_name == "Alpine Paradise Resort" assert hotel_req.hotel_name == "Alpine Paradise Resort"
assert hotel_req.selection_criteria is not None assert hotel_req.selection_criteria is not None
assert hotel_req.selection_criteria.start == "2024-12-01" assert hotel_req.selection_criteria.start == "2024-10-01"
def test_parse_read_request_no_date(self, read_request_xml_no_date_filter): def test_parse_read_request_no_date(self, read_request_xml_no_date_filter):
"""Test parsing of OTA_ReadRQ without date filter.""" """Test parsing of OTA_ReadRQ without date filter."""
@@ -726,7 +724,7 @@ class TestAcknowledgments:
Version="8.000"> Version="8.000">
<ReadRequests> <ReadRequests>
<HotelReadRequest HotelCode="HOTEL123" HotelName="Alpine Paradise Resort"> <HotelReadRequest HotelCode="HOTEL123" HotelName="Alpine Paradise Resort">
<SelectionCriteria Start="2024-12-01" End="2025-02-01"/> <SelectionCriteria Start="2024-12-01"/>
</HotelReadRequest> </HotelReadRequest>
</ReadRequests> </ReadRequests>
</OTA_ReadRQ>""" </OTA_ReadRQ>"""