Ejemplo n.º 1
0
    def test_chall_10_won(self):
        player = self._get_player()
        for i in range(1, 11):
            timestamp = datetime.now() + timedelta(days=-i)
            a = Activity.objects.create(timestamp=timestamp,
                    user_from=player, user_to=player, action='chall-won',
                    public=True)

        self.assertEqual(consecutive_chall_won(player), 10)
Ejemplo n.º 2
0
    def test_chall_10_won(self):
        player = self._get_player()
        for i in range(1, 11):
            timestamp = datetime.now() + timedelta(days=-i)
            a = Activity.objects.create(timestamp=timestamp,
                                        user_from=player,
                                        user_to=player,
                                        action='chall-won',
                                        public=True)

        self.assertEqual(consecutive_chall_won(player), 10)
Ejemplo n.º 3
0
    def test_chall_10_won_wrong_lost(self):
        player1 = self._get_player()
        player2 = self._get_player(2)
        for i in range(1, 10):
            timestamp = datetime.now() + timedelta(days=-i)
            if i == 5:
                 a = Activity.objects.create(timestamp=timestamp,
                        user_from=player2, user_to=player1, action='chall-won',
                        public=True)
            else:
                a = Activity.objects.create(timestamp=timestamp,
                        user_from=player1, user_to=player2, action='chall-won',
                        public=True)

        self.assertEqual(consecutive_chall_won(player1), 4)
Ejemplo n.º 4
0
    def test_chall_10_won_wrong_lost(self):
        player1 = self._get_player()
        player2 = self._get_player(2)
        for i in range(1, 10):
            timestamp = datetime.now() + timedelta(days=-i)
            if i == 5:
                a = Activity.objects.create(timestamp=timestamp,
                                            user_from=player2,
                                            user_to=player1,
                                            action='chall-won',
                                            public=True)
            else:
                a = Activity.objects.create(timestamp=timestamp,
                                            user_from=player1,
                                            user_to=player2,
                                            action='chall-won',
                                            public=True)

        self.assertEqual(consecutive_chall_won(player1), 4)