diff --git a/palmer/main.py b/palmer/main.py index a034a21..73bb23f 100644 --- a/palmer/main.py +++ b/palmer/main.py @@ -388,7 +388,7 @@ async def artifact_page(token: str): async def icon_png(): """The page's favicon and apple-touch-icon. No token: it is the same mark for everyone and carries no one's data.""" - from cards import render_icon + from palmer.cards import render_icon return Response(content=render_icon(), media_type="image/png", headers={"Cache-Control": "public, max-age=86400"}) diff --git a/tests/test_page.py b/tests/test_page.py index 7849638..603e429 100644 --- a/tests/test_page.py +++ b/tests/test_page.py @@ -1037,3 +1037,11 @@ def test_the_description_leads_with_the_weather_when_named(self): def test_the_icon_is_a_png(self): assert cards.render_icon()[:8] == b"\x89PNG\r\n\x1a\n" + + def test_the_icon_route_serves_it(self): + """The route imported `cards` by its pre-package name and 500'd in + production while every unit test of render_icon passed.""" + from fastapi.testclient import TestClient + from palmer.main import app + r = TestClient(app).get("/icon.png") + assert r.status_code == 200 and r.headers["content-type"] == "image/png"