add abandoned status to distinguish given-up habits from completed ones

Completed and abandoned habits were both lumped under a single terminal
state, making it impossible to tell "finished successfully" apart from
"gave up" when reviewing habit history.
This commit is contained in:
2026-07-17 20:19:35 +09:00
parent d0dd530e26
commit 55918d56d1
11 changed files with 167 additions and 3 deletions
+12
View File
@@ -70,6 +70,18 @@ def test_complete_and_reactivate_habit(auth_client, db_session, test_user):
assert reactivate_res.json()["status"] == "active"
def test_abandon_and_reactivate_habit(auth_client, db_session, test_user):
habit = _make_habit(db_session, test_user.id)
abandon_res = auth_client.post(f"/api/habits/{habit.id}/abandon")
assert abandon_res.status_code == 200
assert abandon_res.json()["status"] == "abandoned"
reactivate_res = auth_client.post(f"/api/habits/{habit.id}/reactivate")
assert reactivate_res.status_code == 200
assert reactivate_res.json()["status"] == "active"
def test_reorder_endpoint(auth_client, db_session, test_user):
a = _make_habit(db_session, test_user.id, name="A")
b = _make_habit(db_session, test_user.id, name="B")