mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
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:
commit
2b3f0b00fb
5 changed files with 43 additions and 49 deletions
2
.github/workflows/test-docs.yml
vendored
2
.github/workflows/test-docs.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgis/postgis:13-3.4
|
||||
image: postgis/postgis:14-3.4
|
||||
ports:
|
||||
- 5432:5432
|
||||
env:
|
||||
|
|
|
@ -28,7 +28,7 @@ classifiers = [
|
|||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = [
|
||||
"Django==5.0.8",
|
||||
"Django==5.1",
|
||||
"django-agnocomplete==2.2.0",
|
||||
"django-environ==0.11.2",
|
||||
"django-probes==1.7.0",
|
||||
|
|
|
@ -8,6 +8,7 @@ from rjsmin import jsmin
|
|||
|
||||
class UmapManifestStaticFilesStorage(ManifestStaticFilesStorage):
|
||||
support_js_module_import_aggregation = True
|
||||
max_post_process_passes = 15
|
||||
|
||||
# We remove `;` at the end of all regexps to match our biome config.
|
||||
_js_module_import_aggregation_patterns = (
|
||||
|
|
|
@ -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)
|
40
umap/tests/test_statics.py
Normal file
40
umap/tests/test_statics.py
Normal 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
|
||||
)
|
Loading…
Reference in a new issue