Пример #1
0
 def test_ctrl_c(self, patched_pyb_irc, patched_load, patched_check):
     patched_pyb_irc.return_value.start.side_effect = KeyboardInterrupt
     patched_load.return_value = self.settings
     # with self.assertRaises(KeyboardInterrupt):
     pyborg_irc2.start_irc_bot()
     patched_pyb_irc.return_value.teardown.assert_called_once_with()
     patched_pyb_irc.return_value.disconnect.assert_called_with("Killed at terminal.")
Пример #2
0
 def test_handle_exception(self, patched_pyb_irc, patched_load, patched_check):
     patched_pyb_irc.return_value.start.side_effect = Exception
     with self.assertRaises(Exception):
         pyborg_irc2.start_irc_bot()
     # patched_pyb_irc.return_value.teardown.assert_called_once_with()
     patched_pyb_irc.return_value.disconnect.assert_called_with("Caught exception")
Пример #3
0
 def test_launch(self, patched_pyb_irc, patched_pyb, patched_load, patched_check):
     patched_load.return_value = self.settings
     pyborg_irc2.start_irc_bot()
     patched_pyb_irc.assert_called_with(patched_pyb, self.settings)
     patched_pyb_irc.return_value.start.assert_called_with()