Skip to content

Test helpers

components.payment_gateway.subcomponents.ledgers.models.tests.factories

LedgerEntryFactory

Bases: AlanBaseFactory[LedgerEntry]

Meta

model class-attribute instance-attribute
model = LedgerEntry

amount class-attribute instance-attribute

amount = Faker('random_int', min=-100, max=100)

description class-attribute instance-attribute

description = Faker('text', max_nb_chars=100)

ending_balance class-attribute instance-attribute

ending_balance = LazyAttribute(
    lambda t: opening_balance + amount
)

ledger class-attribute instance-attribute

ledger = SubFactory(Ledger)

occurred_at class-attribute instance-attribute

occurred_at = Faker('past_datetime', start_date='-1d')

opening_balance class-attribute instance-attribute

opening_balance = Faker('random_int', min=50, max=1000)

reference class-attribute instance-attribute

reference = Faker('random_string', length=32)

LedgerFactory

Bases: AlanBaseFactory[Ledger]

Meta

model class-attribute instance-attribute
model = Ledger

description class-attribute instance-attribute

description = Faker('text', max_nb_chars=100)

reference class-attribute instance-attribute

reference = Faker('random_string', length=32)