コード例 #1
0
 def test_effective_season_year_next_year_ignore_non_official(self):
     # Effective season should be next year
     today = datetime.today()
     # Insert an event that has already happened - otherwise we'll default to the current season
     # This is to simulate offseason
     Event(
         id="{}testended".format(today.year),
         end_date=today - timedelta(days=1),
         event_short="testended",
         event_type_enum=EventType.REGIONAL,
         first_eid="5561",
         name="Test Event (Ends Tomorrow)",
         start_date=today - timedelta(days=2),
         year=today.year,
         venue_address="123 Fake Street, Anytown, MI, USA",
         website="http://www.google.com"
     ).put()
     Event(
         id="{}testendstomorrow".format(today.year),
         end_date=today + timedelta(days=1),
         event_short="testendstomorrow",
         event_type_enum=EventType.OFFSEASON,
         first_eid="5561",
         name="Test Event (Ends Tomorrow)",
         start_date=today,
         year=today.year,
         venue_address="123 Fake Street, Anytown, MI, USA",
         website="http://www.google.com"
     ).put()
     self.assertEqual(SeasonHelper.effective_season_year(), today.year + 1)
コード例 #2
0
 def test_effective_season_year_next_year(self):
     # Effective season should be next year
     today = datetime.today()
     Event(
         id="{}testended".format(today.year),
         end_date=today - timedelta(days=1),
         event_short="testended",
         event_type_enum=EventType.REGIONAL,
         first_eid="5561",
         name="Test Event (Ends Tomorrow)",
         start_date=today - timedelta(days=2),
         year=today.year,
         venue_address="123 Fake Street, Anytown, MI, USA",
         website="http://www.google.com"
     ).put()
     self.assertEqual(SeasonHelper.effective_season_year(), today.year + 1)
コード例 #3
0
    def _render(self, *args, **kw):
        special_webcasts = FirebasePusher.get_special_webcasts()
        effective_season_year = SeasonHelper.effective_season_year()

        self.template_values.update({
            "events":
            EventHelper.getWeekEvents(),
            'kickoff_datetime_utc':
            SeasonHelper.kickoff_datetime_utc(effective_season_year),
            "any_webcast_online":
            any(w.get('status') == 'online' for w in special_webcasts),
            "special_webcasts":
            special_webcasts,
        })

        return jinja2_engine.render('index/index_offseason.html',
                                    self.template_values)
コード例 #4
0
 def test_effective_season_year_no_events(self):
     now = datetime.now()
     self.assertEqual(SeasonHelper.effective_season_year(), now.year)