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

        create_test_map()

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

        self.storage = LogicStorage()
        self.storage.load_account_data(AccountPrototype.get_by_id(account_id))
        self.hero = self.storage.accounts_to_heroes[account_id]
        self.action_idl = self.hero.actions.current_action

        self.action_trade = ActionTradingPrototype.create(hero=self.hero)
Exemplo n.º 2
0
    def setUp(self):
        super(TradingActionTest, self).setUp()

        create_test_map()

        account = self.accounts_factory.create_account(is_fast=True)

        self.storage = LogicStorage()
        self.storage.load_account_data(account)
        self.hero = self.storage.accounts_to_heroes[account.id]
        self.action_idl = self.hero.actions.current_action

        self.action_trade = ActionTradingPrototype.create(hero=self.hero)
Exemplo n.º 3
0
    def setUp(self):
        super(TradingActionTest, self).setUp()

        create_test_map()

        account = self.accounts_factory.create_account(is_fast=True)

        self.storage = LogicStorage()
        self.storage.load_account_data(account)
        self.hero = self.storage.accounts_to_heroes[account.id]
        self.action_idl = self.hero.actions.current_action

        self.action_trade = ActionTradingPrototype.create(hero=self.hero)
Exemplo n.º 4
0
    def test_use_when_trading(self):
        from the_tale.game.actions.prototypes import ActionTradingPrototype

        action_idl = self.hero.actions.current_action
        action_trade = ActionTradingPrototype.create(hero=self.hero)

        self.test_use()

        self.assertTrue(action_trade.replane_required)

        self.storage.process_turn(continue_steps_if_needed=False)

        self.assertEqual(self.hero.actions.current_action, action_idl)
Exemplo n.º 5
0
    def setUp(self):
        super(TradingActionTest, self).setUp()

        create_test_map()

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

        self.storage = LogicStorage()
        self.storage.load_account_data(AccountPrototype.get_by_id(account_id))
        self.hero = self.storage.accounts_to_heroes[account_id]
        self.action_idl = self.hero.actions.current_action

        self.action_trade = ActionTradingPrototype.create(hero=self.hero)
Exemplo n.º 6
0
    def test_use_when_trading(self):
        from the_tale.game.actions.prototypes import ActionTradingPrototype

        action_idl = self.hero.actions.current_action
        action_trade = ActionTradingPrototype.create(hero=self.hero)

        self.test_use()

        self.assertTrue(action_trade.replane_required)

        self.storage.process_turn(continue_steps_if_needed=False)

        self.assertEqual(self.hero.actions.current_action, action_idl)
Exemplo n.º 7
0
    def test_use_when_trading(self):
        from the_tale.game.actions.prototypes import ActionTradingPrototype

        action_idl = self.hero.actions.current_action
        action_trade = ActionTradingPrototype.create(hero=self.hero)

        result, step, postsave_actions = self.card.use(**self.use_attributes(storage=self.storage, hero=self.hero))
        self.assertEqual((result, step, postsave_actions), (ComplexChangeTask.RESULT.SUCCESSED, ComplexChangeTask.STEP.SUCCESS, ()))

        self.assertEqual(self.hero.bag.occupation, 1)

        self.assertTrue(action_trade.replane_required)

        self.storage.process_turn(continue_steps_if_needed=False)

        self.assertEqual(self.hero.actions.current_action, action_idl)

        self.assertEqual(self.hero.bag.occupation, 1)
Exemplo n.º 8
0
    def test_use_when_trading(self):
        from the_tale.game.actions.prototypes import ActionTradingPrototype

        action_idl = self.hero.actions.current_action
        action_trade = ActionTradingPrototype.create(hero=self.hero)

        result, step, postsave_actions = self.card.use(
            **self.use_attributes(storage=self.storage, hero=self.hero))
        self.assertEqual((result, step, postsave_actions),
                         (ComplexChangeTask.RESULT.SUCCESSED,
                          ComplexChangeTask.STEP.SUCCESS, ()))

        self.assertEqual(self.hero.bag.occupation, 1)

        self.assertTrue(action_trade.replane_required)

        self.storage.process_turn(continue_steps_if_needed=False)

        self.assertEqual(self.hero.actions.current_action, action_idl)

        self.assertEqual(self.hero.bag.occupation, 1)