Skip to content

Commit 0378e7c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Cleanup service accounts tests (#1717)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 9c96f5e commit 0378e7c

File tree

31 files changed

+422
-556
lines changed

31 files changed

+422
-556
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-10-12 21:14:48.669425",
8-
"spec_repo_commit": "d4c17bf0"
7+
"regenerated": "2023-10-13 08:13:36.289198",
8+
"spec_repo_commit": "30a99088"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-12 21:14:48.718184",
13-
"spec_repo_commit": "d4c17bf0"
12+
"regenerated": "2023-10-13 08:13:36.303071",
13+
"spec_repo_commit": "30a99088"
1414
}
1515
}
1616
}

examples/v2/service-accounts/CreateServiceAccountApplicationKey.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22
Create an application key for this service account returns "Created" response
33
"""
44

5+
from os import environ
56
from datadog_api_client import ApiClient, Configuration
67
from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi
78
from datadog_api_client.v2.model.application_key_create_attributes import ApplicationKeyCreateAttributes
89
from datadog_api_client.v2.model.application_key_create_data import ApplicationKeyCreateData
910
from datadog_api_client.v2.model.application_key_create_request import ApplicationKeyCreateRequest
1011
from datadog_api_client.v2.model.application_keys_type import ApplicationKeysType
1112

13+
# there is a valid "service_account_user" in the system
14+
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]
15+
1216
body = ApplicationKeyCreateRequest(
1317
data=ApplicationKeyCreateData(
1418
attributes=ApplicationKeyCreateAttributes(
15-
name="Application Key for managing dashboards",
16-
scopes=[
17-
"dashboards_read",
18-
"dashboards_write",
19-
"dashboards_public_share",
20-
],
19+
name="Example-Service-Account",
2120
),
2221
type=ApplicationKeysType.APPLICATION_KEYS,
2322
),
@@ -27,7 +26,7 @@
2726
with ApiClient(configuration) as api_client:
2827
api_instance = ServiceAccountsApi(api_client)
2928
response = api_instance.create_service_account_application_key(
30-
service_account_id="00000000-0000-1234-0000-000000000000", body=body
29+
service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, body=body
3130
)
3231

3332
print(response)

examples/v2/service-accounts/CreateServiceAccountApplicationKey_1761876297.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/v2/service-accounts/DeleteServiceAccountApplicationKey.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
Delete an application key for this service account returns "No Content" response
33
"""
44

5+
from os import environ
56
from datadog_api_client import ApiClient, Configuration
67
from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi
78

9+
# there is a valid "service_account_user" in the system
10+
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]
11+
12+
# there is a valid "service_account_application_key" for "service_account_user"
13+
SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID = environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]
14+
815
configuration = Configuration()
916
with ApiClient(configuration) as api_client:
1017
api_instance = ServiceAccountsApi(api_client)
1118
api_instance.delete_service_account_application_key(
12-
service_account_id="00000000-0000-1234-0000-000000000000",
13-
app_key_id="app_key_id",
19+
service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,
20+
app_key_id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,
1421
)

examples/v2/service-accounts/DeleteServiceAccountApplicationKey_992091161.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/v2/service-accounts/GetServiceAccountApplicationKey.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
Get one application key for this service account returns "OK" response
33
"""
44

5+
from os import environ
56
from datadog_api_client import ApiClient, Configuration
67
from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi
78

9+
# there is a valid "service_account_user" in the system
10+
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]
11+
12+
# there is a valid "service_account_application_key" for "service_account_user"
13+
SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID = environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]
14+
815
configuration = Configuration()
916
with ApiClient(configuration) as api_client:
1017
api_instance = ServiceAccountsApi(api_client)
1118
response = api_instance.get_service_account_application_key(
12-
service_account_id="00000000-0000-1234-0000-000000000000",
13-
app_key_id="app_key_id",
19+
service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,
20+
app_key_id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,
1421
)
1522

1623
print(response)

examples/v2/service-accounts/GetServiceAccountApplicationKey_819075131.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/v2/service-accounts/ListServiceAccountApplicationKeys.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
List application keys for this service account returns "OK" response
33
"""
44

5+
from os import environ
56
from datadog_api_client import ApiClient, Configuration
67
from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi
78

9+
# there is a valid "service_account_user" in the system
10+
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]
11+
812
configuration = Configuration()
913
with ApiClient(configuration) as api_client:
1014
api_instance = ServiceAccountsApi(api_client)
1115
response = api_instance.list_service_account_application_keys(
12-
service_account_id="00000000-0000-1234-0000-000000000000",
16+
service_account_id=SERVICE_ACCOUNT_USER_DATA_ID,
1317
)
1418

1519
print(response)

examples/v2/service-accounts/ListServiceAccountApplicationKeys_1268914341.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/v2/service-accounts/UpdateServiceAccountApplicationKey.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@
22
Edit an application key for this service account returns "OK" response
33
"""
44

5+
from os import environ
56
from datadog_api_client import ApiClient, Configuration
67
from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi
78
from datadog_api_client.v2.model.application_key_update_attributes import ApplicationKeyUpdateAttributes
89
from datadog_api_client.v2.model.application_key_update_data import ApplicationKeyUpdateData
910
from datadog_api_client.v2.model.application_key_update_request import ApplicationKeyUpdateRequest
1011
from datadog_api_client.v2.model.application_keys_type import ApplicationKeysType
1112

13+
# there is a valid "service_account_user" in the system
14+
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]
15+
16+
# there is a valid "service_account_application_key" for "service_account_user"
17+
SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME = environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]
18+
SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID = environ["SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID"]
19+
1220
body = ApplicationKeyUpdateRequest(
1321
data=ApplicationKeyUpdateData(
22+
id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID,
23+
type=ApplicationKeysType.APPLICATION_KEYS,
1424
attributes=ApplicationKeyUpdateAttributes(
15-
name="Application Key for managing dashboards",
16-
scopes=[
17-
"dashboards_read",
18-
"dashboards_write",
19-
"dashboards_public_share",
20-
],
25+
name="Application Key for managing dashboards-updated",
2126
),
22-
id="00112233-4455-6677-8899-aabbccddeeff",
23-
type=ApplicationKeysType.APPLICATION_KEYS,
2427
),
2528
)
2629

2730
configuration = Configuration()
2831
with ApiClient(configuration) as api_client:
2932
api_instance = ServiceAccountsApi(api_client)
3033
response = api_instance.update_service_account_application_key(
31-
service_account_id="00000000-0000-1234-0000-000000000000", app_key_id="app_key_id", body=body
34+
service_account_id=SERVICE_ACCOUNT_USER_DATA_ID, app_key_id=SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID, body=body
3235
)
3336

3437
print(response)

0 commit comments

Comments
 (0)