Пример #1
0
    def test_get_by_year(self):
        self.setup_test()
        team_service = TeamService()
        service = RecordService()

        for i in range(10):
            team_service.create("Team " + str(i), 5, True)

        teams = team_service.get_all()

        [service.add(team_service.get_all(), 25)]
        [service.add(team_service.get_all(), 35)]
        [service.add(team_service.get_all(), 2)]

        self.assertEqual(10, len(service.get_by_year(2)))
    def test_should_get_standings_history_view(self):
        self.setup_test()
        team_service = TeamService()
        record_service = RecordService()
        app_service = AppService()
        app_service.setup_data(35, 1, True, True)

        standings_service = StandingsService()

        for i in range(10):
            team_service.create("Team " + str(i), 5, True)

        record_service.add(team_service.get_all(), 25)
        record_service.add(team_service.get_all(), 35)
        record_service.add(team_service.get_all(), 2)

        result = standings_service.get_standings_history_view(2)
        self.assertEqual(10, len(result.records))
Пример #3
0
    def test_add_get_by_year_get_by_team(self):
        self.setup_test()
        team_service = TeamService()
        service = RecordService()

        for i in range(10):
            team_service.create("Team " + str(i), 5, True)

        teams = team_service.get_all()

        [service.add(team_service.get_all(), 25)]
        [service.add(team_service.get_all(), 35)]
        [service.add(team_service.get_all(), 2)]

        result = service.get_by_year(35)
        [self.assertEqual(35, r.year) for r in result]

        result = service.get_by_team_and_year(teams[6].oid, 35)
        self.assertEqual(teams[6].oid, result.team_id, "by year and team")
        self.assertEqual(35, result.year, "by year and team")