From 4070da392ac84368c35e994f62baedfe3e2a0624 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sat, 7 Dec 2024 13:01:41 +0100 Subject: [PATCH] chore: catch all "tile*" URL in playwright --- umap/tests/base.py | 3 ++- umap/tests/integration/conftest.py | 3 ++- umap/tests/integration/test_import.py | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/umap/tests/base.py b/umap/tests/base.py index 7833d00a..81aaac3c 100644 --- a/umap/tests/base.py +++ b/umap/tests/base.py @@ -42,7 +42,7 @@ class LicenceFactory(factory.django.DjangoModelFactory): class TileLayerFactory(factory.django.DjangoModelFactory): name = "Test zoom layer" - url_template = "https://{s}.test.org/osmfr/{z}/{x}/{y}.png" + url_template = "https://tile.openstreetmap.org/{z}/{x}/{y}.png" attribution = "Test layer attribution" class Meta: @@ -156,5 +156,6 @@ def login_required(response): def mock_tiles(route): + print("Intercepted route", route.request.url) path = Path(__file__).parent / "fixtures/empty_tile.png" route.fulfill(path=path) diff --git a/umap/tests/integration/conftest.py b/umap/tests/integration/conftest.py index 9bf1aad9..733cec4d 100644 --- a/umap/tests/integration/conftest.py +++ b/umap/tests/integration/conftest.py @@ -1,4 +1,5 @@ import os +import re import subprocess import time from pathlib import Path @@ -25,7 +26,7 @@ def set_timeout(context): @pytest.fixture(autouse=True) def mock_osm_tiles(page): if not bool(os.environ.get("PWDEBUG", False)): - page.route("*/**/osmfr/**", mock_tiles) + page.route(re.compile(r".*tile\..*"), mock_tiles) @pytest.fixture diff --git a/umap/tests/integration/test_import.py b/umap/tests/integration/test_import.py index 11413eaa..757a766f 100644 --- a/umap/tests/integration/test_import.py +++ b/umap/tests/integration/test_import.py @@ -72,8 +72,6 @@ def test_umap_import_from_file(live_server, tilelayer, page): def test_umap_import_from_textarea(live_server, tilelayer, page, settings): - page.route("https://tile.openstreetmap.fr/hot/**", mock_tiles) - settings.UMAP_ALLOW_ANONYMOUS = True page.goto(f"{live_server.url}/map/new/") page.get_by_role("button", name="Open browser").click()