def test_reward_type(self): wifi = Reward(MOCK_REWARD_WIFI['name'], MOCK_REWARD_WIFI['type'], MOCK_REWARD_WIFI['stats'], MOCK_REWARD_WIFI['materials'], MOCK_REWARD_WIFI['rewards']) reward_list = RewardList() reward_list.add_pending_reward(wifi) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS))), 1) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS), team='RD')), 1) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS), team='Exploration')), 0)
def test_material_requirements(self): wifi = Reward(MOCK_REWARD_WIFI['name'], MOCK_REWARD_WIFI['type'], MOCK_REWARD_WIFI['stats'], 1, MOCK_REWARD_WIFI['rewards']) reward_list = RewardList() reward_list.add_pending_reward(wifi) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS))), 0) wifi2 = Reward('test', MOCK_REWARD_WIFI['type'], MOCK_REWARD_WIFI['stats'], MOCK_REWARD_WIFI['materials'], MOCK_REWARD_WIFI['rewards']) reward_list.add_pending_reward(wifi2) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS))), 1)
def test_sorting_rewards_by_stat_priority(self): team_stats = Stats({'Artifact': 2, 'Memento': 4}) reward_list = RewardList() reward_list.add_pending_reward(REWARD_WIFI) reward_list.add_pending_reward(REWARD_TABLET1) reward_list.add_pending_reward(REWARD_WINE) reward_list.add_pending_reward(REWARD_TABLET2) self.assertEqual(reward_list.list_reward_names(), ['WiFi', 'Tablet1', 'Wine', 'Tablet2']) reward_list.sort_rewards_by_type(team_stats.list_stats()) self.assertEqual(reward_list.list_reward_names(), ['Tablet1', 'Tablet2', 'Wine', 'WiFi'])
def test_reward_requirement(self): wifi = Reward(MOCK_REWARD_WIFI['name'], MOCK_REWARD_WIFI['type'], MOCK_REWARD_WIFI['stats'], MOCK_REWARD_WIFI['materials'], MOCK_REWARD_WIFI['rewards']) satellite = Reward(MOCK_REWARD_SATELLITE['name'], MOCK_REWARD_SATELLITE['type'], MOCK_REWARD_SATELLITE['stats'], MOCK_REWARD_SATELLITE['materials'], MOCK_REWARD_SATELLITE['rewards']) reward_list = RewardList() reward_list.add_pending_reward(wifi) reward_list.add_pending_reward(satellite) self.assertEqual(len(reward_list.pending_rewards), 2) self.assertEqual(len(reward_list.obtained_rewards), 0) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS))), 1) reward_list.obtain_reward(MOCK_REWARD_WIFI['name']) self.assertEqual(len(reward_list.pending_rewards), 1) self.assertEqual(len(reward_list.obtained_rewards), 1) self.assertEqual(len(reward_list.possible_rewards(stats=Stats(MAXED_STATS))), 1)
def test_get_reward_choices(self): team_stats = Stats({'Tech': 6, 'Contract': 6}) reward_list = RewardList() reward_list.add_pending_reward(REWARD_WIFI) choices = reward_list.get_reward_choices(team_stats, material=0) self.assertEqual(choices, [('Connect the hotel to the internet.', 'WiFi'), ('Ignore and keep researching.', 'none')])