import pytest from yandex_money.models import Payment from finance.factories import BillFactory, InvoiceFactory, PaymentFactory PRICE = 1000.00 METHOD_CASH = 'C' METHOD_YANDEX = 'Y' STATUS_WAIT = 'W' STATUS_ON_PAYMENT = 'P' STATUS_PAID = 'F' @pytest.fixture def bill_cash(student, manager): """ Create bill for the student """ _bill = BillFactory( user=student, opener=manager, ) InvoiceFactory( status=STATUS_ON_PAYMENT, method=METHOD_CASH, yandex_pay=None, bill=_bill ) return _bill @pytest.fixture def bill_yandex(student, manager): """ Create bill for the student """ _bill = BillFactory( user=student, opener=manager, ) # credit cart payment = PaymentFactory( user=student, payment_type=Payment.PAYMENT_TYPE.AC, status=Payment.STATUS.PROCESSED ) InvoiceFactory( status=STATUS_ON_PAYMENT, method=METHOD_YANDEX, yandex_pay=payment, bill=_bill ) return _bill