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)
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)
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)
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)
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)