Exemplo n.º 1
0
    def setUp(self):
        super().setUp()

        tt_api.debug_clear_service()
        cards_tt_api.debug_clear_service()

        self.cards = [
            cards.CARD.LEVEL_UP.effect.create_card(available_for_auction=True,
                                                   type=cards.CARD.LEVEL_UP),
            cards.CARD.LEVEL_UP.effect.create_card(available_for_auction=True,
                                                   type=cards.CARD.LEVEL_UP),
            cards.CARD.ADD_GOLD_COMMON.effect.create_card(
                available_for_auction=True, type=cards.CARD.ADD_GOLD_COMMON)
        ]

        cards_tt_api.change_cards(self.account.id,
                                  operation_type='#test',
                                  to_add=self.cards)

        self.post_ajax_json(logic.create_sell_lot_url(), {
            'card': [self.cards[0].uid, self.cards[2].uid],
            'price': 100
        })
        self.post_ajax_json(logic.create_sell_lot_url(), {
            'card': [self.cards[1].uid],
            'price': 100500
        })
Exemplo n.º 2
0
    def setUp(self):
        super(BuyMarketLotPosponedTaskTests, self).setUp()

        self.seller_account = self.accounts_factory.create_account()

        tt_api.debug_clear_service()
        cards_tt_api.debug_clear_service()

        self.card = cards.CARD.LEVEL_UP.effect.create_card(
            available_for_auction=True, type=cards.CARD.LEVEL_UP)

        cards_tt_api.change_cards(accounts_logic.get_system_user_id(),
                                  operation_type='#test',
                                  to_add=[self.card])

        self.lot = objects.Lot(owner_id=self.seller_account.id,
                               full_type=self.card.item_full_type,
                               item_id=self.card.uid,
                               price=self.amount)

        tt_api.place_sell_lots([self.lot])

        self.task = logic.close_lot(item_type=self.lot.full_type,
                                    price=self.amount,
                                    buyer_id=self.account.id)
        self.invoice = bank_prototypes.InvoicePrototype.get_by_id(
            self.task.transaction.invoice_id)

        self.market_basic_information = tt_api.info()

        self.cmd_update_with_account_data__call_count = 0  # no need in updating hero state
        self.with_referrals = False  # no money for referrals

        pm_tt_api.debug_clear_service()
Exemplo n.º 3
0
    def setUp(self):
        super(CreateSellLotTests, self).setUp()

        tt_api.debug_clear_service()
        cards_tt_api.debug_clear_service()

        self.cards = [cards.CARD.LEVEL_UP.effect.create_card(available_for_auction=True, type=cards.CARD.LEVEL_UP),
                      cards.CARD.ADD_GOLD_COMMON.effect.create_card(available_for_auction=True, type=cards.CARD.ADD_GOLD_COMMON)]

        cards_tt_api.change_cards(self.account.id, operation_type='#test', to_add=self.cards)
Exemplo n.º 4
0
    def setUp(self):
        super(CloseSellLotTests, self).setUp()

        tt_api.debug_clear_service()
        cards_tt_api.debug_clear_service()

        self.card = cards.CARD.LEVEL_UP.effect.create_card(available_for_auction=True, type=cards.CARD.LEVEL_UP)

        self.bank_account = bank_prototypes.AccountPrototype.create(entity_type=bank_relations.ENTITY_TYPE.GAME_ACCOUNT,
                                                                    entity_id=self.account.id,
                                                                    currency=bank_relations.CURRENCY_TYPE.PREMIUM)
        self.bank_account.amount = 1000
        self.bank_account.save()
Exemplo n.º 5
0
    def setUp(self):
        super(CancelSellLotTests, self).setUp()

        tt_api.debug_clear_service()
        cards_tt_api.debug_clear_service()

        self.card = cards.CARD.LEVEL_UP.effect.create_card(available_for_auction=True, type=cards.CARD.LEVEL_UP)

        self.item_info = objects.ItemTypeSummary(full_type=self.card.item_full_type,
                                                 sell_number=1,
                                                 min_sell_price=100,
                                                 max_sell_price=100)

        cards_tt_api.change_cards(self.account.id, operation_type='#test', to_add=[self.card])

        response = self.post_ajax_json(logic.create_sell_lot_url(), {'card': [self.card.uid], 'price': 100})
        self.check_ajax_ok(response)
Exemplo n.º 6
0
    def setUp(self):
        super(GiveRewardForTemplateTests, self).setUp()

        create_test_map()

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

        cards_tt_api.debug_clear_service()
        pm_tt_api.debug_clear_service()

        logic.sync_static_restrictions()

        storage.game_dictionary.refresh()
        storage.game_lexicon.refresh()

        TEXT = '[hero|загл] [level] [дубль|hero|дт]'
        utg_template = utg_templates.Template()
        utg_template.parse(TEXT, externals=['hero', 'level'])

        self.template_1 = prototypes.TemplatePrototype.create(
            key=keys.LEXICON_KEY.random(),
            raw_template=TEXT,
            utg_template=utg_template,
            verificators=[],
            author=None,
            state=relations.TEMPLATE_STATE.REMOVED)

        self.template_2 = prototypes.TemplatePrototype.create(
            key=keys.LEXICON_KEY.random(),
            raw_template=TEXT,
            utg_template=utg_template,
            verificators=[],
            author=self.account_2,
            state=relations.TEMPLATE_STATE.REMOVED)

        prototypes.ContributionPrototype.create(
            type=relations.CONTRIBUTION_TYPE.TEMPLATE,
            account_id=self.account_2.id,
            entity_id=self.template_2.id,
            source=relations.CONTRIBUTION_SOURCE.PLAYER,
            state=relations.CONTRIBUTION_STATE.IN_GAME)

        self.template_3 = prototypes.TemplatePrototype.create(
            key=keys.LEXICON_KEY.random(),
            raw_template=TEXT,
            utg_template=utg_template,
            verificators=[],
            author=self.account_3,
            state=relations.TEMPLATE_STATE.REMOVED)

        prototypes.ContributionPrototype.create(
            type=relations.CONTRIBUTION_TYPE.TEMPLATE,
            account_id=self.account_3.id,
            entity_id=self.template_3.id,
            source=relations.CONTRIBUTION_SOURCE.PLAYER,
            state=relations.CONTRIBUTION_STATE.IN_GAME)

        self.non_author_contribution = prototypes.ContributionPrototype.create(
            type=relations.CONTRIBUTION_TYPE.TEMPLATE,
            account_id=self.account_4.id,
            entity_id=self.template_2.id,
            source=relations.CONTRIBUTION_SOURCE.PLAYER,
            state=relations.CONTRIBUTION_STATE.IN_GAME)