|
32 | 32 | from jormungandr.scenarios.utils import (
|
33 | 33 | fill_disruptions_on_pois,
|
34 | 34 | fill_disruptions_on_places_nearby,
|
35 |
| - update_odt_information_deeplink_in_section, |
| 35 | + update_booking_rule_url_in_section, |
36 | 36 | )
|
37 | 37 |
|
38 | 38 | import pytest
|
@@ -101,59 +101,59 @@ def update_disruptions_on_pois_for_places_nearby_test(mocker):
|
101 | 101 | return
|
102 | 102 |
|
103 | 103 |
|
104 |
| -def journey_with_deeplink_in_odt_information_test(): |
| 104 | +def journey_with_booking_url_in_booking_rule_test(): |
105 | 105 | instance = lambda: None
|
106 |
| - # Get a response with a section of ODT having odt_information. |
107 |
| - deeplink = ( |
| 106 | + # Get a response with a section of ODT having booking_rule. |
| 107 | + booking_url = ( |
108 | 108 | "https://domaine/search?departure-address={from_name}&destination-address={to_name}"
|
109 | 109 | "&requested-departure-time={departure_datetime}&from_coord_lat={from_coord_lat}"
|
110 | 110 | "&from_coord_lon={from_coord_lon}&to_coord_lat={to_coord_lat}&to_coord_lon={to_coord_lon}"
|
111 | 111 | )
|
112 |
| - response_journey_with_odt = helpers_tests.get_odt_journey(deeplink=deeplink) |
| 112 | + response_journey_with_odt = helpers_tests.get_odt_journey(booking_url=booking_url) |
113 | 113 | assert len(response_journey_with_odt.journeys) == 1
|
114 | 114 | journey = response_journey_with_odt.journeys[0]
|
115 | 115 | assert len(journey.sections) == 3
|
116 | 116 | odt_section = journey.sections[1]
|
117 | 117 | assert odt_section.type == response_pb2.ON_DEMAND_TRANSPORT
|
118 |
| - odt_information = odt_section.odt_information |
119 |
| - assert odt_information.name == "odt_name_value" |
| 118 | + booking_rule = odt_section.booking_rule |
| 119 | + assert booking_rule.name == "odt_name_value" |
120 | 120 | assert (
|
121 |
| - odt_information.deeplink |
| 121 | + booking_rule.booking_url |
122 | 122 | == "https://domaine/search?departure-address={from_name}&destination-address={to_name}&requested-departure-time={departure_datetime}&from_coord_lat={from_coord_lat}&from_coord_lon={from_coord_lon}&to_coord_lat={to_coord_lat}&to_coord_lon={to_coord_lon}"
|
123 | 123 | )
|
124 |
| - assert odt_information.url == "odt_url_value" |
125 |
| - assert odt_information.condition == "odt_conditions_value" |
126 |
| - assert odt_information.phone == "odt_phone_value" |
127 |
| - update_odt_information_deeplink_in_section(odt_section) |
| 124 | + assert booking_rule.info_url == "odt_url_value" |
| 125 | + assert booking_rule.message == "odt_conditions_value" |
| 126 | + assert booking_rule.phone_number == "odt_phone_value" |
| 127 | + update_booking_rule_url_in_section(odt_section) |
128 | 128 | assert (
|
129 |
| - odt_information.deeplink |
| 129 | + booking_rule.booking_url |
130 | 130 | == "https://domaine/search?departure-address=stop%20a%20name&destination-address=stop_b_name&requested-departure-time=1722924300&from_coord_lat=2.0&from_coord_lon=1.0&to_coord_lat=4.0&to_coord_lon=3.0"
|
131 | 131 | )
|
132 | 132 |
|
133 |
| - # Use a deeplink with fewer placeholders |
134 |
| - deeplink = ( |
| 133 | + # Use a booking_url with fewer placeholders |
| 134 | + booking_url = ( |
135 | 135 | "https://domaine/search?departure-address={from_name}&destination-address={to_name}"
|
136 | 136 | "&requested-departure-time={departure_datetime}&from_coord_lat={from_coord_lat}&from_coord_lon={from_coord_lon}"
|
137 | 137 | )
|
138 |
| - response_journey_with_odt = helpers_tests.get_odt_journey(deeplink=deeplink) |
| 138 | + response_journey_with_odt = helpers_tests.get_odt_journey(booking_url=booking_url) |
139 | 139 | odt_section = response_journey_with_odt.journeys[0].sections[1]
|
140 |
| - update_odt_information_deeplink_in_section(odt_section) |
| 140 | + update_booking_rule_url_in_section(odt_section) |
141 | 141 | assert (
|
142 |
| - odt_section.odt_information.deeplink |
| 142 | + odt_section.booking_rule.booking_url |
143 | 143 | == "https://domaine/search?departure-address=stop%20a%20name&destination-address=stop_b_name&requested-departure-time=1722924300&from_coord_lat=2.0&from_coord_lon=1.0"
|
144 | 144 | )
|
145 | 145 |
|
146 |
| - # Add a placeholder which is not predefined in the function to update deeplink |
| 146 | + # Add a placeholder which is not predefined in the function to update url |
147 | 147 | # This placeholder will not be replaced(updated)
|
148 |
| - deeplink = ( |
| 148 | + booking_url = ( |
149 | 149 | "https://domaine/search?departure-address={from_name}&destination-address={to_name}"
|
150 | 150 | "&requested-departure-time={departure_datetime}&from_coord_lat={from_coord_lat}"
|
151 | 151 | "&from_coord_lon={from_coord_lon}&toto={toto}"
|
152 | 152 | )
|
153 |
| - response_journey_with_odt = helpers_tests.get_odt_journey(deeplink=deeplink) |
| 153 | + response_journey_with_odt = helpers_tests.get_odt_journey(booking_url=booking_url) |
154 | 154 | odt_section = response_journey_with_odt.journeys[0].sections[1]
|
155 |
| - update_odt_information_deeplink_in_section(odt_section) |
| 155 | + update_booking_rule_url_in_section(odt_section) |
156 | 156 | assert (
|
157 |
| - odt_section.odt_information.deeplink |
| 157 | + odt_section.booking_rule.booking_url |
158 | 158 | == "https://domaine/search?departure-address=stop%20a%20name&destination-address=stop_b_name&requested-departure-time=1722924300&from_coord_lat=2.0&from_coord_lon=1.0&toto=N/A"
|
159 | 159 | )
|
0 commit comments