当前位置: 首页>>代码示例>>Python>>正文


Python InvoicePrototype._db_get_object方法代码示例

本文整理汇总了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')
开发者ID:,项目名称:,代码行数:28,代码来源:

示例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')
开发者ID:Alkalit,项目名称:the-tale,代码行数:23,代码来源:test_transaction.py

示例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)
开发者ID:Alkalit,项目名称:the-tale,代码行数:19,代码来源:test_requests.py

示例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)
开发者ID:Alkalit,项目名称:the-tale,代码行数:24,代码来源:base_buy_task.py


注:本文中的the_tale.finances.bank.prototypes.InvoicePrototype._db_get_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。