本文整理汇总了Python中the_tale.common.postponed_tasks.prototypes.PostponedTaskPrototype._db_latest方法的典型用法代码示例。如果您正苦于以下问题:Python PostponedTaskPrototype._db_latest方法的具体用法?Python PostponedTaskPrototype._db_latest怎么用?Python PostponedTaskPrototype._db_latest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.common.postponed_tasks.prototypes.PostponedTaskPrototype
的用法示例。
在下文中一共展示了PostponedTaskPrototype._db_latest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_success_multiply_accoutns
# 需要导入模块: from the_tale.common.postponed_tasks.prototypes import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.prototypes.PostponedTaskPrototype import _db_latest [as 别名]
def test_success_multiply_accoutns(self):
with self.check_delta(PostponedTaskPrototype._db_count, 1):
self.check_ajax_processing(self.post_ajax_json(url('accounts:messages:create'), {'text': 'test-message', 'recipients': ('%d,%d' % (self.account2.id, self.account3.id))}))
task = PostponedTaskPrototype._db_latest()
self.assertEqual(task.internal_logic.message, 'test-message')
self.assertEqual(task.internal_logic.account_id, self.account1.id)
self.assertEqual(task.internal_logic.recipients, [self.account2.id, self.account3.id])
示例2: test_success
# 需要导入模块: from the_tale.common.postponed_tasks.prototypes import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.prototypes.PostponedTaskPrototype import _db_latest [as 别名]
def test_success(self):
with mock.patch('the_tale.accounts.workers.accounts_manager.Worker.cmd_task') as cmd_task:
with self.check_delta(PostponedTaskPrototype._db_count, 1):
self.check_ajax_processing(self.post_ajax_json(url('accounts:messages:create'), {'text': 'test-message', 'recipients': self.account2.id}))
task = PostponedTaskPrototype._db_latest()
self.assertEqual(cmd_task.call_args_list, [mock.call(task.id)])
self.assertEqual(task.internal_logic.message, 'test-message')
self.assertEqual(task.internal_logic.account_id, self.account1.id)
self.assertEqual(task.internal_logic.recipients, [self.account2.id])
示例3: test_invoke_hero_method
# 需要导入模块: from the_tale.common.postponed_tasks.prototypes import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.prototypes.PostponedTaskPrototype import _db_latest [as 别名]
def test_invoke_hero_method(self):
with self.check_delta(PostponedTaskPrototype._db_count, 1):
operation = self.effect.logic.invoke_hero_method(self.account_1.id, self.hero_1.id, 'method_x', {'x': 'y'})
with mock.patch('the_tale.game.workers.supervisor.Worker.cmd_logic_task') as cmd_logic_task:
operation()
task = PostponedTaskPrototype._db_latest()
self.assertEqual(cmd_logic_task.call_args_list,
[mock.call(account_id=self.account_1.id, task_id=task.id)])
self.assertEqual(task.internal_logic.hero_id, self.hero_1.id)
self.assertEqual(task.internal_logic.method_name, 'method_x')
self.assertEqual(task.internal_logic.method_kwargs, {'x': 'y'})
示例4: test_success
# 需要导入模块: from the_tale.common.postponed_tasks.prototypes import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.prototypes.PostponedTaskPrototype import _db_latest [as 别名]
def test_success(self):
with self.check_delta(PostponedTaskPrototype._db_count, 1):
response = self.post_ajax_json(url('accounts:transfer-money', self.account_2.id), self.post_data())
task = PostponedTaskPrototype._db_latest()
self.check_ajax_processing(response, task.status_url)