本文整理汇总了Python中the_tale.finances.bank.prototypes.InvoicePrototype._db_get_object方法的典型用法代码示例。如果您正苦于以下问题:Python InvoicePrototype._db_get_object方法的具体用法?Python InvoicePrototype._db_get_object怎么用?Python InvoicePrototype._db_get_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.finances.bank.prototypes.InvoicePrototype
的用法示例。
在下文中一共展示了InvoicePrototype._db_get_object方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process__processed
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import _db_get_object [as 别名]
def test_process__processed(self):
self.assertEqual(BankInvoicePrototype._db_count(), 0)
invoice = self.create_invoice(worker_call_count=1)
self.assertEqual(invoice.bank_invoice_id, None)
invoice.process()
invoice.reload()
self.assertEqual(BankInvoicePrototype._db_count(), 1)
self.assertTrue(invoice.state.is_PROCESSED)
bank_invoice = BankInvoicePrototype._db_get_object(0)
self.assertEqual(bank_invoice.id, invoice.bank_invoice_id)
self.assertTrue(bank_invoice.recipient_type.is_GAME_ACCOUNT)
self.assertEqual(bank_invoice.recipient_id, self.fabric.account_id)
self.assertTrue(bank_invoice.sender_type.is_XSOLLA)
self.assertEqual(bank_invoice.sender_id, 0)
self.assertTrue(bank_invoice.state.is_FORCED)
self.assertTrue(bank_invoice.currency.is_PREMIUM)
self.assertTrue(bank_invoice.amount, int(self.fabric.payment_sum))
self.assertEqual(bank_invoice.operation_uid, 'bank-xsolla')
示例2: test_create
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import _db_get_object [as 别名]
def test_create(self):
with mock.patch('the_tale.finances.bank.workers.bank_processor.Worker.cmd_init_invoice') as cmd_init_invoice:
transaction = self.create_transaction()
self.assertEqual(cmd_init_invoice.call_count, 1)
self.assertEqual(InvoicePrototype._model_class.objects.all().count(), 1)
invoice = InvoicePrototype._db_get_object(0)
self.assertEqual(transaction.invoice_id, InvoicePrototype._db_get_object(0).id)
self.assertTrue(invoice.state.is_REQUESTED)
self.assertEqual(invoice.recipient_type, ENTITY_TYPE.GAME_ACCOUNT)
self.assertEqual(invoice.recipient_id, 2)
self.assertEqual(invoice.sender_type, ENTITY_TYPE.GAME_LOGIC)
self.assertEqual(invoice.sender_id, 3)
self.assertEqual(invoice.currency, CURRENCY_TYPE.PREMIUM)
self.assertEqual(invoice.amount, 113)
self.assertEqual(invoice.description_for_sender, 'transaction description for sender')
self.assertEqual(invoice.description_for_recipient, 'transaction description for recipient')
self.assertEqual(invoice.operation_uid, 'transaction-operation-uid')
示例3: test_success
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import _db_get_object [as 别名]
def test_success(self):
self.assertEqual(BankInvoicePrototype._db_count(), 0)
response = self.post_ajax_json(url('shop:give-money', account=self.account.id), self.post_data(amount=5))
self.assertEqual(BankInvoicePrototype._db_count(), 1)
invoice = BankInvoicePrototype._db_get_object(0)
self.assertTrue(invoice.recipient_type.is_GAME_ACCOUNT)
self.assertEqual(invoice.recipient_id, self.account.id)
self.assertTrue(invoice.sender_type.is_GAME_MASTER)
self.assertEqual(invoice.sender_id, self.superuser.id)
self.assertTrue(invoice.currency.is_PREMIUM)
self.assertEqual(invoice.amount, 5)
self.assertEqual(invoice.description_for_recipient, u'bla-bla')
self.assertTrue(invoice.state.is_FORCED)
self.check_ajax_ok(response)
示例4: test_process__wait_confirmation__transaction_confirmed__with_referal
# 需要导入模块: from the_tale.finances.bank.prototypes import InvoicePrototype [as 别名]
# 或者: from the_tale.finances.bank.prototypes.InvoicePrototype import _db_get_object [as 别名]
def test_process__wait_confirmation__transaction_confirmed__with_referal(self):
self.invoice.state = INVOICE_STATE.CONFIRMED
self.invoice.save()
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
self.account._model.referral_of_id = account_id
self.account.save()
self.task.state = self.task.RELATION.WAIT_TRANSACTION_CONFIRMATION
self.assertEqual(self.task.process(main_task=mock.Mock()), POSTPONED_TASK_LOGIC_RESULT.SUCCESS)
self.assertEqual(InvoicePrototype._db_count(), 2)
referral_invoice = InvoicePrototype._db_get_object(1)
self.assertTrue(referral_invoice.amount > 0)
self.assertTrue(referral_invoice.amount < self.amount)
self.assertEqual(referral_invoice.recipient_id, account_id)
self.assertTrue(referral_invoice.state.is_FORCED)
self.assertTrue(self.task.state.is_SUCCESSED)