feat: eigene Szenarien-Seite /szenarien
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ H = {"Authorization": "Bearer test-key"}
|
||||
|
||||
|
||||
def test_pages_require_login(client):
|
||||
for path in ("/", "/buchungen", "/import", "/salden", "/planung", "/hilfe"):
|
||||
for path in ("/", "/buchungen", "/import", "/salden", "/planung", "/szenarien", "/hilfe"):
|
||||
r = client.get(path, follow_redirects=False)
|
||||
assert r.status_code in (302, 303), path
|
||||
assert r.headers["location"] == "/login"
|
||||
@@ -17,7 +17,7 @@ def test_pages_require_login(client):
|
||||
|
||||
def test_pages_render_after_login(client):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
for path in ("/", "/buchungen", "/import", "/salden", "/planung", "/hilfe"):
|
||||
for path in ("/", "/buchungen", "/import", "/salden", "/planung", "/szenarien", "/hilfe"):
|
||||
r = client.get(path)
|
||||
assert r.status_code == 200
|
||||
assert "Finanzberatung" in r.text
|
||||
@@ -317,15 +317,23 @@ def test_planung_hat_bearbeiten_formulare(client, db):
|
||||
db.add(Loan(name="EditL", principal=Decimal("1000.00"),
|
||||
annual_rate_pct=Decimal("4.50"), term_months=12,
|
||||
payout_date=date(2026, 8, 1), repayment_type="annuity"))
|
||||
db.add(Scenario(name="EditS", description="d"))
|
||||
db.commit()
|
||||
r = client.get("/planung").text
|
||||
assert r.count(">Bearbeiten</button>") >= 4
|
||||
assert r.count(">Bearbeiten</button>") >= 3
|
||||
for fragment in ('hx-patch="/api/recurring/', 'hx-patch="/api/planned/',
|
||||
'hx-patch="/api/loans/', 'hx-patch="/api/scenarios/'):
|
||||
'hx-patch="/api/loans/'):
|
||||
assert fragment in r, fragment
|
||||
|
||||
|
||||
def test_szenarien_hat_bearbeiten_formular(client, db):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
db.add(Scenario(name="EditS", description="d"))
|
||||
db.commit()
|
||||
r = client.get("/szenarien").text
|
||||
assert r.count(">Bearbeiten</button>") >= 1
|
||||
assert 'hx-patch="/api/scenarios/' in r
|
||||
|
||||
|
||||
def test_salden_shows_ohne_anker_footnote(client, db):
|
||||
# UX-Regel: Konten ohne Anker sind immer sichtbar als relative Werte
|
||||
# gekennzeichnet, nicht stillschweigend wie geankerte Konten dargestellt.
|
||||
@@ -350,7 +358,7 @@ def test_szenario_gui_ende_und_einmalzahlungen(client, db):
|
||||
db.add(ScenarioPlannedItem(scenario_id=sc.id, name="Zufluss-GUI",
|
||||
amount=Decimal("5000.00"), due=date(2026, 7, 30)))
|
||||
db.commit()
|
||||
r = client.get("/planung").text
|
||||
r = client.get("/szenarien").text
|
||||
assert 'value="ende"' in r # neue Art im Dropdown
|
||||
assert 'name="end_date"' in r # Datumsfeld im Modifikator-Formular
|
||||
assert "31.08.2026" in r # ende-Modifikator zeigt Datum
|
||||
@@ -372,7 +380,7 @@ def test_szenario_eintraege_tabelle(client, db):
|
||||
db.add(ScenarioPlannedItem(scenario_id=sc.id, name="Zufluss-Eintrag",
|
||||
amount=Decimal("5000.00"), due=date(2026, 7, 30)))
|
||||
db.commit()
|
||||
r = client.get("/planung").text
|
||||
r = client.get("/szenarien").text
|
||||
assert "Einträge" in r
|
||||
# alte details-Abschnitte sind ersetzt
|
||||
assert "<summary>Modifikatoren</summary>" not in r
|
||||
@@ -387,3 +395,22 @@ def test_szenario_eintraege_tabelle(client, db):
|
||||
assert 'value="einmal"' in r
|
||||
assert f'data-planned-url="/api/scenarios/{sc.id}/planned"' in r
|
||||
assert "onEntryArtChange" in r and "onModKindChange" not in r
|
||||
|
||||
|
||||
def test_szenarien_seite_und_nav(client, db):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
db.add(Scenario(name="Seiten-Test", description="d"))
|
||||
db.commit()
|
||||
r = client.get("/szenarien")
|
||||
assert r.status_code == 200
|
||||
assert "Seiten-Test" in r.text and "Neues Szenario anlegen" in r.text
|
||||
assert 'href="/szenarien"' in r.text # Nav-Punkt
|
||||
# Planung enthaelt keine Szenarien-Sektion mehr:
|
||||
p = client.get("/planung").text
|
||||
assert "Seiten-Test" not in p and "Neues Szenario anlegen" not in p
|
||||
assert "Wiederkehrende Posten" in p and "Kredite" in p
|
||||
|
||||
|
||||
def test_szenarien_seite_braucht_login(client):
|
||||
r = client.get("/szenarien", follow_redirects=False)
|
||||
assert r.status_code in (302, 303) and r.headers["location"] == "/login"
|
||||
|
||||
Reference in New Issue
Block a user