aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-06-22 22:29:14 +0200
committerDaniel Schadt <kingdread@gmx.de>2023-06-22 22:29:14 +0200
commit99e3e33cf0a529fa3fe71af98ce5017054dbb8ea (patch)
treed4a8ec273488803341b15ea0048c3594fbbcd0c0
parent7b0fe14d07277a0b9e6b709e933c1c40fd2af748 (diff)
downloadfietsboek-99e3e33cf0a529fa3fe71af98ce5017054dbb8ea.tar.gz
fietsboek-99e3e33cf0a529fa3fe71af98ce5017054dbb8ea.tar.bz2
fietsboek-99e3e33cf0a529fa3fe71af98ce5017054dbb8ea.zip
add preliminary tileproxy test
-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