Skip to content

Commit 584e6a3

Browse files
authored
Merge pull request #4302 from hove-io/omit_s_in_odt_informations
Use new commit of navitia-proto
2 parents 0297709 + e7bbf87 commit 584e6a3

File tree

8 files changed

+22
-21
lines changed

8 files changed

+22
-21
lines changed

docker/debian8/Dockerfile-tyr-worker

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM navitia/master
22

33
# Install some binaries from tartare-tools
4-
ENV TARTARE_TOOLS_VERSION="v0.44.0"
4+
ENV TARTARE_TOOLS_VERSION="v0.45.0"
55
ARG GITHUB_TOKEN
66
RUN git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/hove-io/".insteadOf "ssh://[email protected]/hove-io/"
77
RUN git clone -b ${TARTARE_TOOLS_VERSION} --depth 1 https://x-access-token:${GITHUB_TOKEN}@github.com/hove-io/tartare-tools

source/jormungandr/jormungandr/interfaces/v1/serializer/journey.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class RidesharingInformationSerializer(PbNestedSerializer):
335335
class OdtInformationSerializer(PbNestedSerializer):
336336
name = jsonschema.Field(schema_type=str, display_none=True)
337337
url = jsonschema.Field(schema_type=str, display_none=True)
338-
conditions = jsonschema.Field(schema_type=str, display_none=True)
338+
condition = jsonschema.Field(schema_type=str, display_none=True)
339339
phone = jsonschema.Field(schema_type=str, display_none=True)
340340
deeplink = jsonschema.Field(schema_type=str, display_none=True)
341341
applies_on = EnumListField(attr='applies_on', pb_type=OdtInformation.AppliesOn)
@@ -431,7 +431,7 @@ def get_ridesharing_journeys(self, obj):
431431
street_informations = StreetInformationSerializer(
432432
attr="street_network.street_information", many=True, display_none=False
433433
)
434-
odt_informations = OdtInformationSerializer(display_none=False)
434+
odt_information = OdtInformationSerializer(display_none=False)
435435

436436

437437
class JourneySerializer(PbNestedSerializer):

source/jormungandr/jormungandr/interfaces/v1/test/serializer_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ def odt_information_serialization_test():
7171
journey = resp["journeys"][0]
7272
assert len(journey.get("sections", 0)) == 3
7373
section = journey["sections"][1]
74-
odt_information = section.get("odt_informations", None)
74+
odt_information = section.get("odt_information", None)
7575
assert odt_information is not None
7676
assert odt_information["url"] == "odt_url_value"
7777
assert odt_information["name"] == "odt_name_value"
7878
assert odt_information["phone"] == "odt_phone_value"
79-
assert odt_information["conditions"] == "odt_conditions_value"
79+
assert odt_information["condition"] == "odt_conditions_value"
8080
assert odt_information["deeplink"] == "https://toto.com?from=from_value&to=to_value"
8181
assert odt_information["applies_on"] == ["from"]

source/jormungandr/jormungandr/scenarios/tests/helpers_tests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def get_odt_journey(deeplink):
652652
section.origin.uri = 'stop_a'
653653
section.origin.embedded_type = type_pb2.STOP_POINT
654654
section.origin.stop_point.uri = 'stop_a'
655-
section.origin.stop_point.name = 'stop_a_name'
655+
section.origin.stop_point.name = 'stop a name'
656656
section.origin.stop_point.coord.lon = 1.0
657657
section.origin.stop_point.coord.lat = 2.0
658658
section.destination.uri = 'stop_b'
@@ -661,11 +661,11 @@ def get_odt_journey(deeplink):
661661
section.destination.stop_point.name = 'stop_b_name'
662662
section.destination.stop_point.coord.lon = 3.0
663663
section.destination.stop_point.coord.lat = 4.0
664-
odt_information = section.odt_informations
664+
odt_information = section.odt_information
665665
odt_information.name = "odt_name_value"
666666
odt_information.deeplink = deeplink
667667
odt_information.url = "odt_url_value"
668-
odt_information.conditions = "odt_conditions_value"
668+
odt_information.condition = "odt_conditions_value"
669669
odt_information.phone = "odt_phone_value"
670670
odt_information.applies_on.append(response_pb2.OdtInformation.AppliesOn.FROM)
671671
section = journey.sections.add()

source/jormungandr/jormungandr/scenarios/tests/new_default_tests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,13 @@ def journey_with_odt_information_test():
847847
odt_section = journey.sections[1]
848848
assert odt_section.type == response_pb2.ON_DEMAND_TRANSPORT
849849
assert (
850-
odt_section.odt_informations.deeplink
850+
odt_section.odt_information.deeplink
851851
== "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}&not_managed={not_managed}"
852852
)
853853

854854
update_odt_information_deeplink(response_journey_with_odt)
855855
odt_section = response_journey_with_odt.journeys[0].sections[1]
856856
assert (
857-
odt_section.odt_informations.deeplink
858-
== "https://domaine/search?departure-address=stop_a_name&destination-address=stop_b_name&requested-departure-time=1722924300&from_coord_lat=2.0&from_coord_lon=1.0&not_managed=N/A"
857+
odt_section.odt_information.deeplink
858+
== "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&not_managed=N/A"
859859
)

source/jormungandr/jormungandr/scenarios/tests/utils_tests.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,19 @@ def journey_with_deeplink_in_odt_information_test():
115115
assert len(journey.sections) == 3
116116
odt_section = journey.sections[1]
117117
assert odt_section.type == response_pb2.ON_DEMAND_TRANSPORT
118-
odt_information = odt_section.odt_informations
118+
odt_information = odt_section.odt_information
119119
assert odt_information.name == "odt_name_value"
120120
assert (
121121
odt_information.deeplink
122122
== "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}"
123123
)
124124
assert odt_information.url == "odt_url_value"
125-
assert odt_information.conditions == "odt_conditions_value"
125+
assert odt_information.condition == "odt_conditions_value"
126126
assert odt_information.phone == "odt_phone_value"
127127
update_odt_information_deeplink_in_section(odt_section)
128128
assert (
129129
odt_information.deeplink
130-
== "https://domaine/search?departure-address=stop_a_name&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"
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"
131131
)
132132

133133
# Use a deeplink with fewer placeholders
@@ -139,8 +139,8 @@ def journey_with_deeplink_in_odt_information_test():
139139
odt_section = response_journey_with_odt.journeys[0].sections[1]
140140
update_odt_information_deeplink_in_section(odt_section)
141141
assert (
142-
odt_section.odt_informations.deeplink
143-
== "https://domaine/search?departure-address=stop_a_name&destination-address=stop_b_name&requested-departure-time=1722924300&from_coord_lat=2.0&from_coord_lon=1.0"
142+
odt_section.odt_information.deeplink
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"
144144
)
145145

146146
# Add a placeholder which is not predefined in the function to update deeplink
@@ -154,6 +154,6 @@ def journey_with_deeplink_in_odt_information_test():
154154
odt_section = response_journey_with_odt.journeys[0].sections[1]
155155
update_odt_information_deeplink_in_section(odt_section)
156156
assert (
157-
odt_section.odt_informations.deeplink
158-
== "https://domaine/search?departure-address=stop_a_name&destination-address=stop_b_name&requested-departure-time=1722924300&from_coord_lat=2.0&from_coord_lon=1.0&toto=N/A"
157+
odt_section.odt_information.deeplink
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"
159159
)

source/jormungandr/jormungandr/scenarios/utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import navitiacommon.request_pb2 as request_pb2
3434
from future.moves.itertools import zip_longest
3535
from jormungandr.fallback_modes import FallbackModes
36+
import requests as requests
3637
import re
3738
from collections import defaultdict
3839
from string import Formatter
@@ -560,7 +561,7 @@ def update_odt_information_deeplink_in_section(section):
560561
if section.type != response_pb2.ON_DEMAND_TRANSPORT:
561562
return
562563

563-
deeplink = section.odt_informations.deeplink
564+
deeplink = section.odt_information.deeplink
564565
if not deeplink:
565566
return
566567

@@ -595,4 +596,4 @@ def update_odt_information_deeplink_in_section(section):
595596
elif p == "to_coord_lon":
596597
placeholder_dict[p] = to_coord_lon
597598

598-
section.odt_informations.deeplink = fmtr.vformat(deeplink, (), placeholder_dict)
599+
section.odt_information.deeplink = requests.utils.requote_uri(fmtr.vformat(deeplink, (), placeholder_dict))

source/navitia-proto

0 commit comments

Comments
 (0)