本文整理汇总了Python中the_tale.accounts.prototypes.AccountPrototype._db_all方法的典型用法代码示例。如果您正苦于以下问题:Python AccountPrototype._db_all方法的具体用法?Python AccountPrototype._db_all怎么用?Python AccountPrototype._db_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.accounts.prototypes.AccountPrototype
的用法示例。
在下文中一共展示了AccountPrototype._db_all方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def setUp(self):
super(RandomPremiumRequestPrototypeTests, self).setUp()
create_test_map()
self.account_1 = self.accounts_factory.create_account()
self.account_2 = self.accounts_factory.create_account()
AccountPrototype._db_all().update(created_at=datetime.datetime.now() - accounts_settings.RANDOM_PREMIUM_CREATED_AT_BARRIER)
self.request = RandomPremiumRequestPrototype.create(self.account_1.id, days=30)
示例2: test_run_random_premium_requests_processing__has_requests_can_process
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_run_random_premium_requests_processing__has_requests_can_process(self):
account_2 = self.accounts_factory.create_account()
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1),
created_at=datetime.datetime.now() - accounts_settings.RANDOM_PREMIUM_CREATED_AT_BARRIER)
request = RandomPremiumRequestPrototype.create(self.account.id, days=30)
self.worker.run_random_premium_requests_processing()
request.reload()
self.assertTrue(request.state.is_PROCESSED)
self.assertEqual(request.receiver_id, account_2.id)
示例3: setUp
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def setUp(self):
super(RandomPremiumRequestPrototypeTests, self).setUp()
create_test_map()
result, account_id, bundle_id = register_user('test_user_1', '[email protected]', '111111')
self.account_1 = AccountPrototype.get_by_id(account_id)
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
self.account_2 = AccountPrototype.get_by_id(account_id)
AccountPrototype._db_all().update(created_at=datetime.datetime.now() - accounts_settings.RANDOM_PREMIUM_CREATED_AT_BARRIER)
self.request = RandomPremiumRequestPrototype.create(self.account_1.id, days=30)
示例4: test_run_random_premium_requests_processing__has_requests_can_process
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_run_random_premium_requests_processing__has_requests_can_process(self):
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
account_2 = AccountPrototype.get_by_id(account_id)
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1),
created_at=datetime.datetime.now() - accounts_settings.RANDOM_PREMIUM_CREATED_AT_BARRIER)
request = RandomPremiumRequestPrototype.create(self.account.id, days=30)
self.worker.run_random_premium_requests_processing()
request.reload()
self.assertTrue(request.state.is_PROCESSED)
self.assertEqual(request.receiver_id, account_2.id)
示例5: test_process__has_active_accounts
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [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)
示例6: get_achievements_source_iterator
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def get_achievements_source_iterator(self, achievement):
from the_tale.accounts.prototypes import AccountPrototype
if achievement.type.source.is_ACCOUNT:
return (AccountPrototype(model=account_model) for account_model in AccountPrototype._db_all())
if achievement.type.source.is_GAME_OBJECT:
return (heroes_logic.load_hero(hero_model=hero_model) for hero_model in heroes_models.Hero.objects.all().iterator())
示例7: get_achievements_source_iterator
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def get_achievements_source_iterator(self, achievement):
from the_tale.accounts.prototypes import AccountPrototype
from the_tale.game.heroes.prototypes import HeroPrototype
if achievement.type.source.is_ACCOUNT:
return (AccountPrototype(model=account_model) for account_model in AccountPrototype._db_all())
if achievement.type.source.is_GAME_OBJECT:
return (HeroPrototype(model=hero_model) for hero_model in HeroPrototype._db_all())
示例8: test_process__has_only_new_active_accounts
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_process__has_only_new_active_accounts(self):
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1),
created_at=datetime.datetime.now())
self.request.process()
self.check_not_processed()
示例9: test_process__only_active_initiator
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_process__only_active_initiator(self):
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1))
self.account_2.remove()
self.request.process()
self.check_not_processed()
示例10: test_process__only_premium_accounts
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_process__only_premium_accounts(self):
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1),
premium_end_at=datetime.datetime.now() + datetime.timedelta(days=1))
self.request.process()
self.check_not_processed(premiums=2)
示例11: test_process__only_fast_accounts
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_process__only_fast_accounts(self):
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now() + datetime.timedelta(days=1), is_fast=True)
self.request.process()
self.check_not_processed()
示例12: test_process__no_active_accounts
# 需要导入模块: from the_tale.accounts.prototypes import AccountPrototype [as 别名]
# 或者: from the_tale.accounts.prototypes.AccountPrototype import _db_all [as 别名]
def test_process__no_active_accounts(self):
AccountPrototype._db_all().update(active_end_at=datetime.datetime.now())
self.request.process()
self.check_not_processed()