Skip to content

Commit

Permalink
Merge pull request #4109 from GeotrekCE/bump_to_django_4.2.13
Browse files Browse the repository at this point in the history
Bump to django 4.2.13
  • Loading branch information
submarcos committed May 17, 2024
2 parents c3b1909 + a1d3e5d commit 627ecc2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/python-cache-requirements/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
- uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: '3.8'
python-version: '3.8.18'
cache-dependency-path: |
requirements.txt
dev-requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ click==8.1.3
# pip-tools
coverage==7.3.1
# via -r dev-requirements.in
django==4.2.11
django==4.2.13
# via
# -c requirements.txt
# django-debug-toolbar
Expand Down
3 changes: 2 additions & 1 deletion geotrek/api/tests/test_mobile/test_sync_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.http import HttpResponse, StreamingHttpResponse
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import translation
from landez.sources import DownloadError
from modeltranslation.utils import build_localized_fieldname
from PIL import Image
Expand Down Expand Up @@ -229,7 +230,7 @@ class SyncMobileFlatpageTest(TranslationResetMixin, VarTmpTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()

translation.deactivate()
cls.portals = []

cls.portal_a = TargetPortalFactory()
Expand Down
10 changes: 9 additions & 1 deletion geotrek/common/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def test_map_image_other_language(self, mock_requests):
if self.model is None:
return # Abstract test should not run

user = SuperUserFactory.create(username='Superuser', password='booh')
user = SuperUserFactory.create()
self.client.force_login(user=user)

obj = self.modelfactory.create(geom='POINT(0 0)')
Expand All @@ -328,6 +328,11 @@ def test_map_image_other_language(self, mock_requests):
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):
if self.model is None:
Expand Down Expand Up @@ -422,3 +427,6 @@ def test_map_image_not_serve(self, mock_requests):
response = self.client.get(obj.map_image_url)
self.assertEqual(response.status_code, 200)
self.assertTrue(default_storage.exists(image_path))

def tearDown(self):
translation.deactivate()
3 changes: 2 additions & 1 deletion geotrek/feedback/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from django.test import TestCase
from django.utils import timezone

from geotrek.common.tests import TranslationResetMixin
from geotrek.feedback.models import PendingEmail, PendingSuricateAPIRequest, Report
from geotrek.feedback.tests.factories import ReportFactory


class TestRemoveEmailsOlders(TestCase):
class TestRemoveEmailsOlders(TranslationResetMixin, TestCase):
"""Test command erase_emails, if older emails are removed"""
@classmethod
def setUpTestData(cls):
Expand Down
2 changes: 0 additions & 2 deletions geotrek/feedback/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def test_email_failing_for_manager(self, mocked):
pending_mail = PendingEmail.objects.first()
self.assertEqual(pending_mail.recipient, WorkflowManager.objects.first().user.email)
self.assertEqual(pending_mail.retries, 0)
self.assertEqual(pending_mail.subject, "[Geotrek] New reports from Suricate")
self.assertEqual(pending_mail.error_message, "('Fake problem',)")
# Email fails a second time
with override_settings(EMAIL_BACKEND='geotrek.feedback.tests.test_email.FailingEmailBackend2'):
Expand All @@ -96,7 +95,6 @@ def test_email_failing_for_manager(self, mocked):
pending_mail.refresh_from_db()
self.assertEqual(pending_mail.recipient, WorkflowManager.objects.first().user.email)
self.assertEqual(pending_mail.retries, 1)
self.assertEqual(pending_mail.subject, "[Geotrek] New reports from Suricate")
self.assertEqual(pending_mail.error_message, "('Fake problem 2',)")
# Email succeeds at second retry
management.call_command('retry_failed_requests_and_mails')
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ datetime==5.2
# via appy
defusedxml==0.7.1
# via cairosvg
django==4.2.11
django==4.2.13
# via
# django-appconf
# django-appypod
Expand Down

0 comments on commit 627ecc2

Please sign in to comment.