bot server: Raise BadRequest when bot code can't be imported.
This adds support to check and raise a BadRequest when either the configuration of bot couldn't be found or the BotHandler code of bot couldn't be fetched. There can be cases where flaskbotrc contains config details of a bot, but the user hasn't added it's handler class code. This fixes server to handle such cases, by reporting it to user. This also fixes the response of bot server to make it possible to skip the response message.
This commit is contained in:
parent
a1429f36b2
commit
c4876dddae
2 changed files with 20 additions and 12 deletions
|
@ -35,10 +35,9 @@ class BotServerTests(BotServerTestCase):
|
|||
check_success=True)
|
||||
assert mock_ExternalBotHandler.called
|
||||
|
||||
def test_bot_not_supported(self):
|
||||
def test_bot_module_not_exists(self):
|
||||
# type: () -> None
|
||||
available_bots = ['testbot']
|
||||
self.assert_bot_server_response(available_bots=available_bots,
|
||||
self.assert_bot_server_response(bots_lib_module={},
|
||||
payload_url="/bots/not_supported_bot",
|
||||
check_success=False)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue