Merge pull request #2055 from umap-project/dependabot/pip/django-5.1

chore: bump django from 5.0.8 to 5.1
This commit is contained in:
Yohan Boniface 2024-08-30 20:28:28 +02:00 committed by GitHub
commit 2b3f0b00fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 49 deletions

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
postgres: postgres:
image: postgis/postgis:13-3.4 image: postgis/postgis:14-3.4
ports: ports:
- 5432:5432 - 5432:5432
env: env:

View file

@ -28,7 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
] ]
dependencies = [ dependencies = [
"Django==5.0.8", "Django==5.1",
"django-agnocomplete==2.2.0", "django-agnocomplete==2.2.0",
"django-environ==0.11.2", "django-environ==0.11.2",
"django-probes==1.7.0", "django-probes==1.7.0",

View file

@ -8,6 +8,7 @@ from rjsmin import jsmin
class UmapManifestStaticFilesStorage(ManifestStaticFilesStorage): class UmapManifestStaticFilesStorage(ManifestStaticFilesStorage):
support_js_module_import_aggregation = True support_js_module_import_aggregation = True
max_post_process_passes = 15
# We remove `;` at the end of all regexps to match our biome config. # We remove `;` at the end of all regexps to match our biome config.
_js_module_import_aggregation_patterns = ( _js_module_import_aggregation_patterns = (

View file

@ -1,47 +0,0 @@
import re
import shutil
import tempfile
from copy import deepcopy
import pytest
from django.core.management import call_command
from django.utils.translation import override
from playwright.sync_api import expect
@pytest.fixture
def staticfiles(settings):
static_root = tempfile.mkdtemp(prefix="test_static")
settings.STATIC_ROOT = static_root
# Make sure settings are properly reset after the test
settings.STORAGES = deepcopy(settings.STORAGES)
settings.STORAGES["staticfiles"]["BACKEND"] = (
"umap.storage.UmapManifestStaticFilesStorage"
)
try:
call_command("collectstatic", "--noinput")
yield
finally:
shutil.rmtree(static_root)
def test_javascript_have_been_loaded(
map, live_server, datalayer, page, settings, staticfiles
):
datalayer.settings["displayOnLoad"] = False
datalayer.save()
map.settings["properties"]["defaultView"] = "latest"
map.save()
with override("fr"):
url = f"{live_server.url}{map.get_absolute_url()}"
assert "/fr/" in url
page.goto(url)
# Hash is defined, so map is initialized
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
expect(page).to_have_url(re.compile(r".*/fr/"))
# Should be in French, so hashed locale file has been loaded correctly
button = page.get_by_role("button", name="Explorateur")
expect(button).to_be_visible()
button.click()
layers = page.locator(".umap-browser .datalayer")
expect(layers).to_have_count(1)

View file

@ -0,0 +1,40 @@
import json
import shutil
import tempfile
from copy import deepcopy
from pathlib import Path
import pytest
from django.core.management import call_command
@pytest.fixture
def staticfiles(settings):
static_root = tempfile.mkdtemp(prefix="test_static")
settings.STATIC_ROOT = static_root
# Make sure settings are properly reset after the test
settings.STORAGES = deepcopy(settings.STORAGES)
settings.STORAGES["staticfiles"]["BACKEND"] = (
"umap.storage.UmapManifestStaticFilesStorage"
)
try:
call_command("collectstatic", "--noinput")
yield
finally:
shutil.rmtree(static_root)
def test_collectstatic_ran_successfully_with_hashes(settings, staticfiles):
static_root = settings.STATIC_ROOT
manifest = Path(static_root) / "staticfiles.json"
assert manifest.exists()
json_manifest = json.loads(manifest.read_text())
assert "hash" in json_manifest.keys()
assert "umap/base.css" in json_manifest["paths"]
# Hash + the dot ("umap/base.<hash>.css").
md5_hash_lenght = 12 + 1
# The value of the manifest must contain the hash (length).
assert (
len(json_manifest["paths"]["umap/base.css"])
== len("umap/base.css") + md5_hash_lenght
)