Skip to content

Commit

Permalink
Merge pull request #4172 from GeotrekCE/bump_mapentity_8.9.0
Browse files Browse the repository at this point in the history
Bump to django-mapentity 8.9.0
  • Loading branch information
submarcos authored Jun 4, 2024
2 parents e7c890c + 21991bf commit 8acc504
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 34 deletions.
14 changes: 14 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ CHANGELOG
2.106.0+dev (XXXX-XX-XX)
------------------------

**Breaking changes**

- This version use django 4.2, the latest LTS version. You need to upgrade your database to PostgreSQL 12 or higher before upgrading to this version.

https://geotrek.readthedocs.io/en/latest/install/upgrade.html#postgresql

**Improvements**

- ApidaeTrekParser now imports field `membreProprietaire` as the structure
Expand All @@ -19,8 +25,16 @@ CHANGELOG
- Add details about dynamic segmentation for POIs

**Bug fixes**

- Fix view `v_treks` (fixes #4099)
- Prevent trek map screenshot error if type of associated information desk have not pictogram
- Fix map screenshot and default log in ODT files (with mapentity update)
- Fix DOC and PDF converted downloaded file names (with mapentity update)

**Maintenance**

- Bump to django 4.2
- Bump mapentity to 8.9.0


2.106.0 (2024-05-15)
Expand Down
66 changes: 33 additions & 33 deletions geotrek/common/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,39 +299,39 @@ def test_custom_columns_mixin_on_export(self):


class CommonLiveTest(TranslationResetMixin, MapEntityLiveTest):
# @mock.patch('mapentity.helpers.requests')
# def test_map_image_other_language(self, mock_requests):
# if self.model is None:
# return # Abstract test should not run
#
# user = SuperUserFactory.create()
# self.client.force_login(user=user)
#
# obj = self.modelfactory.create(geom='POINT(0 0)')
#
# # Initially, map image does not exists
# image_path = obj.get_map_image_path()
# if default_storage.exists(image_path):
# default_storage.delete(image_path)
# self.assertFalse(default_storage.exists(image_path))
#
# # Mock Screenshot response
# mock_requests.get.return_value.status_code = 200
# mock_requests.get.return_value.content = b'*' * 100
#
# response = self.client.get(obj.map_image_url)
# self.assertEqual(response.status_code, 200)
# self.assertTrue(default_storage.exists(image_path))
#
# mapimage_url = '%s%s?context&lang=fr' % (self.live_server_url, obj.get_detail_url())
# screenshot_url = 'http://0.0.0.0:8001/?url=%s' % mapimage_url
# url_called = mock_requests.get.call_args_list[0]
# self.assertTrue(url_called.startswith(screenshot_url))
#
# mapimage_url = '%s%s?context&lang=en' % (self.live_server_url, obj.get_detail_url())
# screenshot_url = 'http://0.0.0.0:8001/?url=%s' % mapimage_url
# url_called = mock_requests.get.call_args_list[0]
# self.assertTrue(url_called.startswith(screenshot_url))
@mock.patch('mapentity.helpers.requests')
def test_map_image_other_language(self, mock_requests):
if self.model is None:
return # Abstract test should not run

user = SuperUserFactory.create()
self.client.force_login(user=user)

obj = self.modelfactory.create(geom='POINT(0 0)')

# Initially, map image does not exists
image_path = obj.get_map_image_path()
if default_storage.exists(image_path):
default_storage.delete(image_path)
self.assertFalse(default_storage.exists(image_path))

# Mock Screenshot response
mock_requests.get.return_value.status_code = 200
mock_requests.get.return_value.content = b'*' * 100

response = self.client.get(obj.map_image_url)
self.assertEqual(response.status_code, 200)
self.assertTrue(default_storage.exists(image_path))

mapimage_url = '%s%s?context&lang=fr' % (self.live_server_url, obj.get_detail_url())
screenshot_url = 'http://0.0.0.0:8001/?url=%s' % mapimage_url
url_called = mock_requests.get.call_args_list[0]
self.assertTrue(url_called.startswith(screenshot_url))

mapimage_url = '%s%s?context&lang=en' % (self.live_server_url, obj.get_detail_url())
screenshot_url = 'http://0.0.0.0:8001/?url=%s' % mapimage_url
url_called = mock_requests.get.call_args_list[0]
self.assertTrue(url_called.startswith(screenshot_url))

@mock.patch('mapentity.helpers.requests')
def test_map_image_not_published_superuser(self, mock_requests):
Expand Down
Binary file modified geotrek/core/templates/core/path_detail.odt
Binary file not shown.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ lxml==4.9.3
# via
# mapentity
# svglib
mapentity==8.8.2
mapentity==8.9.0
# via geotrek (setup.py)
markdown==3.4.4
# via geotrek (setup.py)
Expand Down

0 comments on commit 8acc504

Please sign in to comment.