Ejemplo n.º 1
0
 def test_process_additional_events_stop_return_stop(self, mock_get_procs):
     self._test_process_additional_events(
         mock_get_procs,
         [
             [  # 0
                 mock.Mock(return_value=[1]),
                 mock.Mock(side_effect=exc.StopProcessing('stop')),
                 mock.Mock(return_value=None),
             ],
             [  # 1
                 mock.Mock(return_value=[]),
             ],
         ],
         [mock.call(0)],
         [[1, 1, 0], [0]],
         'stop')
Ejemplo n.º 2
0
    def test_process_stop(self, mock_get_procs):
        nodes = [
            mock.Mock(),
            mock.Mock(),
            mock.Mock(side_effect=exc.StopProcessing('stop')),
            mock.Mock(),
        ]
        mock_get_procs.return_value = nodes
        proc = processor.Processor()

        result = proc.process('ev')

        self.assertEqual(result, 'stop')
        mock_get_procs.assert_called_once_with('ev')
        for node in nodes[:-1]:
            node.assert_called_once_with('ev')
        self.assertFalse(nodes[-1].called)
Ejemplo n.º 3
0
    def test_init_with_args(self):
        ex = exc.StopProcessing('retval')

        self.assertEqual(ex.retval, 'retval')
Ejemplo n.º 4
0
    def test_init_no_args(self):
        ex = exc.StopProcessing()

        self.assertEqual(ex.retval, exc._unset)