feat: Buchungs-Pagination, Inbox-Scan-Button, Grafana-Direktansteuerung, UI-Feinschliff
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
from datetime import date, timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
def test_pages_require_login(client):
|
||||
for path in ("/", "/buchungen", "/import", "/planung", "/hilfe"):
|
||||
r = client.get(path, follow_redirects=False)
|
||||
@@ -41,6 +45,37 @@ def test_version_visible(client):
|
||||
assert "v0.2.0" in client.get("/").text
|
||||
|
||||
|
||||
def test_buchungen_pagination(client, db):
|
||||
from app.models.tables import Account, Transaction
|
||||
|
||||
acc = Account(bank="dkb", iban="DE01", name="G", type="giro")
|
||||
db.add(acc)
|
||||
db.flush()
|
||||
base = date(2026, 1, 1)
|
||||
for i in range(1, 61):
|
||||
purpose = "MARKER51" if i == 51 else f"TX{i}"
|
||||
db.add(Transaction(
|
||||
account_id=acc.id, booking_date=base + timedelta(days=i),
|
||||
amount=Decimal("10.00"), purpose=purpose, counterparty="X",
|
||||
status="confirmed", dedup_hash=f"hash-{i}",
|
||||
))
|
||||
db.commit()
|
||||
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
|
||||
r1 = client.get("/buchungen")
|
||||
assert r1.status_code == 200
|
||||
assert "Seite 1 von 2" in r1.text
|
||||
assert "Weiter" in r1.text
|
||||
assert "MARKER51" not in r1.text
|
||||
|
||||
r2 = client.get("/buchungen?page=2")
|
||||
assert r2.status_code == 200
|
||||
assert "Seite 2 von 2" in r2.text
|
||||
assert "Zurück" in r2.text
|
||||
assert "MARKER51" in r2.text
|
||||
|
||||
|
||||
def test_planning_page_has_all_sections(client):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
r = client.get("/planung")
|
||||
|
||||
@@ -131,6 +131,17 @@ def test_upload_rejects_non_pdf(client, tmp_path, monkeypatch):
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_delete_error_import_returns_204(client, db):
|
||||
# Ein fehlgeschlagener Import (status="error") muss verworfen werden
|
||||
# koennen - nur bestaetigte Importe sind vor dem Loeschen geschuetzt.
|
||||
from app.models.tables import Statement
|
||||
db.add(Statement(filename="kaputt.pdf", bank="dkb", status="error",
|
||||
error_message="PDF nicht lesbar"))
|
||||
db.commit()
|
||||
sid = db.query(Statement).one().id
|
||||
assert client.delete(f"/api/imports/{sid}", headers=H).status_code == 204
|
||||
|
||||
|
||||
def test_upload_corrupt_pdf_produces_error_statement_not_500(client, tmp_path, monkeypatch):
|
||||
# Datei besteht die Endungspruefung (.pdf), ist aber strukturell kein
|
||||
# gueltiges PDF -> pdfplumber wirft eine eigene Exception (keine
|
||||
|
||||
Reference in New Issue
Block a user