feat: Warnfenster und Planungs-Hinweis bei möglicher Doppelzählung (A12-T4)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -588,3 +588,46 @@ def test_planungs_refresh_fehler_bricht_seiten_nicht(client, monkeypatch):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
for path in ("/", "/planung"):
|
||||
assert client.get(path).status_code == 200, path
|
||||
|
||||
|
||||
def test_base_hat_doppelzaehlungs_dialog(client):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
html = client.get("/").text
|
||||
assert '<script src="/static/doppelzaehlung.js"></script>' in html
|
||||
assert '<dialog id="doppelzaehlung-dialog">' in html
|
||||
assert 'id="dz-abbrechen" autofocus' in html
|
||||
assert ">Trotzdem speichern</button>" in html
|
||||
assert "FBDoppel.handle(e)" in html
|
||||
assert "doppelzaehlung_bestaetigt = true" in html
|
||||
|
||||
|
||||
def test_planung_zeigt_doppelzaehlungs_hinweis(client, db):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
db.add_all([
|
||||
Loan(name="Auto", principal=Decimal("1200.00"), annual_rate_pct=Decimal("0"),
|
||||
term_months=12, payout_date=date(2026, 1, 15), repayment_type="annuity"),
|
||||
RecurringItem(name="Rate Auto", amount=Decimal("-100.00"), rhythm="monthly", due_day=15),
|
||||
RecurringItem(name="Miete", amount=Decimal("-600.00"), rhythm="monthly", due_day=1),
|
||||
])
|
||||
db.commit()
|
||||
html = client.get("/planung").text
|
||||
assert "⚠ zählt evtl. doppelt mit Kredit „Auto“" in html
|
||||
assert "⚠ zählt evtl. doppelt mit Posten „Rate Auto“" in html
|
||||
assert html.count("⚠ zählt evtl. doppelt") == 2
|
||||
assert '<td data-sort="Rate Auto">' in html
|
||||
assert '<td data-sort="Auto">' in html
|
||||
|
||||
|
||||
def test_planung_ohne_konflikt_kein_hinweis(client, db):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
db.add(RecurringItem(name="Miete", amount=Decimal("-600.00"), rhythm="monthly", due_day=1))
|
||||
db.commit()
|
||||
assert "zählt evtl. doppelt" not in client.get("/planung").text
|
||||
|
||||
|
||||
def test_vorschlag_formular_nutzt_json_form_post(client):
|
||||
# Review Focus 5: „Vorschlag übernehmen" läuft über denselben Warnweg.
|
||||
import re
|
||||
from pathlib import Path
|
||||
src = Path("app/templates/planning.html").read_text(encoding="utf-8")
|
||||
assert re.search(r'class="inline-form" hx-ext="json-form" hx-post="/api/recurring"', src)
|
||||
|
||||
Reference in New Issue
Block a user