Updated config

This commit is contained in:
Jonas Linter
2025-10-09 14:16:11 +02:00
parent 162ef39013
commit f05cc9215e
5 changed files with 85 additions and 25 deletions

View File

@@ -191,6 +191,12 @@ def read_request_xml_no_date_filter():
def test_config():
"""Test configuration with hotel credentials."""
return {
"server": {
"codecontext": "ADVERTISING",
"code": "70597314",
"companyname": "99tales Gmbh",
"res_id_source_context": "99tales",
},
"alpine_bits_auth": [
{
"hotel_id": "HOTEL123",
@@ -198,7 +204,7 @@ def test_config():
"username": "testuser",
"password": "testpass",
}
]
],
}
@@ -215,9 +221,9 @@ def client_info():
class TestCreateResRetrieveResponse:
"""Test the create_res_retrieve_response function."""
def test_empty_list(self):
def test_empty_list(self, test_config):
"""Test creating response with empty reservation list."""
response = create_res_retrieve_response([])
response = create_res_retrieve_response([], config=test_config)
assert response is not None, "Response should not be None"
@@ -232,10 +238,10 @@ class TestCreateResRetrieveResponse:
"Response should have reservations_list attribute"
)
def test_single_reservation(self, sample_reservation, sample_customer):
def test_single_reservation(self, sample_reservation, sample_customer, test_config):
"""Test creating response with single reservation."""
reservation_pairs = [(sample_reservation, sample_customer)]
response = create_res_retrieve_response(reservation_pairs)
response = create_res_retrieve_response(reservation_pairs, config=test_config)
assert response is not None
assert hasattr(response, "reservations_list"), (
@@ -273,13 +279,14 @@ class TestCreateResRetrieveResponse:
sample_customer,
minimal_reservation,
minimal_customer,
test_config,
):
"""Test creating response with multiple reservations."""
reservation_pairs = [
(sample_reservation, sample_customer),
(minimal_reservation, minimal_customer),
]
response = create_res_retrieve_response(reservation_pairs)
response = create_res_retrieve_response(reservation_pairs, config=test_config)
assert response is not None
@@ -297,13 +304,15 @@ class TestCreateResRetrieveResponse:
assert "John" in xml_output
assert "Jane" in xml_output
def test_reservation_with_children(self, sample_reservation, sample_customer):
def test_reservation_with_children(
self, sample_reservation, sample_customer, test_config
):
"""Test reservation with children ages."""
sample_reservation.num_children = 2
sample_reservation.children_ages = "8,5"
reservation_pairs = [(sample_reservation, sample_customer)]
response = create_res_retrieve_response(reservation_pairs)
response = create_res_retrieve_response(reservation_pairs, config=test_config)
config = SerializerConfig(pretty_print=True)
serializer = XmlSerializer(config=config)
@@ -348,10 +357,11 @@ class TestXMLParsing:
self,
sample_reservation,
sample_customer,
test_config,
):
"""Test serialization of retrieve response to XML."""
reservation_pairs = [(sample_reservation, sample_customer)]
response = create_res_retrieve_response(reservation_pairs)
response = create_res_retrieve_response(reservation_pairs, config=test_config)
config = SerializerConfig(
pretty_print=True, xml_declaration=True, encoding="UTF-8"
@@ -378,7 +388,7 @@ class TestXMLParsing:
class TestEdgeCases:
"""Test edge cases and error conditions."""
def test_customer_with_special_characters(self):
def test_customer_with_special_characters(self, test_config):
"""Test customer with special characters in name."""
customer = Customer(
id=99,
@@ -400,7 +410,7 @@ class TestEdgeCases:
)
reservation_pairs = [(reservation, customer)]
response = create_res_retrieve_response(reservation_pairs)
response = create_res_retrieve_response(reservation_pairs, config=test_config)
config = SerializerConfig(pretty_print=True, encoding="UTF-8")
serializer = XmlSerializer(config=config)
@@ -411,7 +421,7 @@ class TestEdgeCases:
assert response is not None
assert xml_output is not None
def test_reservation_with_all_utm_parameters(self):
def test_reservation_with_all_utm_parameters(self, test_config):
"""Test reservation with all UTM tracking parameters."""
customer = Customer(
id=97,
@@ -444,7 +454,7 @@ class TestEdgeCases:
)
reservation_pairs = [(reservation_db, customer)]
response = create_res_retrieve_response(reservation_pairs)
response = create_res_retrieve_response(reservation_pairs, config=test_config)
config = SerializerConfig(pretty_print=True)
serializer = XmlSerializer(config=config)