mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
chore: fix failing test (#2317)
This commit is contained in:
commit
401efc037d
4 changed files with 13 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
import copy
|
||||
import json
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
import factory
|
||||
from django.contrib.auth import get_user_model
|
||||
|
@ -41,7 +42,7 @@ class LicenceFactory(factory.django.DjangoModelFactory):
|
|||
|
||||
class TileLayerFactory(factory.django.DjangoModelFactory):
|
||||
name = "Test zoom layer"
|
||||
url_template = "http://{s}.test.org/{z}/{x}/{y}.png"
|
||||
url_template = "https://{s}.test.org/osmfr/{z}/{x}/{y}.png"
|
||||
attribution = "Test layer attribution"
|
||||
|
||||
class Meta:
|
||||
|
@ -152,3 +153,8 @@ def login_required(response):
|
|||
redirect_url = reverse("login")
|
||||
assert j["login_required"] == redirect_url
|
||||
return True
|
||||
|
||||
|
||||
def mock_tiles(route):
|
||||
path = Path(__file__).parent / "fixtures/empty_tile.png"
|
||||
route.fulfill(path=path)
|
||||
|
|
BIN
umap/tests/fixtures/empty_tile.png
vendored
Normal file
BIN
umap/tests/fixtures/empty_tile.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 B |
|
@ -6,6 +6,8 @@ from pathlib import Path
|
|||
import pytest
|
||||
from playwright.sync_api import expect
|
||||
|
||||
from ..base import mock_tiles
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def browser_context_args(browser_context_args):
|
||||
|
@ -23,7 +25,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/**", lambda route: route.fulfill())
|
||||
page.route("*/**/osmfr/**", mock_tiles)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import json
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
@ -10,6 +9,7 @@ from playwright.sync_api import expect
|
|||
|
||||
from umap.models import DataLayer
|
||||
|
||||
from ..base import mock_tiles
|
||||
from .helpers import save_and_get_json
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
@ -72,6 +72,8 @@ 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()
|
||||
|
|
Loading…
Reference in a new issue