fix: restore hidden budget categories during seed

This commit is contained in:
2026-04-22 07:43:25 +02:00
parent 6ba568ea68
commit 53427e0b4d
2 changed files with 83 additions and 11 deletions
+38
View File
@@ -0,0 +1,38 @@
from __future__ import annotations
from app.extensions import db
from app.models import Account, Category, Entry
from app.seed import seed_data
def test_seed_restores_hidden_budget_categories_with_active_entries(app):
budget_account = Account.query.filter_by(slug="gemeinschaftskonto").first()
category = Category(
account_id=budget_account.id,
name="Legacy Budget",
slug="legacy-budget",
is_active=False,
sort_order=999,
)
db.session.add(category)
db.session.flush()
db.session.add(
Entry(
category_id=category.id,
name="Legacy Eintrag",
slug="legacy-eintrag",
default_amount=0,
amount_type="fixed",
benefit_scope="all-users",
is_active=True,
sort_order=1,
)
)
db.session.commit()
seed_data()
db.session.expire_all()
restored = Category.query.filter_by(account_id=budget_account.id, slug="legacy-budget").first()
assert restored is not None
assert restored.is_active is True