From 6ea7aa2aae1076de8d396f1e9c6fba8b323a8b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Prat?= Date: Thu, 28 Mar 2024 12:06:48 +0100 Subject: [PATCH 1/4] Fix route v8 multiple via points --- herepy/routing_api.py | 2 +- tests/test_routing_api.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/herepy/routing_api.py b/herepy/routing_api.py index 3917dd1..2ac56a2 100644 --- a/herepy/routing_api.py +++ b/herepy/routing_api.py @@ -448,7 +448,7 @@ def route_v8( via_keys = [] if via: for i, v in enumerate(via): - key = str.format("{0}{1}", "via", i) + key = str.format("{0}{1}_", "via", i) via_keys.append(key) data[key] = str.format("{0},{1}", v[0], v[1]) if departure_time: diff --git a/tests/test_routing_api.py b/tests/test_routing_api.py index 2f8de90..cf55167 100644 --- a/tests/test_routing_api.py +++ b/tests/test_routing_api.py @@ -1179,3 +1179,29 @@ def test_route_v8_error_access_denied(self): truck={"shippedHazardousGoods": ["explosive", "gas"]}, scooter={"allowHighway": "true"}, ) + + @responses.activate + def test_route_v8_multiple_via_points(self): + with codecs.open( + "testdata/models/routing_v8_response.json", mode="r", encoding="utf-8" + ) as f: + expectedResponse = f.read() + responses.add( + responses.GET, + "https://router.hereapi.com/v8/routes", + expectedResponse, + status=200, + match=[ + responses.matchers.query_param_matcher( + {"via": ["41.9339,-87.9021"] * 11}, strict_match=False + ) + ], + ) + response = self._api.route_v8( + transport_mode=herepy.RoutingTransportMode.car, + origin=[41.9798, -87.8801], + destination=[41.9043, -87.9216], + via=[[41.9339, -87.9021]] * 11, + ) + self.assertTrue(response) + self.assertIsInstance(response, herepy.RoutingResponseV8) From 271d1606edce87f6e624352cc2fac05f7ab91b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Prat?= Date: Thu, 28 Mar 2024 12:22:02 +0100 Subject: [PATCH 2/4] Clean test --- tests/test_routing_api.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/test_routing_api.py b/tests/test_routing_api.py index cf55167..00050ca 100644 --- a/tests/test_routing_api.py +++ b/tests/test_routing_api.py @@ -1182,14 +1182,10 @@ def test_route_v8_error_access_denied(self): @responses.activate def test_route_v8_multiple_via_points(self): - with codecs.open( - "testdata/models/routing_v8_response.json", mode="r", encoding="utf-8" - ) as f: - expectedResponse = f.read() responses.add( responses.GET, "https://router.hereapi.com/v8/routes", - expectedResponse, + "{}", status=200, match=[ responses.matchers.query_param_matcher( From fb3dc558eab51108b965ee0404da55453f691ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Prat?= Date: Fri, 29 Mar 2024 14:09:40 +0100 Subject: [PATCH 3/4] Bumping codecov version --- requirements.testing.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.testing.txt b/requirements.testing.txt index edf7eb8..2a3b528 100644 --- a/requirements.testing.txt +++ b/requirements.testing.txt @@ -1,7 +1,7 @@ pytest>=5.4.3,<6.2.5 pytest-cov>=2.10.0,<3.0.0 pytest-runner>=5.2,<5.3.1 -codecov>=2.1.7,<2.1.12 +codecov==2.1.13 responses>=0.10.15,<0.14.0 six>=1.15.0,<1.16.0 tox>=3.15.2,<3.24.4 From 9a753315f2e1df9d9e1d04741679fb1f0edeaf43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Prat?= Date: Fri, 29 Mar 2024 17:00:30 +0100 Subject: [PATCH 4/4] Bump responses version --- requirements.testing.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.testing.txt b/requirements.testing.txt index 2a3b528..8f0f821 100644 --- a/requirements.testing.txt +++ b/requirements.testing.txt @@ -2,7 +2,7 @@ pytest>=5.4.3,<6.2.5 pytest-cov>=2.10.0,<3.0.0 pytest-runner>=5.2,<5.3.1 codecov==2.1.13 -responses>=0.10.15,<0.14.0 +responses==0.25.0 six>=1.15.0,<1.16.0 tox>=3.15.2,<3.24.4 tox-pyenv==1.1.0