def get_processed_member(self, member): processed_member = ProcessedMember(member) self.enrich_member_with_history( processed_member, self.member_history['members'][processed_member.tag]) self.calc_special_status(processed_member) self.calc_derived_member_stats(processed_member) return processed_member
def test_war_score(tmpdir): config_file = tmpdir.mkdir('test_war_score').join('testfile') config_file.write(__config_file_score__) config = load_config_file(config_file.realpath()) calc = ScoreCalculator(config) war_complete = ProcessedCurrentWar(config=config, current_war=__fake_current_war__) war_complete.status = 'na' war_complete.battles_played = 1 war_complete.wins = 1 war_complete.collection_day_battles_played = 3 war_complete.collection_battle_wins = 2 war_complete.collection_battle_losses = 0 assert calc.get_war_score(war_complete) == 24 war_incomplete = ProcessedCurrentWar(config=config, current_war=__fake_current_war__) war_incomplete.status = 'na' war_incomplete.battles_played = 0 war_incomplete.wins = 0 war_incomplete.collection_day_battles_played = 3 war_incomplete.collection_battle_wins = 2 war_incomplete.collection_battle_losses = 0 assert calc.get_war_score(war_incomplete) == -26 war_na = WarParticipation(config=config, member=ProcessedMember(__fake_member_list__[4]), war=__fake_war__) assert calc.get_war_score(war_na) == -1 war_new = WarParticipation(config=config, member=ProcessedMember(__fake_member_list__[4]), war=__fake_war__) war_new.status = 'not-in-clan' assert calc.get_war_score(war_new) == 0