Beispiel #1
0
    def test_score_kill(self):
        """
        score_kill should give points to the player that killed
        should take out one point if the player died from <world>
        should increase the count of total kills
        should increase the kill count of that death cause
        """
        death_causes = [{
            'death_cause': 0
        }, {
            'death_cause': 0
        }, {
            'death_cause': 0
        }]

        active_players_mock = {
            '2': ['Fulano', 5],
            '6': ['Deltrano', 1],
            '12': ['Jack', 0]
        }

        parser = Parser()
        parser.death_causes = death_causes
        parser.active_players = active_players_mock
        parser.game_info['total_kills'] = 6

        # World kill
        parser.score_kill('1022 2 0: something something')
        assert parser.game_info['total_kills'] == 7
        assert parser.active_players['2'][1] == 4
        assert parser.death_causes[0]['death_cause'] == 1

        # Player kill
        parser.score_kill('6 12 2: something something')
        assert parser.game_info['total_kills'] == 8
        assert parser.active_players['6'][1] == 2
        assert parser.death_causes[2]['death_cause'] == 1