Пример #1
0
def send_calendar_events():
    """Sends calendar events."""
    error_msg = None
    try:
        with benchmark("Send calendar events"):
            builder = calendar_event_builder.CalendarEventBuilder()
            builder.build_cycle_tasks()
            sync = calendar_event_sync.CalendarEventsSync()
            sync.sync_cycle_tasks_events()
    except Exception as exp:  # pylint: disable=broad-except
        logger.error(exp.message)
        error_msg = exp.message
    return utils.make_simple_response(error_msg)
  def test_create_event_with_relationship(self, prefix, expected_title):
    """Test create event with a relationship."""
    with factories.single_commit():
      person = factories.PersonFactory()
      task = wf_factories.CycleTaskGroupObjectTaskFactory(
          title=u"First task",
          end_date=date(2015, 1, 15),
      )
    with mock.patch("ggrc.settings.NOTIFICATION_PREFIX", new=prefix):
      self.builder = calendar_event_builder.CalendarEventBuilder()

    with freeze_time("2015-01-1 12:00:00"):
      event = self.builder._create_event_with_relationship(task, person.id)
      db.session.commit()

    self.assertEquals(event.title, expected_title)
    self.assertEquals(event.due_date, date(2015, 1, 15))
    self.assertEquals(event.attendee_id, person.id)
    relationship = self.get_relationship(task.id, event.id)
    self.assertIsNotNone(relationship)
Пример #3
0
 def setUp(self):
   """Set up test."""
   super(TestShouldCreateEventForTask, self).setUp()
   self.client.get("/login")
   self.builder = calendar_event_builder.CalendarEventBuilder()
Пример #4
0
 def setUp(self):
     """Set up test."""
     super(TestCalendarEventBuilder, self).setUp()
     self.client.get("/login")
     self.builder = calendar_event_builder.CalendarEventBuilder()