zulip_botserver: Handle all requests from the root / endpoint.

Previously, the Botserver determined which bot to run by dispatching on
a unique URL endpoint /bots/<botname> for each bot.
Now, instead, the Botserver determines which bot to run by the section
header of the bot in the flaskbotrc.
This commit is contained in:
Robert Hönig 2018-05-22 13:46:40 +02:00
parent 6249df0ad7
commit 6a8cb2965c
3 changed files with 29 additions and 13 deletions

View file

@ -31,6 +31,8 @@ class BotServerTests(BotServerTestCase):
}
self.assert_bot_server_response(available_bots=available_bots,
bots_config=bots_config,
message=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
check_success=True)
@mock.patch('zulip_bots.lib.ExternalBotHandler')
@ -49,12 +51,15 @@ class BotServerTests(BotServerTestCase):
}
}
self.assert_bot_server_response(available_bots=available_bots,
message=dict(message={'content': "test message"},
bot_email='helloworld-bot@zulip.com'),
bots_config=bots_config,
check_success=True)
def test_bot_module_not_exists(self) -> None:
self.assert_bot_server_response(available_bots=[],
payload_url="/bots/not_supported_bot",
message=dict(message={'content': "test message"},
bot_email='nonexistent-bot@zulip.com'),
check_success=False)
@mock.patch('logging.error')