예제 #1
0
파일: tests.py 프로젝트: nigini/coach
 def test_no_feedback(self):
     test_user = User()
     test_user.save()
     test_athlete_1 = Athlete(user=test_user)
     test_athlete_1.save()
     test_date_1 = timezone.now() - timezone.timedelta(days=1)
     test_activity_1 = Activity(athlete=test_athlete_1, sport='test_sport', description='test_description',
                                date=test_date_1)
     test_activity_1.save()
     self.assertEqual(test_activity_1.last_feedback(), '')
예제 #2
0
파일: tests.py 프로젝트: nigini/coach
    def test_some_last_activities(self):
        test_user = User()
        test_user.save()
        test_athlete_1 = Athlete(user=test_user)
        test_athlete_1.save()
        test_date_1 = timezone.now() - timezone.timedelta(days=1)
        test_activity_1 = Activity(athlete=test_athlete_1, sport='test_sport', description='test_description',
                                   date=test_date_1)
        test_activity_1.save()
        self.assertEqual(test_athlete_1.last_registered_activity_date(), test_date_1.date())
        self.assertEqual(len(test_athlete_1.last_activities()), 1)

        test_date_2 = timezone.now() - timezone.timedelta(days=2)
        test_activity_1 = Activity(athlete=test_athlete_1, sport='test_sport', description='test_description',
                                   date=test_date_2)
        test_activity_1.save()
        self.assertEqual(test_athlete_1.last_registered_activity_date(), test_date_1.date())
        test_activities = test_athlete_1.last_activities()
        self.assertEqual(len(test_activities), 2)
        self.assertTrue(test_activities[0].date > test_activities[1].date)