예제 #1
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)

        pm_logic.debug_clear_service()
예제 #2
0
    def setUp(self):
        super(AccountPrototypeTests, self).setUp()
        self.place_1, self.place_2, self.place_3 = create_test_map()
        self.account = self.accounts_factory.create_account()
        self.fast_account = self.accounts_factory.create_account(is_fast=True)

        pm_logic.debug_clear_service()
예제 #3
0
    def setUp(self):
        super(DayStartedSignalTests, self).setUp()

        create_test_map()

        self.account = self.accounts_factory.create_account()

        pm_logic.debug_clear_service()
예제 #4
0
    def setUp(self):
        super(FriendshipPrototypeTests, 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()

        pm_logic.debug_clear_service()
예제 #5
0
    def setUp(self):
        super(AchievementPrototypeTests, self).setUp()

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

        pm_logic.debug_clear_service()
예제 #6
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)

        pm_logic.debug_clear_service()
예제 #7
0
    def setUp(self):
        super(AchievementsManagerTests, self).setUp()

        create_test_map()

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

        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='achievement_1',
            description='description_1',
            approved=True)
        self.achievement_2 = AchievementPrototype.create(
            group=ACHIEVEMENT_GROUP.MONEY,
            type=ACHIEVEMENT_TYPE.MONEY,
            barrier=5,
            points=10,
            caption='achievement_2',
            description='description_2',
            approved=False)
        self.achievement_3 = AchievementPrototype.create(
            group=ACHIEVEMENT_GROUP.TIME,
            type=ACHIEVEMENT_TYPE.DEATHS,
            barrier=4,
            points=10,
            caption='achievement_3',
            description='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()

        pm_logic.debug_clear_service()
예제 #8
0
    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)

        pm_logic.debug_clear_service()
    def setUp(self):
        super(TransferMoneyTaskTests, self).setUp()
        create_test_map()

        self.sender = self.accounts_factory.create_account()
        self.recipient = self.accounts_factory.create_account()

        self.task = postponed_tasks.TransferMoneyTask(
            sender_id=self.sender.id,
            recipient_id=self.recipient.id,
            amount=666,
            commission=13,
            comment='some comment string')

        self.main_task = mock.Mock(id=777)

        pm_logic.debug_clear_service()