mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
chore: catch all "tile*" URL in playwright
This commit is contained in:
parent
97ff26b6e8
commit
4070da392a
3 changed files with 4 additions and 4 deletions
|
@ -42,7 +42,7 @@ class LicenceFactory(factory.django.DjangoModelFactory):
|
||||||
|
|
||||||
class TileLayerFactory(factory.django.DjangoModelFactory):
|
class TileLayerFactory(factory.django.DjangoModelFactory):
|
||||||
name = "Test zoom layer"
|
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"
|
attribution = "Test layer attribution"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -156,5 +156,6 @@ def login_required(response):
|
||||||
|
|
||||||
|
|
||||||
def mock_tiles(route):
|
def mock_tiles(route):
|
||||||
|
print("Intercepted route", route.request.url)
|
||||||
path = Path(__file__).parent / "fixtures/empty_tile.png"
|
path = Path(__file__).parent / "fixtures/empty_tile.png"
|
||||||
route.fulfill(path=path)
|
route.fulfill(path=path)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -25,7 +26,7 @@ def set_timeout(context):
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def mock_osm_tiles(page):
|
def mock_osm_tiles(page):
|
||||||
if not bool(os.environ.get("PWDEBUG", False)):
|
if not bool(os.environ.get("PWDEBUG", False)):
|
||||||
page.route("*/**/osmfr/**", mock_tiles)
|
page.route(re.compile(r".*tile\..*"), mock_tiles)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -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):
|
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
|
settings.UMAP_ALLOW_ANONYMOUS = True
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
page.goto(f"{live_server.url}/map/new/")
|
||||||
page.get_by_role("button", name="Open browser").click()
|
page.get_by_role("button", name="Open browser").click()
|
||||||
|
|
Loading…
Reference in a new issue