AGPL-3.0-only, a source link in the app, and everything on dev since #5 #6

Merged
bvandeusen merged 214 commits from dev into main 2026-10-21 21:40:00 -04:00
2 changed files with 17 additions and 10 deletions
Showing only changes of commit f100e5ef85 - Show all commits
+8 -10
View File
@@ -33,16 +33,14 @@ async def test_revoke_self_requires_auth(app):
assert resp.status_code == 401
async def test_revoke_self_without_a_bearer_token_is_a_bad_request(app):
# Doubles as the routing check: a session-authenticated caller presents no
# device token, so the self-revoke view answers 400 BEFORE any DB access. A 404
# here would mean "self" fell through to the id-keyed route as a malformed UUID
# — i.e. that the static rule stopped winning.
client = app.test_client()
async with client.session_transaction() as sess:
sess["user_id"] = "00000000-0000-0000-0000-000000000001"
resp = await client.delete("/api/auth/devices/self")
assert resp.status_code == 400
def test_revoke_self_routes_to_the_self_revoke_view(app):
# The static rule must win over `/devices/<device_id>`: if "self" fell through to
# the id-keyed route it would be read as a malformed UUID and answer 404. Checked
# on the URL map, because every route behind login_required now reads the
# account's session epoch (#5173). The view's 400 for a caller with no bearer
# token is in test_integration.py.
endpoint, _ = app.url_map.bind("localhost").match("/api/auth/devices/self", method="DELETE")
assert endpoint == "auth.revoke_own_device"
async def test_device_login_validates_input(app):
+9
View File
@@ -1170,3 +1170,12 @@ async def test_a_short_password_leaves_the_reset_link_usable(app_client, db):
assert short.status_code == 400
ok = await client.post("/api/auth/reset-password", json={"token": token, "password": "a-brand-new-password"})
assert ok.status_code == 200
async def test_revoking_this_device_from_a_web_session_is_a_bad_request(app_client, db):
"""A session-cookie caller holds no device token, so "revoke the one I'm using"
has nothing to name. Moved here from the unit lane when the session check began
reading the account (#5173)."""
await _signed_in(app_client, "web")
resp = await app_client.delete("/api/auth/devices/self")
assert resp.status_code == 400