def test_embedded_bot_quit_exception(self) -> None: with patch('zulip_bots.bots.helloworld.helloworld.HelloWorldHandler.handle_message', side_effect=EmbeddedBotQuitException("I'm quitting!")): with patch('logging.warning') as mock_logging: self.send_stream_message(self.user_profile.email, "Denmark", content="@**{}** foo".format(self.bot_profile.full_name), topic_name="bar") mock_logging.assert_called_once_with("I'm quitting!")
def test_embedded_bot_quit_exception(self) -> None: assert self.bot_profile is not None with patch( 'zulip_bots.bots.helloworld.helloworld.HelloWorldHandler.handle_message', side_effect=EmbeddedBotQuitException("I'm quitting!")): with self.assertLogs(level='WARNING') as m: self.send_stream_message( self.user_profile, "Denmark", content=f"@**{self.bot_profile.full_name}** foo", topic_name="bar") self.assertEqual(m.output, ['WARNING:root:I\'m quitting!'])