From e50325ebf347a91dd48058e1c7b6403414788549 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 31 Mar 2026 15:08:14 +0000 Subject: [PATCH] Regenerate client from commit 9a344d9 of spec repo --- examples/v2/teams/CreateTeamMembership.py | 20 ++- ...returns_api_error_response_response.frozen | 1 + ...m_returns_api_error_response_response.yaml | 126 ++++++++++++++++++ ...sers_association_to_a_team_response.frozen | 1 + ..._users_association_to_a_team_response.yaml | 107 +++++++++++++++ tests/v2/features/teams.feature | 19 ++- 6 files changed, 257 insertions(+), 17 deletions(-) create mode 100644 tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.yaml diff --git a/examples/v2/teams/CreateTeamMembership.py b/examples/v2/teams/CreateTeamMembership.py index 5ea2c50609..88faad7a87 100644 --- a/examples/v2/teams/CreateTeamMembership.py +++ b/examples/v2/teams/CreateTeamMembership.py @@ -2,10 +2,9 @@ Add a user to a team returns "Represents a user's association to a team" response """ +from os import environ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v2.api.teams_api import TeamsApi -from datadog_api_client.v2.model.relationship_to_user_team_team import RelationshipToUserTeamTeam -from datadog_api_client.v2.model.relationship_to_user_team_team_data import RelationshipToUserTeamTeamData from datadog_api_client.v2.model.relationship_to_user_team_user import RelationshipToUserTeamUser from datadog_api_client.v2.model.relationship_to_user_team_user_data import RelationshipToUserTeamUserData from datadog_api_client.v2.model.user_team_attributes import UserTeamAttributes @@ -13,25 +12,24 @@ from datadog_api_client.v2.model.user_team_relationships import UserTeamRelationships from datadog_api_client.v2.model.user_team_request import UserTeamRequest from datadog_api_client.v2.model.user_team_role import UserTeamRole -from datadog_api_client.v2.model.user_team_team_type import UserTeamTeamType from datadog_api_client.v2.model.user_team_type import UserTeamType from datadog_api_client.v2.model.user_team_user_type import UserTeamUserType +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = environ["DD_TEAM_DATA_ID"] + +# there is a valid "user" in the system +USER_DATA_ID = environ["USER_DATA_ID"] + body = UserTeamRequest( data=UserTeamCreate( attributes=UserTeamAttributes( role=UserTeamRole.ADMIN, ), relationships=UserTeamRelationships( - team=RelationshipToUserTeamTeam( - data=RelationshipToUserTeamTeamData( - id="d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", - type=UserTeamTeamType.TEAM, - ), - ), user=RelationshipToUserTeamUser( data=RelationshipToUserTeamUserData( - id="b8626d7e-cedd-11eb-abf5-da7ad0900001", + id=USER_DATA_ID, type=UserTeamUserType.USERS, ), ), @@ -43,6 +41,6 @@ configuration = Configuration() with ApiClient(configuration) as api_client: api_instance = TeamsApi(api_client) - response = api_instance.create_team_membership(team_id="team_id", body=body) + response = api_instance.create_team_membership(team_id=DD_TEAM_DATA_ID, body=body) print(response) diff --git a/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.frozen b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.frozen new file mode 100644 index 0000000000..1858032e08 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.frozen @@ -0,0 +1 @@ +2026-03-31T14:58:05.044Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.yaml b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.yaml new file mode 100644 index 0000000000..27b4b6d4cd --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_api_error_response_response.yaml @@ -0,0 +1,126 @@ +interactions: +- request: + body: '{"data":{"attributes":{"handle":"test-handle-22e42ce95626a92a","name":"test-name-22e42ce95626a92a"},"type":"team"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + string: '{"data":{"id":"abc7c612-d3a1-4147-bcfa-f28b4af43d33","type":"team","attributes":{"avatar":null,"banner":10,"created_at":"2026-03-31T14:58:05.503733+00:00","description":null,"handle":"test-handle-22e42ce95626a92a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2026-03-31T14:58:05.503733+00:00","name":"test-name-22e42ce95626a92a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/abc7c612-d3a1-4147-bcfa-f28b4af43d33/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/abc7c612-d3a1-4147-bcfa-f28b4af43d33/permission-settings"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"email":"Test-Add_a_user_to_a_team_returns_API_error_response_response-1774969085@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + string: '{"data": {"type": "users", "id": "825c5f4c-585c-494a-aade-60f1e1aa189b", + "attributes": {"name": null, "handle": "test-add_a_user_to_a_team_returns_api_error_response_response-1774969085@datadoghq.com", + "created_at": "2026-03-31T14:58:06.030754+00:00", "modified_at": "2026-03-31T14:58:06.030754+00:00", + "email": "test-add_a_user_to_a_team_returns_api_error_response_response-1774969085@datadoghq.com", + "icon": "https://secure.gravatar.com/avatar/53ba6f826ef9a49acaeec55d1bcc1c47?s=48&d=retro", + "title": "user title", "verified": false, "service_account": false, "disabled": + false, "allowed_login_methods": [], "status": "Pending", "last_login_time": + null}, "relationships": {"roles": {"data": []}, "org": {"data": {"type": "orgs", + "id": "4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"role":"admin"},"relationships":{"user":{"data":{"id":"825c5f4c-585c-494a-aade-60f1e1aa189b","type":"users"}}},"type":"team_memberships"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/abc7c612-d3a1-4147-bcfa-f28b4af43d33/memberships + response: + body: + string: '{"data":{"id":"TeamMembership-abc7c612-d3a1-4147-bcfa-f28b4af43d33-66215044","type":"team_memberships","attributes":{"provisioned_by":null,"provisioned_by_id":"a1d5ff5a-c6dd-11f0-9cb6-06640ca27ad4","role":"admin"},"relationships":{"user":{"data":{"id":"825c5f4c-585c-494a-aade-60f1e1aa189b","type":"users"}}}},"included":[{"id":"825c5f4c-585c-494a-aade-60f1e1aa189b","type":"users","attributes":{"disabled":false,"email":"test-add_a_user_to_a_team_returns_api_error_response_response-1774969085@datadoghq.com","handle":"test-add_a_user_to_a_team_returns_api_error_response_response-1774969085@datadoghq.com","icon":"https://secure.gravatar.com/avatar/53ba6f826ef9a49acaeec55d1bcc1c47?d=retro\u0026s=48","name":null,"service_account":false,"status":"Pending"}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"role":"admin"},"relationships":{"user":{"data":{"id":"825c5f4c-585c-494a-aade-60f1e1aa189b","type":"users"}}},"type":"team_memberships"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/abc7c612-d3a1-4147-bcfa-f28b4af43d33/memberships + response: + body: + string: '{"errors":[{"status":"409","title":"Conflict","detail":"users already + present on the team [825c5f4c-585c-494a-aade-60f1e1aa189b]"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/abc7c612-d3a1-4147-bcfa-f28b4af43d33/memberships/825c5f4c-585c-494a-aade-60f1e1aa189b + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/825c5f4c-585c-494a-aade-60f1e1aa189b + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/abc7c612-d3a1-4147-bcfa-f28b4af43d33 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.frozen b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.frozen new file mode 100644 index 0000000000..41a13b9fdc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.frozen @@ -0,0 +1 @@ +2026-03-31T14:57:49.739Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.yaml b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.yaml new file mode 100644 index 0000000000..c1a8e110bc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_a_user_to_a_team_returns_represents_a_users_association_to_a_team_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: '{"data":{"attributes":{"handle":"test-handle-3170c6f6f5b25b4d","name":"test-name-3170c6f6f5b25b4d"},"type":"team"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + string: '{"data":{"id":"95ac9e78-0a56-4a6a-9e5e-21580dc141cc","type":"team","attributes":{"avatar":null,"banner":9,"created_at":"2026-03-31T14:57:54.888553+00:00","description":null,"handle":"test-handle-3170c6f6f5b25b4d","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2026-03-31T14:57:54.888553+00:00","name":"test-name-3170c6f6f5b25b4d","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/95ac9e78-0a56-4a6a-9e5e-21580dc141cc/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/95ac9e78-0a56-4a6a-9e5e-21580dc141cc/permission-settings"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"email":"Test-Add_a_user_to_a_team_returns_Represents_a_user_s_association_to_a_team_response-1774969069@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + string: '{"data": {"type": "users", "id": "ebb17d15-5e46-4440-856f-75710cbbce4b", + "attributes": {"name": null, "handle": "test-add_a_user_to_a_team_returns_represents_a_user_s_association_to_a_team_response-1774969069@datadoghq.com", + "created_at": "2026-03-31T14:57:55.106406+00:00", "modified_at": "2026-03-31T14:57:55.106406+00:00", + "email": "test-add_a_user_to_a_team_returns_represents_a_user_s_association_to_a_team_response-1774969069@datadoghq.com", + "icon": "https://secure.gravatar.com/avatar/52a30c814f85968a9d363cc103840284?s=48&d=retro", + "title": "user title", "verified": false, "service_account": false, "disabled": + false, "allowed_login_methods": [], "status": "Pending", "last_login_time": + null}, "relationships": {"roles": {"data": []}, "org": {"data": {"type": "orgs", + "id": "4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"role":"admin"},"relationships":{"user":{"data":{"id":"ebb17d15-5e46-4440-856f-75710cbbce4b","type":"users"}}},"type":"team_memberships"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/95ac9e78-0a56-4a6a-9e5e-21580dc141cc/memberships + response: + body: + string: '{"data":{"id":"TeamMembership-95ac9e78-0a56-4a6a-9e5e-21580dc141cc-66215040","type":"team_memberships","attributes":{"provisioned_by":null,"provisioned_by_id":"a1d5ff5a-c6dd-11f0-9cb6-06640ca27ad4","role":"admin"},"relationships":{"user":{"data":{"id":"ebb17d15-5e46-4440-856f-75710cbbce4b","type":"users"}}}},"included":[{"id":"ebb17d15-5e46-4440-856f-75710cbbce4b","type":"users","attributes":{"disabled":false,"email":"test-add_a_user_to_a_team_returns_represents_a_user_s_association_to_a_team_response-1774969069@datadoghq.com","handle":"test-add_a_user_to_a_team_returns_represents_a_user_s_association_to_a_team_response-1774969069@datadoghq.com","icon":"https://secure.gravatar.com/avatar/52a30c814f85968a9d363cc103840284?d=retro\u0026s=48","name":null,"service_account":false,"status":"Pending"}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/95ac9e78-0a56-4a6a-9e5e-21580dc141cc/memberships/ebb17d15-5e46-4440-856f-75710cbbce4b + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/ebb17d15-5e46-4440-856f-75710cbbce4b + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/95ac9e78-0a56-4a6a-9e5e-21580dc141cc + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/teams.feature b/tests/v2/features/teams.feature index c24ced9ffb..b21078ebf3 100644 --- a/tests/v2/features/teams.feature +++ b/tests/v2/features/teams.feature @@ -27,21 +27,28 @@ Feature: Teams When the request is sent Then the response status is 204 Added - @generated @skip @team:DataDog/aaa-omg + @team:DataDog/aaa-omg Scenario: Add a user to a team returns "API error response." response Given new "CreateTeamMembership" request - And request contains "team_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"team": {"data": {"id": "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", "type": "team"}}, "user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} + And there is a valid "dd_team" in the system + And there is a valid "user" in the system + And there is a valid "team_membership" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"user": {"data": {"id": "{{user.data.id}}", "type": "users"}}}, "type": "team_memberships"}} When the request is sent Then the response status is 409 API error response. - @generated @skip @team:DataDog/aaa-omg + @team:DataDog/aaa-omg Scenario: Add a user to a team returns "Represents a user's association to a team" response Given new "CreateTeamMembership" request - And request contains "team_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"team": {"data": {"id": "d7e15d9d-d346-43da-81d8-3d9e71d9a5e9", "type": "team"}}, "user": {"data": {"id": "b8626d7e-cedd-11eb-abf5-da7ad0900001", "type": "users"}}}, "type": "team_memberships"}} + And there is a valid "dd_team" in the system + And there is a valid "user" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And body with value {"data": {"attributes": {"role": "admin"}, "relationships": {"user": {"data": {"id": "{{user.data.id}}", "type": "users"}}}, "type": "team_memberships"}} When the request is sent Then the response status is 200 Represents a user's association to a team + And the response "data.attributes.role" is equal to "admin" + And the response "data.relationships.user.data.id" is equal to "{{ user.data.id }}" @team:DataDog/aaa-omg Scenario: Create a team hierarchy link returns "Conflict" response