Edit name/amount on budget template entries (#21) #22

Merged
claude-code merged 12 commits from feat/21-edit-template-entries into main 2026-04-17 19:28:56 -06:00
2 changed files with 30 additions and 0 deletions
Showing only changes of commit a814ec6e01 - Show all commits

View file

@ -190,6 +190,15 @@ def save_entry(
return _append_oob(response, *extras)
@router.get("/sections/{section}", response_class=HTMLResponse)
def get_section(
section: Section,
request: Request,
db: Session = Depends(get_session),
) -> HTMLResponse:
return _render_section(request, db, section)
@router.post("/entries/{entry_id}/notes", response_class=HTMLResponse)
def update_entry_notes(
entry_id: int,

View file

@ -204,3 +204,24 @@ def test_post_entry_missing_returns_404(client):
data={"name": "Whatever", "amount": "1.00", "notes": ""},
)
assert response.status_code == 404
def test_get_section_returns_read_mode(client):
client.post(
"/sections/subscription/entries",
data={"name": "Twitch", "amount": "10.99"},
)
# enter edit mode first
edit = client.get("/entries/1/edit")
assert 'entry-row editing' in edit.text
# now "cancel" via GET /sections/{section}
response = client.get("/sections/subscription")
assert response.status_code == 200
assert 'entry-row reading' in response.text
assert 'entry-row editing' not in response.text
def test_get_section_invalid_returns_422(client):
# FastAPI rejects an unknown Section enum value at routing
response = client.get("/sections/not_a_real_section")
assert response.status_code == 422