feat: Szenario-GUI mit Ende-Modifikator und Einmalzahlungen je Szenario
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,8 @@ from datetime import date, timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
from app.formats import eur
|
||||
from app.models.tables import Account, Loan, PlannedItem, RecurringItem, Scenario
|
||||
from app.models.tables import (Account, Loan, PlannedItem, RecurringItem,
|
||||
Scenario, ScenarioModifier, ScenarioPlannedItem)
|
||||
|
||||
H = {"Authorization": "Bearer test-key"}
|
||||
|
||||
@@ -336,3 +337,23 @@ def test_salden_shows_ohne_anker_footnote(client, db):
|
||||
r = client.get("/salden")
|
||||
assert r.status_code == 200
|
||||
assert "ohne Anker" in r.text and "relative Werte" in r.text
|
||||
|
||||
|
||||
def test_szenario_gui_ende_und_einmalzahlungen(client, db):
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
sc = Scenario(name="GUI-Ende", description="")
|
||||
db.add(sc)
|
||||
db.flush()
|
||||
db.add(ScenarioModifier(scenario_id=sc.id, target_type="recurring",
|
||||
target_id=1, kind="ende", value=Decimal("0"),
|
||||
end_date=date(2026, 8, 31)))
|
||||
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
|
||||
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
|
||||
assert "Einmalzahlungen in diesem Szenario" in r
|
||||
assert "Zufluss-GUI" in r and "5.000,00" in r and "30.07.2026" in r
|
||||
assert f'hx-post="/api/scenarios/{sc.id}/planned"' in r
|
||||
|
||||
Reference in New Issue
Block a user