本文整理汇总了Python中the_tale.common.postponed_tasks.PostponedTaskPrototype._db_get_object方法的典型用法代码示例。如果您正苦于以下问题:Python PostponedTaskPrototype._db_get_object方法的具体用法?Python PostponedTaskPrototype._db_get_object怎么用?Python PostponedTaskPrototype._db_get_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.common.postponed_tasks.PostponedTaskPrototype
的用法示例。
在下文中一共展示了PostponedTaskPrototype._db_get_object方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_1_process
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_1_process(self):
self.assertEqual(PostponedTaskPrototype._model_class.objects.all().count(), 0)
self.assertEqual(ChangeCredentialsTaskPrototype._model_class.objects.all().count(), 0)
new_password = self.task.process(logger=mock.Mock())
self.assertTrue(self.task.is_processed)
self.assertEqual(django_authenticate(nick='test_user', password='111111').id, self.account.id)
self.assertEqual(PostponedTaskPrototype._model_class.objects.all().count(), 1)
self.assertEqual(ChangeCredentialsTaskPrototype._model_class.objects.all().count(), 1)
PostponedTaskPrototype._db_get_object(0).process(logger=mock.Mock())
self.assertEqual(django_authenticate(nick='test_user', password='111111'), None)
self.assertEqual(django_authenticate(nick='test_user', password=new_password).id, self.account.id)
示例2: test_profile_update_nick
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_profile_update_nick(self):
self.request_login(self.account.email)
response = self.client.post(reverse('accounts:profile:update'), {'email': self.account.email, 'nick': 'test_nick'})
self.assertEqual(response.status_code, 200)
self.check_ajax_processing(response, PostponedTaskPrototype._db_get_object(0).status_url)
self.assertEqual(ChangeCredentialsTask.objects.all().count(), 1)
self.assertEqual(ChangeCredentialsTask.objects.all()[0].state, relations.CHANGE_CREDENTIALS_TASK_STATE.CHANGING)
示例3: test_buy
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_buy(self):
self.assertEqual(PostponedTaskPrototype._model_class.objects.all().count(), 0)
self.assertEqual(InvoicePrototype._model_class.objects.all().count(), 0)
with mock.patch("the_tale.common.postponed_tasks.PostponedTaskPrototype.cmd_wait") as cmd_wait:
self.purchase.buy(account=self.account)
self.assertEqual(cmd_wait.call_count, 1)
self.assertEqual(PostponedTaskPrototype._model_class.objects.all().count(), 1)
self.assertEqual(InvoicePrototype._model_class.objects.all().count(), 1)
postponed_logic = PostponedTaskPrototype._db_get_object(0).internal_logic
self.assertTrue(isinstance(postponed_logic, BuyPremium))
self.assertEqual(postponed_logic.account_id, self.account.id)
self.assertEqual(postponed_logic.days, self.days)
invoice = InvoicePrototype.get_by_id(postponed_logic.transaction.invoice_id)
self.assertEqual(invoice.recipient_type, ENTITY_TYPE.GAME_ACCOUNT)
self.assertEqual(invoice.recipient_id, self.account.id)
self.assertEqual(invoice.sender_type, ENTITY_TYPE.GAME_LOGIC)
self.assertEqual(invoice.sender_id, 0)
self.assertEqual(invoice.currency, CURRENCY_TYPE.PREMIUM)
self.assertEqual(invoice.amount, -self.cost)
self.assertEqual(invoice.description_for_sender, u"premium-days-transaction-description")
self.assertEqual(invoice.description_for_recipient, u"premium-days-transaction-description")
示例4: test_success
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_success(self):
self.assertEqual(PostponedTask.objects.all().count(), 0)
response = self.post_ajax_json(url('game:heroes:reset-abilities', self.hero.id))
self.assertEqual(PostponedTask.objects.all().count(), 1)
task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, task.status_url)
示例5: test_profile_confirm_email_for_unlogined
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_profile_confirm_email_for_unlogined(self):
self.request_login(self.account.email)
self.client.post(reverse('accounts:profile:update'), {'email': '[email protected]', 'nick': 'test_nick'})
self.request_logout()
uuid = ChangeCredentialsTask.objects.all()[0].uuid
response = self.client.get(reverse('accounts:profile:confirm-email')+'?uuid='+uuid)
self.check_response_redirect(response, PostponedTaskPrototype._db_get_object(0).wait_url)
示例6: test_choose_processing
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_choose_processing(self):
self.turn_to_quest(self.storage, self.hero.id)
self.request_login('[email protected]')
response = self.client.post(url('game:quests:api-choose', option_uid=self.option_uid, api_version='1.0', api_client=project_settings.API_CLIENT))
task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, task.status_url)
self.assertEqual(PostponedTask.objects.all().count(), 1)
示例7: test_profile_confirm_email
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_profile_confirm_email(self):
self.request_login(self.account.email)
self.client.post(reverse('accounts:profile:update'), {'email': '[email protected]', 'nick': 'test_nick'})
self.assertEqual(PostponedTaskPrototype._model_class.objects.all().count(), 0)
uuid = ChangeCredentialsTask.objects.all()[0].uuid
response = self.client.get(reverse('accounts:profile:confirm-email')+'?uuid='+uuid)
self.check_response_redirect(response, PostponedTaskPrototype._db_get_object(0).wait_url)
self.assertEqual(ChangeCredentialsTask.objects.all().count(), 1)
self.assertEqual(ChangeCredentialsTask.objects.all()[0].state, relations.CHANGE_CREDENTIALS_TASK_STATE.CHANGING)
self.assertEqual(Message.objects.all().count(), 1)
示例8: test_change_hero
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_change_hero(self):
self.assertEqual(PostponedTask.objects.all().count(), 0)
response = self.client.post(url('game:heroes:change-hero', self.hero.id), self.get_post_data())
self.assertEqual(PostponedTask.objects.all().count(), 1)
task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, task.status_url)
self.assertEqual(task.internal_logic.name, names.generator.get_test_name(name=u'новое имя'))
self.assertEqual(task.internal_logic.gender, GENDER.MASCULINE)
self.assertEqual(task.internal_logic.race, RACE.DWARF)
示例9: test_fast_profile_confirm_email
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_fast_profile_confirm_email(self):
self.client.post(reverse('accounts:registration:fast'))
PostponedTaskPrototype(model=PostponedTask.objects.all()[0]).process(FakeLogger())
self.client.post(reverse('accounts:profile:update'), {'email': '[email protected]', 'nick': 'test_nick', 'password': '123456'})
self.assertEqual(Message.objects.all().count(), 1)
uuid = ChangeCredentialsTask.objects.all()[0].uuid
response = self.client.get(reverse('accounts:profile:confirm-email')+'?uuid='+uuid)
self.check_response_redirect(response, PostponedTaskPrototype._db_get_object(1).wait_url)
self.assertEqual(ChangeCredentialsTask.objects.all().count(), 1)
self.assertEqual(ChangeCredentialsTask.objects.all()[0].state, relations.CHANGE_CREDENTIALS_TASK_STATE.CHANGING)
self.assertEqual(django_authenticate(nick='test_nick', password='123456'), None)
示例10: test_success
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_success(self):
old_nick = self.account_1.nick
response = self.client.post(reverse('accounts:reset-nick', args=[self.account_1.id]))
postponed_task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, reverse('postponed-tasks:status', args=[postponed_task.id]))
task = ChangeCredentialsTaskPrototype._db_get_object(0)
self.assertFalse(task.relogin_required)
self.assertEqual(self.account_1.id, task.account.id)
self.assertNotEqual(self.account_1.nick, task.new_nick)
self.assertEqual(old_nick, AccountPrototype.get_by_id(self.account_1.id).nick)
示例11: test_success
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_success(self):
self.pvp_create_battle(self.account_1, self.account_2, BATTLE_1X1_STATE.PROCESSING)
response = self.client.post(reverse('game:pvp:say'), {'text': u'some text'})
task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, task.status_url)
示例12: test_activate_ability
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_activate_ability(self):
self.request_login('[email protected]')
response = self.client.post(use_ability_url(ABILITY_TYPE.HELP))
task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, task.status_url)
示例13: test_choose_ability_request_ok
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_choose_ability_request_ok(self):
self.request_login('[email protected]')
response = self.client.post(reverse('game:heroes:choose-ability', args=[self.hero.id]) + '?ability_id=' + self.get_new_ability_id())
task = PostponedTaskPrototype._db_get_object(0)
self.check_ajax_processing(response, task.status_url)
示例14: test_success
# 需要导入模块: from the_tale.common.postponed_tasks import PostponedTaskPrototype [as 别名]
# 或者: from the_tale.common.postponed_tasks.PostponedTaskPrototype import _db_get_object [as 别名]
def test_success(self):
response = self.client.post(url('shop:buy', purchase=self.purchase.uid))
self.check_ajax_processing(response, PostponedTaskPrototype._db_get_object(0).status_url)