File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 66
77from datadog_api_client .api_client import AsyncApiClient
88from datadog_api_client .configuration import Configuration
9- from datadog_api_client .exceptions import ForbiddenException
9+ from datadog_api_client .exceptions import UnauthorizedException
1010from datadog_api_client .v1 .api import dashboards_api , metrics_api
1111
1212
1313@pytest .mark .asyncio
1414async def test_error ():
1515 configuration = Configuration ()
16- configuration .api_key ["apiKeyAuth" ] = "00000000000000000000000000000000"
17- configuration .api_key ["appKeyAuth" ] = "00000000000000000000000000000000"
1816
1917 async with AsyncApiClient (configuration ) as api_client :
2018 api_instance = metrics_api .MetricsApi (api_client )
21- with pytest .raises (ForbiddenException ) as e :
19+ with pytest .raises (UnauthorizedException ) as e :
2220 await api_instance .get_metric_metadata ("some_metric" )
2321 error = str (e .value )
24- assert "(403 )" in error
25- assert "Reason: Forbidden " in error
22+ assert "(401 )" in error
23+ assert "Reason: Unauthorized " in error
2624 # cast headers to HttpHeaders to make them case insensitive
2725 headers = HttpHeaders (e .value .headers )
2826 assert headers ["content-type" ] == "application/json"
29- assert e .value .body ["errors" ] == ["Forbidden " ]
27+ assert e .value .body ["errors" ] == ["Unauthorized " ]
3028
3129
3230@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments