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


Python logic.create_test_map函数代码示例

本文整理汇总了Python中the_tale.game.logic.create_test_map函数的典型用法代码示例。如果您正苦于以下问题:Python create_test_map函数的具体用法?Python create_test_map怎么用?Python create_test_map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

    def setUp(self):
        super(LogicTests, self).setUp()
        create_test_map()

        result, account_id, bundle_id = register_user('test_user')

        self.account_id = account_id
开发者ID:ruckysolis,项目名称:the-tale,代码行数:7,代码来源:test_logic.py

示例2: setUp

    def setUp(self):
        super(MobsStorageTests, self).setUp()
        create_test_map()

        self.mob_1, self.mob_2, self.mob_3 = mobs_storage.all()

        self.mob_1.type = MOB_TYPE.CIVILIZED
        self.mob_1.save()

        self.mob_2.type = MOB_TYPE.BARBARIAN
        self.mob_2.save()

        self.mob_3.type = MOB_TYPE.CIVILIZED
        self.mob_3.save()

        self.bandit = MobRecordPrototype.create(uuid='bandit',
                                                level=1,
                                                utg_name=names.generator.get_test_name(name='bandint'),
                                                description='description',
                                                abilities=['hit'],
                                                terrains=[TERRAIN.PLANE_SAND],
                                                type=MOB_TYPE.CIVILIZED,
                                                state=MOB_RECORD_STATE.ENABLED)
        self.bandint_wrong = MobRecordPrototype.create(uuid='bandit_wrong',
                                                       level=1,
                                                       utg_name=names.generator.get_test_name(name='bandit_wrong'),
                                                       description='bandit_wrong description',
                                                       abilities=['hit'],
                                                       terrains=[TERRAIN.PLANE_SAND],
                                                       type=MOB_TYPE.CIVILIZED,
                                                       state=MOB_RECORD_STATE.DISABLED)
开发者ID:Alkalit,项目名称:the-tale,代码行数:31,代码来源:test_storage.py

示例3: setUp

    def setUp(self):
        super(MetaProxyActionForArenaPvP1x1Tests, self).setUp()

        create_test_map()

        self.account_1 = self.accounts_factory.create_account()
        self.account_2 = self.accounts_factory.create_account()

        self.storage = LogicStorage()
        self.storage.load_account_data(AccountPrototype.get_by_id(self.account_1.id))
        self.storage.load_account_data(AccountPrototype.get_by_id(self.account_2.id))

        self.hero_1 = self.storage.accounts_to_heroes[self.account_1.id]
        self.hero_2 = self.storage.accounts_to_heroes[self.account_2.id]

        self.action_idl_1 = self.hero_1.actions.current_action
        self.action_idl_2 = self.hero_2.actions.current_action

        self.pvp_create_battle(self.account_1, self.account_2, BATTLE_1X1_STATE.PROCESSING)
        self.pvp_create_battle(self.account_2, self.account_1, BATTLE_1X1_STATE.PROCESSING)

        self.bundle_id = 666

        meta_action_battle = meta_actions.ArenaPvP1x1.create(self.storage, self.hero_1, self.hero_2)

        self.action_proxy_1 = ActionMetaProxyPrototype.create(hero=self.hero_1, _bundle_id=self.bundle_id, meta_action=meta_action_battle)
        self.action_proxy_2 = ActionMetaProxyPrototype.create(hero=self.hero_2, _bundle_id=self.bundle_id, meta_action=meta_action_battle)

        self.storage.merge_bundles([self.action_idl_1.bundle_id, self.action_idl_2.bundle_id], self.bundle_id)

        self.meta_action_battle = self.storage.meta_actions.values()[0]
开发者ID:alexudracul,项目名称:the-tale,代码行数:31,代码来源:test_action_meta_proxy.py

示例4: setUp

    def setUp(self):
        super(MetaProxyActionForArenaPvP1x1Tests, self).setUp()

        create_test_map()

        result, account_1_id, bundle_id = register_user('test_user_1', '[email protected]', '111111')
        result, account_2_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')

        self.account_1 = AccountPrototype.get_by_id(account_1_id)
        self.account_2 = AccountPrototype.get_by_id(account_2_id)

        self.storage = LogicStorage()
        self.storage.load_account_data(AccountPrototype.get_by_id(self.account_1.id))
        self.storage.load_account_data(AccountPrototype.get_by_id(self.account_2.id))

        self.hero_1 = self.storage.accounts_to_heroes[account_1_id]
        self.hero_2 = self.storage.accounts_to_heroes[account_2_id]

        self.action_idl_1 = self.hero_1.actions.current_action
        self.action_idl_2 = self.hero_2.actions.current_action

        self.pvp_create_battle(self.account_1, self.account_2, BATTLE_1X1_STATE.PROCESSING)
        self.pvp_create_battle(self.account_2, self.account_1, BATTLE_1X1_STATE.PROCESSING)

        self.bundle_id = 666

        meta_action_battle = MetaActionArenaPvP1x1Prototype.create(self.storage, self.hero_1, self.hero_2, bundle_id=self.bundle_id)

        self.action_proxy_1 = ActionMetaProxyPrototype.create(hero=self.hero_1, _bundle_id=self.bundle_id, meta_action=meta_action_battle)
        self.action_proxy_2 = ActionMetaProxyPrototype.create(hero=self.hero_2, _bundle_id=self.bundle_id, meta_action=meta_action_battle)

        self.storage.merge_bundles([self.action_idl_1.bundle_id, self.action_idl_2.bundle_id], self.bundle_id)

        self.meta_action_battle = self.storage.meta_actions.values()[0]
开发者ID:Alkalit,项目名称:the-tale,代码行数:34,代码来源:test_action_meta_proxy.py

示例5: setUp

    def setUp(self):
        super(TaskTests, self).setUp()

        create_test_map()

        goods_types.test_hero_good._clear()

        self.good_1_uid = 'good-1'

        self.account_1 = self.accounts_factory.create_account()
        self.goods_1 = logic.load_goods(self.account_1.id)

        self.good_1 = goods_types.test_hero_good.create_good(self.good_1_uid)

        self.goods_1.add_good(self.good_1)
        logic.save_goods(self.goods_1)

        self.logic_storage = logic_storage.LogicStorage()
        self.hero_1 = self.logic_storage.load_account_data(self.account_1)

        self.price = 666

        self.lot_1 = logic.reserve_lot(self.account_1.id, self.good_1, price=self.price)
        self.lot_1.state = relations.LOT_STATE.ACTIVE
        logic.save_lot(self.lot_1)

        self.task = postponed_tasks.CloseLotByTimoutTask(lot_id=self.lot_1.id)

        self.main_task = mock.Mock(comment=None, id=777)
开发者ID:Alkalit,项目名称:the-tale,代码行数:29,代码来源:test_close_lot_by_timeout_task.py

示例6: setUp

    def setUp(self):
        super(TaskTests, self).setUp()

        create_test_map()

        self.good_1_uid = 'good-1'

        self.account_1 = self.accounts_factory.create_account()
        self.goods_1 = logic.load_goods(self.account_1.id)

        self.good_1 = goods_types.test_hero_good.create_good(self.good_1_uid)

        self.goods_1.add_good(self.good_1)
        logic.save_goods(self.goods_1)

        self.logic_storage = logic_storage.LogicStorage()
        self.logic_storage.load_account_data(self.account_1)

        self.price_1 = 666

        self.task = postponed_tasks.CreateLotTask(account_id=self.account_1.id,
                                                  good_type=goods_types.test_hero_good.uid,
                                                  good_uid=self.good_1_uid,
                                                  price=self.price_1)

        self.main_task = mock.Mock(comment=None, id=777)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:26,代码来源:test_create_lot_task.py

示例7: setUp

    def setUp(self):
        super(BaseTestRequests, self).setUp()
        create_test_map()

        self.fixture = ForumFixture()

        self.account = self.fixture.account_1
        self.account_2 = self.fixture.account_2

        self.request_login(self.account.email)

        # cat1
        # |-subcat1
        # | |-thread1
        # | | |-post1
        # | |-thread2
        # |-subcat2
        # cat2
        # | subcat3
        # | |- thread3
        # cat3

        self.cat1 = self.fixture.cat_1
        # to test, that subcat.id not correlate with order
        self.subcat2 = self.fixture.subcat_2
        self.subcat1 = self.fixture.subcat_1
        self.cat2 = self.fixture.cat_2
        self.subcat3 = self.fixture.subcat_3
        self.cat3 = self.fixture.cat_3

        self.thread1 = self.fixture.thread_1
        self.thread2 = self.fixture.thread_2
        self.thread3 = self.fixture.thread_3

        self.post1 = self.fixture.post_1
开发者ID:Alkalit,项目名称:the-tale,代码行数:35,代码来源:test_requests.py

示例8: setUp

    def setUp(self):
        super(ArenaPvP1x1Test, self).setUp()

        create_test_map()

        self.account_1 = self.accounts_factory.create_account()
        self.account_2 = self.accounts_factory.create_account()

        self.storage = LogicStorage()
        self.storage.load_account_data(self.account_1)
        self.storage.load_account_data(self.account_2)

        self.hero_1 = self.storage.accounts_to_heroes[self.account_1.id]
        self.hero_2 = self.storage.accounts_to_heroes[self.account_2.id]

        # for test data reset
        self.hero_1.health = self.hero_1.max_health / 2
        self.hero_1.pvp.set_advantage(1)
        self.hero_1.pvp.set_effectiveness(0.5)

        # for test data reset
        self.hero_2.pvp.set_advantage(1)
        self.hero_2.pvp.set_effectiveness(0.5)

        self.battle_1 = self.pvp_create_battle(self.account_1, self.account_2, BATTLE_1X1_STATE.PROCESSING)
        self.battle_1.calculate_rating = True
        self.battle_1.save()

        self.battle_2 = self.pvp_create_battle(self.account_2, self.account_1, BATTLE_1X1_STATE.PROCESSING)
        self.battle_2.calculate_rating = True
        self.battle_2.save()

        self.meta_action_battle = meta_actions.ArenaPvP1x1.create(self.storage, self.hero_1, self.hero_2)
        self.meta_action_battle.set_storage(self.storage)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:34,代码来源:test_meta_action_arena_pvp_1x1.py

示例9: setUp

    def setUp(self):
        super(_BaseRequestTests, 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)

        group_edit = sync_group('edit achievement', ['achievements.edit_achievement'])

        group_edit.user_set.add(self.account_2._model)

        self.achievement_1 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=0, points=10,
                                                         caption=u'achievement_1', description=u'description_1', approved=True)
        self.achievement_2 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=2, points=10,
                                                         caption=u'achievement_2', description=u'description_2', approved=False)
        self.achievement_3 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.TIME, type=ACHIEVEMENT_TYPE.TIME, barrier=3, points=10,
                                                         caption=u'achievement_3', description=u'description_3', approved=True)

        self.collection_1 = CollectionPrototype.create(caption=u'collection_1', description=u'description_1', approved=True)
        self.kit_1 = KitPrototype.create(collection=self.collection_1, caption=u'kit_1', description=u'description_1', approved=True)
        self.item_1_1 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_1', text=u'text_1_1', approved=True)
        self.item_1_2 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_2', text=u'text_1_2', approved=True)

        self.account_achievements_1 = AccountAchievementsPrototype.get_by_account_id(self.account_1.id)
        self.account_achievements_1.achievements.add_achievement(self.achievement_1)
        self.account_achievements_1.save()
开发者ID:Alkalit,项目名称:the-tale,代码行数:30,代码来源:test_requests.py

示例10: setUp

    def setUp(self):
        super(BaseRequestTests, 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)

        result, account_id, bundle_id = register_user('test_user_3', '[email protected]', '111111')
        self.account_3 = AccountPrototype.get_by_id(account_id)

        group_edit_item = sync_group('edit item', ['collections.edit_item'])
        group_moderate_item = sync_group('moderate item', ['collections.moderate_item'])

        group_edit = sync_group('edit kit', ['collections.edit_kit'])
        group_moderate = sync_group('moderate kit', ['collections.moderate_kit'])

        group_edit_item.user_set.add(self.account_2._model)
        group_moderate_item.user_set.add(self.account_3._model)

        group_edit.user_set.add(self.account_2._model)
        group_moderate.user_set.add(self.account_3._model)

        self.collection_1 = CollectionPrototype.create(caption=u'collection_1', description=u'description_1')
        self.collection_2 = CollectionPrototype.create(caption=u'collection_2', description=u'description_2')

        self.kit_1 = KitPrototype.create(collection=self.collection_1, caption=u'kit_1', description=u'description_1', approved=True)
        self.kit_2 = KitPrototype.create(collection=self.collection_1, caption=u'kit_2', description=u'description_2')

        self.item_1_1 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_1', text=u'text_1_1')
        self.item_1_2 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_2', text=u'text_1_2', approved=True)
开发者ID:Alkalit,项目名称:the-tale,代码行数:34,代码来源:test_request_kits.py

示例11: setUp

    def setUp(self):
        super(AchievementsManagerTests, 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)

        group_edit = sync_group('edit achievement', ['achievements.edit_achievement'])

        group_edit.user_set.add(self.account_2._model)

        self.achievement_1 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=0, points=10,
                                                         caption=u'achievement_1', description=u'description_1', approved=True)
        self.achievement_2 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=5, points=10,
                                                         caption=u'achievement_2', description=u'description_2', approved=False)
        self.achievement_3 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.TIME, type=ACHIEVEMENT_TYPE.DEATHS, barrier=4, points=10,
                                                         caption=u'achievement_3', description=u'description_3', approved=True)


        self.account_achievements_1 = AccountAchievementsPrototype.get_by_account_id(self.account_1.id)
        self.account_achievements_1.achievements.add_achievement(self.achievement_1)
        self.account_achievements_1.save()

        self.worker = environment.workers.achievements_manager
        self.worker.initialize()
开发者ID:Alkalit,项目名称:the-tale,代码行数:29,代码来源:test_achievements_manager.py

示例12: setUp

    def setUp(self):
        super(_BaseBuyPosponedTaskTests, self).setUp()

        create_test_map()

        self.initial_amount = 500
        self.amount = 130

        self.account = self.accounts_factory.create_account()

        self.bank_account = BankAccountPrototype.create(
            entity_type=ENTITY_TYPE.GAME_ACCOUNT, entity_id=self.account.id, currency=CURRENCY_TYPE.PREMIUM
        )
        self.bank_account.amount = self.initial_amount
        self.bank_account.save()

        self.invoice = InvoicePrototype.create(
            recipient_type=ENTITY_TYPE.GAME_ACCOUNT,
            recipient_id=self.account.id,
            sender_type=ENTITY_TYPE.GAME_LOGIC,
            sender_id=0,
            currency=CURRENCY_TYPE.PREMIUM,
            amount=-self.amount,
            description_for_sender="transaction-description-for-sender",
            description_for_recipient="transaction-description-for-recipient",
            operation_uid="transaction-operation-ui",
        )

        self.transaction = Transaction(self.invoice.id)

        self.task = None
        self.storage = None
        self.cmd_update_with_account_data__call_count = 1
        self.accounts_manages_worker = True
        self.supervisor_worker = False
开发者ID:Tiendil,项目名称:the-tale,代码行数:35,代码来源:base_buy_task.py

示例13: test_remove_contributions

    def test_remove_contributions(self):
        create_test_map()

        template = self.create_removed_template()

        contribution_1 = prototypes.ContributionPrototype.create(
            type=relations.CONTRIBUTION_TYPE.TEMPLATE,
            account_id=self.accounts_factory.create_account().id,
            entity_id=template.id,
            source=relations.CONTRIBUTION_SOURCE.PLAYER,
            state=relations.CONTRIBUTION_STATE.ON_REVIEW,
        )

        contribution_2 = prototypes.ContributionPrototype.create(
            type=relations.CONTRIBUTION_TYPE.TEMPLATE,
            account_id=self.accounts_factory.create_account().id,
            entity_id=template.id,
            source=relations.CONTRIBUTION_SOURCE.PLAYER,
            state=relations.CONTRIBUTION_STATE.IN_GAME,
        )

        with self.check_delta(prototypes.TemplatePrototype._db_count, -1):
            logic.full_remove_template(template)

        self.assertFalse(prototypes.ContributionPrototype._db_filter(id=contribution_1.id).exists())
        self.assertTrue(prototypes.ContributionPrototype._db_filter(id=contribution_2.id).exists())
开发者ID:Tiendil,项目名称:the-tale,代码行数:26,代码来源:test_logic.py

示例14: setUp

    def setUp(self):
        super(BaseRequestsTests, self).setUp()

        create_test_map()

        result, account_id, bundle_id = register_user('test_user1', '[email protected]', '111111')
        self.account_1 = AccountPrototype.get_by_id(account_id)
开发者ID:Alkalit,项目名称:the-tale,代码行数:7,代码来源:test_requests.py

示例15: setUp

    def setUp(self):
        super(RequestsTestsBase, self).setUp()

        create_test_map()

        self.account_1 = self.accounts_factory.create_account()
        self.account_2 = self.accounts_factory.create_account()
开发者ID:Alkalit,项目名称:the-tale,代码行数:7,代码来源:test_requests.py


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