Пример #1
0
    def test_result(self):
        raid = self.raid

        with self.assertRaises(KeyError):
            return raid.get_result('unknown')

        boss_id = raid.create(10, 10)

        histories, ranking, assisted = raid.get_result(boss_id)
        self.assertEqual(histories, [])
        self.assertEqual(ranking, [])
        self.assertEqual(assisted, [])

        expr_histories = [('attacker1', 2, 8, None)]
        result, damage, current = raid.attack(boss_id, 'attacker1', 2)

        histories, ranking, assisted = raid.get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker1', 2)])
        self.assertEqual(assisted, ['attacker1'])

        args = ('spam', 'ham', 'egg')
        expr_histories.append(('attacker1', 2, 6, args))
        result, damage, current = raid.attack(boss_id, 'attacker1', 2, args)

        histories, ranking, assisted = raid.get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker1', 4)])
        self.assertEqual(assisted, ['attacker1'])

        expr_histories.append(('attacker2', 2, 4, None))
        result, damage, current = raid.attack(boss_id, 'attacker2', 2)

        histories, ranking, assisted = raid.get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker1', 4), ('attacker2', 2)])
        self.assertEqual(assisted, ['attacker1', 'attacker2'])

        expr_histories.append(('attacker2', 4, 0, None))
        result, damage, current = raid.attack(boss_id, 'attacker2', 4)

        histories, ranking, assisted = raid.get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker2', 6), ('attacker1', 4)])
        self.assertEqual(assisted, ['attacker2', 'attacker1'])

        result, damage, current = raid.attack(boss_id, 'attacker1', 999)

        histories, ranking, assisted = raid.get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker2', 6), ('attacker1', 4)])
        self.assertEqual(assisted, ['attacker2', 'attacker1'])

        histories, ranking, assisted = raid.get_result(boss_id, 60)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker2', 6), ('attacker1', 4)])
        self.assertEqual(assisted, ['attacker2'])
Пример #2
0
    def test_result(self):
        boss_id = create(10, 10)

        histories, ranking, assisted = get_result(boss_id)
        self.assertEqual(histories, [])
        self.assertEqual(ranking, [])
        self.assertEqual(assisted, [])

        expr_histories = [('attacker1', 2, 8, None)]
        result, damage, current = attack(boss_id, 'attacker1', 2)

        histories, ranking, assisted = get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker1', 2)])
        self.assertEqual(assisted, ['attacker1'])
Пример #3
0
    def test_result(self):
        boss_id = create(10, 10)

        histories, ranking, assisted = get_result(boss_id)
        self.assertEqual(histories, [])
        self.assertEqual(ranking, [])
        self.assertEqual(assisted, [])

        expr_histories = [('attacker1', 2, 8, None)]
        result, damage, current = attack(boss_id, 'attacker1', 2)

        histories, ranking, assisted = get_result(boss_id)
        self.assertEqual(trim_datetime(histories), expr_histories)
        self.assertEqual(ranking, [('attacker1', 2)])
        self.assertEqual(assisted, ['attacker1'])