@@ -233,11 +233,15 @@ def split_fixture_path(path: str) -> Tuple[str, str]:
233
233
234
234
235
235
@dataclass
236
- class ScreenshotConfig :
236
+ class BaseScreenshotConfig :
237
237
fixture_name : str
238
238
image_name : str = "001.png"
239
239
image_dir : Optional [str ] = None
240
240
bot_name : Optional [str ] = None
241
+
242
+
243
+ @dataclass
244
+ class ScreenshotConfig (BaseScreenshotConfig ):
241
245
payload_as_query_param : bool = False
242
246
payload_param_name : str = "payload"
243
247
extra_params : Dict [str , str ] = field (default_factory = dict )
@@ -246,9 +250,12 @@ class ScreenshotConfig:
246
250
247
251
248
252
def get_fixture_and_image_paths (
249
- integration : WebhookIntegration , screenshot_config : ScreenshotConfig
253
+ integration : Integration , screenshot_config : BaseScreenshotConfig
250
254
) -> Tuple [str , str ]:
251
- fixture_dir = os .path .join ("zerver" , "webhooks" , integration .name , "fixtures" )
255
+ if isinstance (integration , WebhookIntegration ):
256
+ fixture_dir = os .path .join ("zerver" , "webhooks" , integration .name , "fixtures" )
257
+ else :
258
+ fixture_dir = os .path .join ("zerver" , "integration_fixtures" , integration .name )
252
259
fixture_path = os .path .join (fixture_dir , screenshot_config .fixture_name )
253
260
image_dir = screenshot_config .image_dir or integration .name
254
261
image_name = screenshot_config .image_name
@@ -658,7 +665,7 @@ def __init__(self, name: str, *args: Any, **kwargs: Any) -> None:
658
665
}
659
666
660
667
661
- DOC_SCREENSHOT_CONFIG : Dict [str , List [ScreenshotConfig ]] = {
668
+ DOC_SCREENSHOT_CONFIG : Dict [str , List [BaseScreenshotConfig ]] = {
662
669
"airbrake" : [ScreenshotConfig ("error_message.json" )],
663
670
"alertmanager" : [
664
671
ScreenshotConfig ("alert.json" , extra_params = {"name" : "topic" , "desc" : "description" })
0 commit comments