aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/views/tileproxy.py3
-rw-r--r--testing.ini3
-rw-r--r--tests/playwright/test_tileproxy.py11
3 files changed, 17 insertions, 0 deletions
diff --git a/fietsboek/views/tileproxy.py b/fietsboek/views/tileproxy.py
index d3216c4..07e4103 100644
--- a/fietsboek/views/tileproxy.py
+++ b/fietsboek/views/tileproxy.py
@@ -333,6 +333,9 @@ def tile_proxy(request):
raise HTTPGatewayTimeout(f"Avoiding request to {provider}")
url = tile_sources[provider].url.format(x=x, y=y, z=z, s=random.choice("abc"))
+ # Avoid doing actual requests during tests
+ if url.startswith("http://localhost:0/"):
+ return Response("", content_type="image/png")
headers = {
"user-agent": f"Fietsboek-Tile-Proxy/{__VERSION__}",
}
diff --git a/testing.ini b/testing.ini
index e68d0cc..6f85219 100644
--- a/testing.ini
+++ b/testing.ini
@@ -18,6 +18,9 @@ redis.url = redis://localhost
fietsboek.default_tile_layers =
enable_account_registration = true
+fietsboek.tile_layer.test = Testing Tile Layer
+fietsboek.tile_layer.test.url = http://localhost:0
+
email.from = Test <test@localhost>
email.smtp_url = debug://
diff --git a/tests/playwright/test_tileproxy.py b/tests/playwright/test_tileproxy.py
new file mode 100644
index 0000000..b948bab
--- /dev/null
+++ b/tests/playwright/test_tileproxy.py
@@ -0,0 +1,11 @@
+from playwright.sync_api import Page
+
+
+def test_tileproxy(page: Page, playwright_helper):
+ playwright_helper.login()
+ track_id = playwright_helper.add_track().id
+
+ page.goto(f"/track/{track_id}")
+
+ with page.expect_request("/tile/test/**"):
+ pass