46 lines
985 B
Python
46 lines
985 B
Python
from decimal import Decimal
|
|
|
|
from faker import Faker
|
|
from polyfactory.factories.pydantic_factory import ModelFactory
|
|
from polyfactory.fields import Use
|
|
|
|
from src.models import B4wExport
|
|
|
|
DEFAULT_CATEGORY = "root_category:parent_category:leaf_category"
|
|
|
|
|
|
def _amount() -> Decimal:
|
|
return B4wExportFactory.__faker__.pydecimal(
|
|
left_digits=6,
|
|
right_digits=2,
|
|
positive=True,
|
|
min_value=Decimal("0.01"),
|
|
)
|
|
|
|
|
|
def _sentence() -> str:
|
|
return B4wExportFactory.__faker__.sentence(
|
|
nb_words=8,
|
|
variable_nb_words=False,
|
|
)
|
|
|
|
|
|
def _names() -> str:
|
|
return B4wExportFactory.__faker__.company()
|
|
|
|
|
|
def _iban() -> str:
|
|
return B4wExportFactory.__faker__.iban()
|
|
|
|
|
|
class B4wExportFactory(ModelFactory[B4wExport]):
|
|
__faker__ = Faker("de_DE")
|
|
__use_examples__ = True
|
|
|
|
Amt = Use(_amount)
|
|
RmtInf = Use(_sentence)
|
|
Notes = Use(_sentence)
|
|
RmtdNm = Use(_names)
|
|
OwnrAcctIBAN = Use(_iban)
|
|
RmtdAcctIBAN = Use(_iban)
|