Example #1
0
 def test_no_events(self):
     """
     Does nothing on no events
     """
     process_events([], self.mock_store, self.log)
     self.assertFalse(self.log.msg.called)
     self.assertFalse(self.execute_event.called)
     self.assertFalse(self.add_cron_events.called)
Example #2
0
 def test_no_events(self):
     """
     Does nothing on no events.
     """
     r = process_events([], "disp", self.mock_store, self.log)
     self.assertEqual(r, 0)
     self.assertFalse(self.log.msg.called)
     self.assertFalse(self.execute_event.called)
     self.assertFalse(self.add_cron_events.called)
Example #3
0
 def test_success(self):
     """
     Test success path: Logs number of events, calls `execute_event` on each event
     and calls `add_cron_events`
     """
     events = range(10)
     d = process_events(events, self.mock_store, self.log)
     self.assertEqual(self.successResultOf(d), 10)
     self.log.msg.assert_called_once_with('Processing {num_events} events', num_events=10)
     self.assertEqual(
         self.execute_event.mock_calls,
         [mock.call(self.mock_store, self.log, event, set()) for event in events])
     self.add_cron_events.assert_called_once_with(self.mock_store, self.log, events, set())
Example #4
0
 def test_success(self):
     """
     Test success path: Logs number of events, calls `execute_event` on
     each event and calls `add_cron_events.`
     """
     events = range(10)
     d = process_events(events, "disp", self.mock_store, self.log)
     self.assertEqual(self.successResultOf(d), 10)
     self.log.msg.assert_called_once_with('Processing {num_events} events',
                                          num_events=10)
     self.assertEqual(self.execute_event.mock_calls, [
         mock.call("disp", self.mock_store, self.log, event, set())
         for event in events
     ])
     self.add_cron_events.assert_called_once_with(self.mock_store, self.log,
                                                  events, set())