def test_telegram_engine_configure_not_ok(mocked_debug): '''Make sure logger.debug is not called if the response from webhook is negative.''' engine = TelegramEngine(token='') engine.session = '' engine.configure() assert not mocked_debug.called
def test_telegram_engine_configure(mocked_debug): '''Make sure logger.debug is called if the response from webhook is positive.''' def mocked_json(): return {'ok': True} def mocked_delete_webhook(): return type('response', (), {'json': mocked_json}) engine = TelegramEngine(token='') engine.api.delete_webhook = mocked_delete_webhook engine.session = '' engine.configure() assert mocked_debug.called