Example #1
0
 def test_cancel_resets_stop_variable(self):
     m = mock.Mock()
     h = handler.handler()
     h.chain(m)
     h.stop_propagation()
     h.cancel()
     self.assertFalse(h.stop)
Example #2
0
 def test_cancel_does_not_invoke_handlers_if_stop_is_set(self):
     m = mock.Mock()
     h = handler.handler()
     h.chain(m)
     h.stop_propagation()
     h.cancel()
     self.assertEqual(0, m.cancel.call_count)
Example #3
0
 def test_unhandle_call_all_handlers(self):
     m = mock.Mock()
     h = handler.handler()
     h.chain(m)
     h.unhandle()
     m.unhandle.assert_called_with()
Example #4
0
 def test_cancel_call_all_handlers(self):
     m = mock.Mock()
     h = handler.handler()
     h.chain(m)
     h.cancel()
     m.cancel.assert_called_with()
Example #5
0
 def test_chain_extends_handlers(self):
     h = handler.handler()
     h.chain("foo", "bar")
     self.assertEqual(["foo", "bar"], h.handlers)
Example #6
0
 def test_chain_returns_self(self):
     h = handler.handler()
     self.assertEqual(h, h.chain("foo", "bar"))