feat: Szenario per GUI löschen, Name System-Ist reserviert (A11-T1)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-28 19:01:21 +02:00
co-authored by Claude Opus 5.5
parent 1c452b48de
commit 57ab6dae4a
5 changed files with 64 additions and 0 deletions
+24
View File
@@ -1,6 +1,8 @@
from datetime import date, timedelta
from decimal import Decimal
import pytest
from app.models.tables import Account, Transaction
from app.services.balances import account_balance
@@ -294,3 +296,25 @@ def test_scenario_planned_patch(client, db):
r = client.patch(f"/api/scenarios/{other['id']}/planned/{p['id']}", headers=H, json={
"name": "x", "amount": "1.00", "due": "2026-08-15"})
assert r.status_code == 404
@pytest.mark.parametrize("name", ["System-Ist", "system-ist", " System-Ist ", "SYSTEM-IST"])
def test_szenario_name_system_ist_ist_reserviert_post(client, name):
r = client.post("/api/scenarios", json={"name": name}, headers=H)
assert r.status_code == 422
assert "reserviert" in r.json()["detail"]
def test_szenario_name_system_ist_ist_reserviert_patch(client):
sid = client.post("/api/scenarios", json={"name": "Normal"}, headers=H).json()["id"]
r = client.patch(f"/api/scenarios/{sid}", json={"name": "System-Ist"}, headers=H)
assert r.status_code == 422
assert "reserviert" in r.json()["detail"]
# Andere Felder ohne Namensänderung bleiben erlaubt.
r = client.patch(f"/api/scenarios/{sid}", json={"description": "x"}, headers=H)
assert r.status_code == 200
def test_szenario_normale_namen_weiter_erlaubt(client):
assert client.post("/api/scenarios", json={"name": "Ist-Zustand plus"},
headers=H).status_code == 201