Skip to content

Commit 8154e89

Browse files
authored
Update test (#2841)
1 parent cc042b6 commit 8154e89

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/test_async.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,25 @@
66

77
from datadog_api_client.api_client import AsyncApiClient
88
from datadog_api_client.configuration import Configuration
9-
from datadog_api_client.exceptions import ForbiddenException
9+
from datadog_api_client.exceptions import UnauthorizedException
1010
from datadog_api_client.v1.api import dashboards_api, metrics_api
1111

1212

1313
@pytest.mark.asyncio
1414
async 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

0 commit comments

Comments
 (0)