示例#1
0
    def test_chall_30_draw_lost(self):
        player1 = self._get_player()
        player2 = self._get_player(2)
        for i in range(1, 31):
            timestamp = datetime.now() + timedelta(days=-i)
            if (i % 5) == 0:
                a = Activity.objects.create(timestamp=timestamp,
                                            user_from=player2,
                                            user_to=player1,
                                            action='chall-won',
                                            public=True)
            elif (i % 7) == 0:
                a = Activity.objects.create(timestamp=timestamp,
                                            user_from=player1,
                                            user_to=player2,
                                            action='chall-draw',
                                            public=True)
            else:
                a = Activity.objects.create(timestamp=timestamp,
                                            user_from=player1,
                                            user_to=player2,
                                            action='chall-won',
                                            public=True)

        self.assertEqual(challenge_count(player1), 30)
示例#2
0
文件: tests.py 项目: TomyRO/wouso
    def test_chall_30(self):
        player = self._get_player()
        for i in range(1, 31):
            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(challenge_count(player), 30)
示例#3
0
    def test_chall_30(self):
        player = self._get_player()
        for i in range(1, 31):
            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(challenge_count(player), 30)
示例#4
0
文件: tests.py 项目: TomyRO/wouso
    def test_chall_100_draw_lost(self):
        player1 = self._get_player()
        player2 = self._get_player(2)
        for i in range(1, 101):
            timestamp = datetime.now() + timedelta(days=-i)
            if (i % 5) == 0:
                a = Activity.objects.create(timestamp=timestamp,
                        user_from=player2, user_to=player1, action='chall-won',
                        public=True)
            elif (i % 7) == 0:
                a = Activity.objects.create(timestamp=timestamp,
                        user_from=player1, user_to=player2, action='chall-draw',
                        public=True)
            else:
                a = Activity.objects.create(timestamp=timestamp,
                        user_from=player1, user_to=player2, action='chall-won',
                        public=True)

        self.assertEqual(challenge_count(player1), 100)