11from datetime import datetime
22
33import pytest
4- from groundlight import ExperimentalApi
4+ from groundlight import ExperimentalApi , ApiException
55from groundlight_openapi_client .exceptions import NotFoundException
66
77
@@ -138,9 +138,9 @@ def test_create_alert_webhook_action_with_invalid_payload_template(gl_experiment
138138 url = "https://groundlight.ai" , include_image = True , payload_template = payload_template
139139 )
140140
141- with pytest .raises (Exception ) as e :
141+ with pytest .raises (ApiException ) as e :
142142 gl_experimental .create_alert (det , f"test_alert_{ name } " , condition , webhook_actions = webhook_action )
143- assert e .value .status_code == 400
143+ assert e .value .status == 400
144144
145145 payload_template = gl_experimental .make_payload_template (
146146 "This should not be a valid payload, it's valid jinja but won't produce valid json"
@@ -149,6 +149,6 @@ def test_create_alert_webhook_action_with_invalid_payload_template(gl_experiment
149149 url = "https://groundlight.ai" , include_image = True , payload_template = payload_template
150150 )
151151
152- with pytest .raises (Exception ) as e :
152+ with pytest .raises (ApiException ) as e :
153153 gl_experimental .create_alert (det , f"test_alert_{ name } " , condition , webhook_actions = webhook_action )
154- assert e .value .status_code == 400
154+ assert e .value .status == 400
0 commit comments