feat: CSV-Import ueber bestehende Pipeline mit dreiwertiger Saldo-Pruefung
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,41 @@ def test_import_list_fragment_renders_after_login(client):
|
||||
assert "Noch keine Imports" in r.text
|
||||
|
||||
|
||||
def test_preview_fragment_shows_balance_ok_none_for_format_without_saldo(
|
||||
client, tmp_path, monkeypatch):
|
||||
# UX-Regel: Saldo-Status ist IMMER sichtbar, auch wenn das Format (hier
|
||||
# HVB-CSV) keine Saldodaten liefert - dreiwertig statt faelschlich "rot".
|
||||
monkeypatch.setenv("FB_INBOX_DIR", str(tmp_path / "inbox"))
|
||||
monkeypatch.setenv("FB_UPLOADS_DIR", str(tmp_path / "uploads"))
|
||||
from app.config import get_settings
|
||||
get_settings.cache_clear()
|
||||
from tests.test_import_api import _hvb_csv_bytes
|
||||
sid = client.post("/api/imports/upload", headers=H,
|
||||
files={"file": ("HVB_gui.csv", _hvb_csv_bytes(), "text/csv")}
|
||||
).json()["id"]
|
||||
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
r = client.get(f"/import/{sid}/preview-fragment")
|
||||
assert r.status_code == 200
|
||||
assert "Saldo-Prüfung: nicht verfügbar (Format ohne Saldodaten)" in r.text
|
||||
|
||||
|
||||
def test_preview_fragment_shows_balance_ok_true_for_vr_csv(client, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("FB_INBOX_DIR", str(tmp_path / "inbox"))
|
||||
monkeypatch.setenv("FB_UPLOADS_DIR", str(tmp_path / "uploads"))
|
||||
from app.config import get_settings
|
||||
get_settings.cache_clear()
|
||||
from tests.test_import_api import _vr_csv_bytes
|
||||
sid = client.post("/api/imports/upload", headers=H,
|
||||
files={"file": ("VR_gui.csv", _vr_csv_bytes(), "text/csv")}
|
||||
).json()["id"]
|
||||
|
||||
client.post("/login", data={"username": "admin", "password": "geheim"})
|
||||
r = client.get(f"/import/{sid}/preview-fragment")
|
||||
assert r.status_code == 200
|
||||
assert "Saldo plausibel" in r.text
|
||||
|
||||
|
||||
def test_version_visible(client):
|
||||
from pathlib import Path
|
||||
version = (Path(__file__).resolve().parent.parent / "VERSION").read_text().strip()
|
||||
|
||||
Reference in New Issue
Block a user