Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion palmer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"})

Expand Down
8 changes: 8 additions & 0 deletions tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading