budget/tests/mocks/categories.py
Luís Murta 638b833c74
ImportCommand and Serializable types
The new command ImportCommand takes a Serializable type, from which it
can call the deserialize method to generate a DB ORM type. The
Serializable interface also declares the serialize method.

(De)serialization moved to the ORM types, due to the inability to
properly use overloading.
Possible improvement for the future is to merge serialization
information on JSONDecoder/Encoder classes.

Adds a MockClient with the in-memory SQLite DB which can be used by
tests.
Most types export/import functionally tested using two DBs and comparing
entries.
2024-01-22 21:49:56 +00:00

22 lines
526 B
Python

from decimal import Decimal
from pfbudget.db.model import Category, CategoryGroup, CategoryRule, Tag, TagRule
category_null = Category("null")
categorygroup1 = CategoryGroup("group#1")
category1 = Category(
"cat#1",
"group#1",
rules=[CategoryRule("cat#1", description="desc#1", max=Decimal(0))],
)
category2 = Category(
"cat#2",
"group#1",
rules=[CategoryRule("cat#1", description="desc#1", max=Decimal(0))],
)
tag_1 = Tag("tag#1", rules=[TagRule("tag#1", description="desc#1", max=Decimal(0))])