zulip_botserver: Add option to set third party configs for bots.
This commit is contained in:
parent
f76287412c
commit
a8665aaac8
4 changed files with 106 additions and 79 deletions
|
@ -16,7 +16,7 @@ class BotServerTestCase(TestCase):
|
|||
available_bots: Optional[List[str]]=None,
|
||||
bots_config: Optional[Dict[str, Dict[str, str]]]=None,
|
||||
bots_lib_module: Optional[Dict[str, Any]]=None,
|
||||
bot_handlers: Optional[Union[Dict[str, Any], BadRequest]]=None,
|
||||
bot_handlers: Optional[Dict[str, Any]]=None,
|
||||
payload_url: str="/bots/helloworld",
|
||||
message: Optional[Dict[str, Any]]=dict(message={'key': "test message"}),
|
||||
check_success: bool=False,
|
||||
|
@ -26,9 +26,10 @@ class BotServerTestCase(TestCase):
|
|||
bots_lib_modules = server.load_lib_modules()
|
||||
server.app.config["BOTS_LIB_MODULES"] = bots_lib_modules
|
||||
if bot_handlers is None:
|
||||
bot_handlers = server.load_bot_handlers(bots_config, bots_lib_modules)
|
||||
if not isinstance(bot_handlers, BadRequest):
|
||||
server.app.config["BOT_HANDLERS"] = bot_handlers
|
||||
bot_handlers = server.load_bot_handlers(bots_config)
|
||||
message_handlers = server.init_message_handlers(bots_lib_modules, bot_handlers)
|
||||
server.app.config["BOT_HANDLERS"] = bot_handlers
|
||||
server.app.config["MESSAGE_HANDLERS"] = message_handlers
|
||||
|
||||
response = self.app.post(payload_url, data=json.dumps(message))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue