Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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.account_2 = self.accounts_factory.create_account()
        self.goods_2 = logic.load_goods(self.account_2.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.hero_2 = self.logic_storage.load_account_data(self.account_2)

        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.invoice = bank_prototypes.InvoicePrototype.create(
            recipient_type=bank_relations.ENTITY_TYPE.GAME_ACCOUNT,
            recipient_id=self.account_1.id,
            sender_type=bank_relations.ENTITY_TYPE.GAME_ACCOUNT,
            sender_id=self.account_2.id,
            currency=bank_relations.CURRENCY_TYPE.PREMIUM,
            amount=self.price,
            description_for_sender='transaction-description-for_sender',
            description_for_recipient='transaction-description-for-recipient',
            operation_uid='transaction-operation-ui')

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

        self.task = postponed_tasks.BuyLotTask(seller_id=self.account_1.id,
                                               buyer_id=self.account_2.id,
                                               lot_id=self.lot_1.id,
                                               transaction=self.transaction)

        self.main_task = mock.Mock(comment=None, id=777)