def test_init_explicit_next(self): self._setup_notification() explicit_match = self.event.matches[1] explicit_event_notification = EventScheduleNotification( self.event, explicit_match) self.assertEqual(explicit_event_notification.event, self.event) self.assertEqual(explicit_event_notification.next_match, explicit_match)
def event_schedule(cls, event, user_id=None): from models.notifications.event_schedule import EventScheduleNotification # Send to Event subscribers if NotificationType.SCHEDULE_UPDATED in NotificationType.enabled_event_notifications: users = [user_id] if user_id else [] if not users: users = Subscription.users_subscribed_to_event(event, NotificationType.SCHEDULE_UPDATED) if users: cls._send(users, EventScheduleNotification(event))
def test_type(self): self.assertEqual(EventScheduleNotification._type(), NotificationType.SCHEDULE_UPDATED)
def test_init_automatic_next(self): self._setup_notification() automatic_event_notification = EventScheduleNotification(self.event) self.assertEqual(automatic_event_notification.event, self.event) self.assertIsNotNone(automatic_event_notification.next_match)
def test_init(self): just_event = EventTestCreator.createPresentEvent(only_event=True) just_event_notification = EventScheduleNotification(just_event) self.assertEqual(just_event_notification.event, just_event) self.assertIsNone(just_event_notification.next_match)
def _setup_notification(self): for team_number in range(7): Team(id="frc%s" % team_number, team_number=team_number).put() self.event = EventTestCreator.createPresentEvent() self.notification = EventScheduleNotification(self.event)