tools: Allow specifying extra query params in screenshot config.

This commit is contained in:
Puneeth Chaganti 2020-05-02 00:55:28 +05:30 committed by Tim Abbott
parent 56c31a8647
commit b533420d3b
2 changed files with 4 additions and 0 deletions

View File

@ -120,6 +120,8 @@ def send_bot_payload_message(bot: UserProfile, integration: WebhookIntegration,
stream = integration.stream_name or 'devel'
url = "{}/{}".format(bot.bot_owner.realm.uri, integration.url)
params = {'api_key': bot.api_key, 'stream': stream}
if config.extra_params:
params.update(config.extra_params)
if config.payload_as_query_param:
params[config.payload_param_name] = ujson.dumps(data)

View File

@ -202,6 +202,7 @@ class ScreenshotConfig:
def __init__(self, fixture_name: str, image_name: str='001.png',
image_dir: Optional[str]=None, bot_name: Optional[str]=None,
payload_as_query_param: bool=False, payload_param_name: str='payload',
extra_params: Optional[Dict[str, str]]=None,
use_basic_auth: bool=False, custom_headers: Optional[Dict[str, str]]=None):
self.fixture_name = fixture_name
self.image_name = image_name
@ -209,6 +210,7 @@ class ScreenshotConfig:
self.bot_name = bot_name
self.payload_as_query_param = payload_as_query_param
self.payload_param_name = payload_param_name
self.extra_params = extra_params
self.use_basic_auth = use_basic_auth
self.custom_headers = custom_headers