feat: add logout button to admin interface (Story 1.4)
Add logout button to admin dashboard and test to verify its presence. This completes the missing acceptance criterion for Story 1.4: "Logout option available from admin interface" Changes: - Add logout form with CSRF protection to dashboard header - Add integration test to verify logout button is present - All tests pass (24/24) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -354,3 +354,29 @@ class TestAdminLogin:
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert b"required" in response.data.lower()
|
||||
|
||||
def test_logout_option_available_in_admin_interface(self, client, db, admin): # noqa: ARG002
|
||||
"""Test that logout option is available from admin interface.
|
||||
|
||||
Acceptance Criteria (Story 1.4):
|
||||
- Logout option available from admin interface
|
||||
"""
|
||||
# Login first
|
||||
client.post(
|
||||
"/admin/login",
|
||||
data={
|
||||
"email": "admin@example.com",
|
||||
"password": "testpassword123",
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
|
||||
# Access admin dashboard
|
||||
response = client.get("/admin/dashboard", follow_redirects=False)
|
||||
assert response.status_code == 200
|
||||
|
||||
# Verify logout button/link is present
|
||||
# Check for logout form posting to /admin/logout
|
||||
assert b"/admin/logout" in response.data
|
||||
# Check for logout text in button or link
|
||||
assert b"logout" in response.data.lower() or b"log out" in response.data.lower()
|
||||
|
||||
Reference in New Issue
Block a user