From 9989a8d54dd6f5082abf0b8d22ab0f7d4fdfe391 Mon Sep 17 00:00:00 2001 From: astridx Date: Tue, 12 Sep 2023 19:19:10 +0200 Subject: [PATCH 1/2] https://github.com/openstreetmap/operations/issues/737 --- docs/en/_sources/installation.rst.txt | 2 +- docs/en/installation.html | 2 +- docs/fr/_sources/installation.rst.txt | 2 +- docs/fr/installation.html | 2 +- docsrc/gettext/docs.pot | 2 +- docsrc/locales/en/LC_MESSAGES/docs.po | 2 +- docsrc/locales/fr/LC_MESSAGES/docs.po | 2 +- docsrc/source/installation.rst | 2 +- fittrackee/config.py | 2 +- fittrackee/tests/workouts/test_utils/test_maps.py | 6 +++--- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/en/_sources/installation.rst.txt b/docs/en/_sources/installation.rst.txt index 8fdefd66..b919e95b 100644 --- a/docs/en/_sources/installation.rst.txt +++ b/docs/en/_sources/installation.rst.txt @@ -190,7 +190,7 @@ deployment method. | Tile server URL (with api key if needed), see `Map tile server `__. | Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP `__) - :default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` + :default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png`` .. envvar:: STATICMAP_SUBDOMAINS diff --git a/docs/en/installation.html b/docs/en/installation.html index 1568beff..3ad09c4f 100644 --- a/docs/en/installation.html +++ b/docs/en/installation.html @@ -523,7 +523,7 @@ see
Default:
-

https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

+

https://tile.openstreetmap.org/{z}/{x}/{y}.png

diff --git a/docs/fr/_sources/installation.rst.txt b/docs/fr/_sources/installation.rst.txt index 8fdefd66..b919e95b 100644 --- a/docs/fr/_sources/installation.rst.txt +++ b/docs/fr/_sources/installation.rst.txt @@ -190,7 +190,7 @@ deployment method. | Tile server URL (with api key if needed), see `Map tile server `__. | Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP `__) - :default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` + :default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png`` .. envvar:: STATICMAP_SUBDOMAINS diff --git a/docs/fr/installation.html b/docs/fr/installation.html index 29093f7f..60609fe6 100644 --- a/docs/fr/installation.html +++ b/docs/fr/installation.html @@ -516,7 +516,7 @@
défaut:
-

https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

+

https://tile.openstreetmap.org/{z}/{x}/{y}.png

diff --git a/docsrc/gettext/docs.pot b/docsrc/gettext/docs.pot index 41fb7f26..bf72daaf 100644 --- a/docsrc/gettext/docs.pot +++ b/docsrc/gettext/docs.pot @@ -4413,7 +4413,7 @@ msgid "Since **0.4.9**, it's also used to generate static maps (to keep default msgstr "" #: ../source/installation.rst:193 -msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``" +msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``" msgstr "" #: ../source/installation.rst:200 diff --git a/docsrc/locales/en/LC_MESSAGES/docs.po b/docsrc/locales/en/LC_MESSAGES/docs.po index d87b6da8..2d9b9035 100644 --- a/docsrc/locales/en/LC_MESSAGES/docs.po +++ b/docsrc/locales/en/LC_MESSAGES/docs.po @@ -4582,7 +4582,7 @@ msgid "" msgstr "" #: ../source/installation.rst:193 -msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``" +msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``" msgstr "" #: ../source/installation.rst:200 diff --git a/docsrc/locales/fr/LC_MESSAGES/docs.po b/docsrc/locales/fr/LC_MESSAGES/docs.po index 203b75b9..a55fd3f7 100644 --- a/docsrc/locales/fr/LC_MESSAGES/docs.po +++ b/docsrc/locales/fr/LC_MESSAGES/docs.po @@ -5017,7 +5017,7 @@ msgstr "" "`DEFAULT_STATICMAP `__)" #: ../source/installation.rst:193 -msgid "``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``" +msgid "``https://tile.openstreetmap.org/{z}/{x}/{y}.png``" msgstr "" #: ../source/installation.rst:200 diff --git a/docsrc/source/installation.rst b/docsrc/source/installation.rst index 8fdefd66..b919e95b 100644 --- a/docsrc/source/installation.rst +++ b/docsrc/source/installation.rst @@ -190,7 +190,7 @@ deployment method. | Tile server URL (with api key if needed), see `Map tile server `__. | Since **0.4.9**, it's also used to generate static maps (to keep default server, see `DEFAULT_STATICMAP `__) - :default: ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`` + :default: ``https://tile.openstreetmap.org/{z}/{x}/{y}.png`` .. envvar:: STATICMAP_SUBDOMAINS diff --git a/fittrackee/config.py b/fittrackee/config.py index 8520bc49..1f70d123 100644 --- a/fittrackee/config.py +++ b/fittrackee/config.py @@ -41,7 +41,7 @@ class BaseConfig: TILE_SERVER = { 'URL': os.environ.get( 'TILE_SERVER_URL', - 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', ), 'ATTRIBUTION': os.environ.get( 'MAP_ATTRIBUTION', diff --git a/fittrackee/tests/workouts/test_utils/test_maps.py b/fittrackee/tests/workouts/test_utils/test_maps.py index 672bd0d2..7dc952f0 100644 --- a/fittrackee/tests/workouts/test_utils/test_maps.py +++ b/fittrackee/tests/workouts/test_utils/test_maps.py @@ -12,12 +12,12 @@ class TestGetStaticMapTileServerUrl: 'expected_tile_server_url', [ ( - 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', '', 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', ), ( - 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'a', 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', ), @@ -52,7 +52,7 @@ class TestGetStaticMapTileServerUrl: def test_it_returns_tile_server_url_with_random_subdomain(self) -> None: """in case multiple subdomains are provided""" tile_config = { - 'URL': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + 'URL': 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'STATICMAP_SUBDOMAINS': 'a,b,c', } From abedd03d051cd31201bac2ab46b925ed8684e360 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 14 Sep 2023 09:19:49 +0200 Subject: [PATCH 2/2] API - fix tests --- .../tests/workouts/test_utils/test_maps.py | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/fittrackee/tests/workouts/test_utils/test_maps.py b/fittrackee/tests/workouts/test_utils/test_maps.py index 7dc952f0..6b696f1d 100644 --- a/fittrackee/tests/workouts/test_utils/test_maps.py +++ b/fittrackee/tests/workouts/test_utils/test_maps.py @@ -11,16 +11,7 @@ class TestGetStaticMapTileServerUrl: 'input_tile_server_subdomains,' 'expected_tile_server_url', [ - ( - 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - '', - 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - ), - ( - 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - 'a', - 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', - ), + # tile server without subdomain ( 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', '', @@ -31,6 +22,21 @@ class TestGetStaticMapTileServerUrl: 'a', 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', ), + # tile server with subdomain + ( + 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/' + '{z}/{x}/{y}.png', + 'a', + 'https://a.tile-cyclosm.openstreetmap.fr/cyclosm/' + '{z}/{x}/{y}.png', + ), + ( + 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/' + '{z}/{x}/{y}.png', + '', + 'https://tile-cyclosm.openstreetmap.fr/cyclosm/' + '{z}/{x}/{y}.png', + ), ], ) def test_it_returns_tile_server_url( @@ -52,12 +58,15 @@ class TestGetStaticMapTileServerUrl: def test_it_returns_tile_server_url_with_random_subdomain(self) -> None: """in case multiple subdomains are provided""" tile_config = { - 'URL': 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + 'URL': ( + 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/' + '{z}/{x}/{y}.png' + ), 'STATICMAP_SUBDOMAINS': 'a,b,c', } with patch('random.choice', return_value='b'): - assert ( - get_static_map_tile_server_url(tile_config) - == 'https://b.tile.openstreetmap.org/{z}/{x}/{y}.png' + assert get_static_map_tile_server_url(tile_config) == ( + 'https://b.tile-cyclosm.openstreetmap.fr/cyclosm/' + '{z}/{x}/{y}.png' )