本文整理汇总了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)
示例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)
示例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)