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


Python MessagePrototype._db_get_object方法代码示例

本文整理汇总了Python中the_tale.accounts.personal_messages.prototypes.MessagePrototype._db_get_object方法的典型用法代码示例。如果您正苦于以下问题:Python MessagePrototype._db_get_object方法的具体用法?Python MessagePrototype._db_get_object怎么用?Python MessagePrototype._db_get_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在the_tale.accounts.personal_messages.prototypes.MessagePrototype的用法示例。


在下文中一共展示了MessagePrototype._db_get_object方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_achievement__notify

# 需要导入模块: from the_tale.accounts.personal_messages.prototypes import MessagePrototype [as 别名]
# 或者: from the_tale.accounts.personal_messages.prototypes.MessagePrototype import _db_get_object [as 别名]
    def test_add_achievement__notify(self):
        with self.check_delta(GiveItemTaskPrototype._db_count, 2):
            with self.check_delta(MessagePrototype._db_count, 1):
                self.account_achievements_1.add_achievement(self.achievement_1, notify=True)

        message = MessagePrototype._db_get_object(0)
        self.assertEqual(message.sender_id, get_system_user().id)
        self.assertEqual(message.recipient_id, self.account_1.id)
        self.assertTrue((url('accounts:achievements:group', self.achievement_1.group.slug) + ('#a%d' % self.achievement_1.id)) in
                        message.text)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例2: test_process__has_active_accounts

# 需要导入模块: from the_tale.accounts.personal_messages.prototypes import MessagePrototype [as 别名]
# 或者: from the_tale.accounts.personal_messages.prototypes.MessagePrototype import _db_get_object [as 别名]
    def test_process__has_active_accounts(self):
        AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1))

        self.request.process()

        self.assertEqual(MessagePrototype._db_count(), 1)

        message = MessagePrototype._db_get_object(0)
        self.assertEqual(message.recipient_id, self.account_2.id)
        self.assertEqual(message.sender_id, get_system_user().id)

        self.assertEqual(list(AccountPrototype._db_filter(premium_end_at__gt=datetime.datetime.now()).values_list('id', flat=True)), [self.account_2.id])

        self.request.reload()
        self.assertTrue(self.request.state.is_PROCESSED)
        self.assertEqual(self.request.receiver_id, self.account_2.id)
开发者ID:Alkalit,项目名称:the-tale,代码行数:18,代码来源:test_random_premium_request.py

示例3: test_day_started_signal

# 需要导入模块: from the_tale.accounts.personal_messages.prototypes import MessagePrototype [as 别名]
# 或者: from the_tale.accounts.personal_messages.prototypes.MessagePrototype import _db_get_object [as 别名]
    def test_day_started_signal(self):
        self.assertFalse(portal_settings.SETTINGS_ACCOUNT_OF_THE_DAY_KEY in settings)

        self.assertEqual(MessagePrototype._db_count(), 0)

        with mock.patch('the_tale.accounts.workers.accounts_manager.Worker.cmd_run_account_method') as cmd_run_account_method:
            portal_signals.day_started.send(self.__class__)

        self.assertEqual(cmd_run_account_method.call_count, 1)
        self.assertEqual(cmd_run_account_method.call_args, mock.call(account_id=self.account.id,
                                                                     method_name='prolong_premium',
                                                                     data={'days': portal_settings.PREMIUM_DAYS_FOR_HERO_OF_THE_DAY}))

        self.assertEqual(int(settings[portal_settings.SETTINGS_ACCOUNT_OF_THE_DAY_KEY]), self.account.id)

        self.assertEqual(MessagePrototype._db_count(), 1)
        message = MessagePrototype._db_get_object(0)
        self.assertEqual(message.sender_id, get_system_user().id)
        self.assertEqual(message.recipient_id, self.account.id)
开发者ID:Alkalit,项目名称:the-tale,代码行数:21,代码来源:test_signals.py


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