Public pages never checked the session, so they always showed Log in. Set g.me in before_request when a session cookie is present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2616ef5060
commit
c51cf726b0
4 files changed
+37
-2
No files matched your search
@@ -57,3 +57,13 @@ def test_note_page_meta_line(app):
|
||||
html = app.test_client().get(f"/note/{note.slug}").data.decode()
|
||||
assert "<title>Hello · My Notes</title>" in html
|
||||
assert 'class="u-url u-uid"' in html
|
||||
|
||||
|
||||
def test_nav_shows_admin_when_logged_in(app):
|
||||
from starpunk.auth import create_session
|
||||
client = app.test_client()
|
||||
with app.test_request_context():
|
||||
client.set_cookie("starpunk_session", create_session("https://example.com"))
|
||||
nav = client.get("/").data.decode().split('class="site-nav"', 1)[1].split("</nav>", 1)[0]
|
||||
assert ">Admin</a>" in nav
|
||||
assert "/auth/login" not in nav
|
||||
Reference in new issue
Block a user