Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86549,6 +86549,34 @@ components:
required:
- data
type: object
TestExample:
description: A test example resource.
properties:
created_at:
description: Creation time of the test example.
format: date-time
readOnly: true
type: string
id:
description: The ID of the test example.
example: "abc-123"
type: string
name:
description: The name of the test example.
example: "My Test Example"
type: string
required:
- id
- name
type: object
TestExamplesResponse:
description: Response containing a list of test examples.
properties:
data:
items:
$ref: "#/components/schemas/TestExample"
type: array
type: object
TestOptimizationDeleteServiceSettingsRequest:
description: Request object for deleting Test Optimization service settings.
properties:
Expand Down Expand Up @@ -158742,6 +158770,34 @@ paths:
operator: OR
permissions:
- teams_read
/api/v2/test-examples:
get:
description: Get a list of all test examples.
operationId: ListTestExamples
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
- id: "abc-123"
name: "My Test Example"
schema:
$ref: "#/components/schemas/TestExamplesResponse"
description: OK
"403":
$ref: "#/components/responses/ForbiddenResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
summary: List test examples
tags:
- Test Examples
x-permission:
operator: OR
permissions:
- test_read
/api/v2/test/flaky-test-management/tests:
patch:
description: |-
Expand Down Expand Up @@ -162115,6 +162171,8 @@ tags:
name: Synthetics
- description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information.
name: Teams
- description: Manage test example resources.
name: Test Examples
- description: |-
Search and manage flaky tests through Test Optimization. See the [Test Optimization page](https://docs.datadoghq.com/tests/) for more information.
name: Test Optimization
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,13 @@ datadog\_api\_client.v2.api.teams\_api module
:members:
:show-inheritance:

datadog\_api\_client.v2.api.test\_examples\_api module
------------------------------------------------------

.. automodule:: datadog_api_client.v2.api.test_examples_api
:members:
:show-inheritance:

datadog\_api\_client.v2.api.test\_optimization\_api module
----------------------------------------------------------

Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37678,6 +37678,20 @@ datadog\_api\_client.v2.model.tenancy\_products\_list module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.test\_example module
--------------------------------------------------

.. automodule:: datadog_api_client.v2.model.test_example
:members:
:show-inheritance:

datadog\_api\_client.v2.model.test\_examples\_response module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.test_examples_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.test\_optimization\_delete\_service\_settings\_request module
-------------------------------------------------------------------------------------------

Expand Down
13 changes: 13 additions & 0 deletions examples/v2/test-examples/ListTestExamples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
List test examples returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.test_examples_api import TestExamplesApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = TestExamplesApi(api_client)
response = api_instance.list_test_examples()

print(response)
49 changes: 49 additions & 0 deletions src/datadog_api_client/v2/api/test_examples_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, Dict

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.v2.model.test_examples_response import TestExamplesResponse


class TestExamplesApi:
"""
Manage test example resources.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client

self._list_test_examples_endpoint = _Endpoint(
settings={
"response_type": (TestExamplesResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/test-examples",
"operation_id": "list_test_examples",
"http_method": "GET",
"version": "v2",
},
params_map={},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

def list_test_examples(
self,
) -> TestExamplesResponse:
"""List test examples.

Get a list of all test examples.

:rtype: TestExamplesResponse
"""
kwargs: Dict[str, Any] = {}
return self._list_test_examples_endpoint.call_with_http_info(**kwargs)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
from datadog_api_client.v2.api.storage_management_api import StorageManagementApi
from datadog_api_client.v2.api.synthetics_api import SyntheticsApi
from datadog_api_client.v2.api.teams_api import TeamsApi
from datadog_api_client.v2.api.test_examples_api import TestExamplesApi
from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi
from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi
from datadog_api_client.v2.api.users_api import UsersApi
Expand Down Expand Up @@ -219,6 +220,7 @@
"StorageManagementApi",
"SyntheticsApi",
"TeamsApi",
"TestExamplesApi",
"TestOptimizationApi",
"UsageMeteringApi",
"UsersApi",
Expand Down
53 changes: 53 additions & 0 deletions src/datadog_api_client/v2/model/test_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
datetime,
unset,
UnsetType,
)


class TestExample(ModelNormal):
@cached_property
def openapi_types(_):
return {
"created_at": (datetime,),
"id": (str,),
"name": (str,),
}

attribute_map = {
"created_at": "created_at",
"id": "id",
"name": "name",
}
read_only_vars = {
"created_at",
}

def __init__(self_, id: str, name: str, created_at: Union[datetime, UnsetType] = unset, **kwargs):
"""
A test example resource.

:param created_at: Creation time of the test example.
:type created_at: datetime, optional

:param id: The ID of the test example.
:type id: str

:param name: The name of the test example.
:type name: str
"""
if created_at is not unset:
kwargs["created_at"] = created_at
super().__init__(kwargs)

self_.id = id
self_.name = name
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/model/test_examples_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.test_example import TestExample


class TestExamplesResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.test_example import TestExample

return {
"data": ([TestExample],),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Union[List[TestExample], UnsetType] = unset, **kwargs):
"""
Response containing a list of test examples.

:param data:
:type data: [TestExample], optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7621,6 +7621,8 @@
)
from datadog_api_client.v2.model.tenancy_products_data_type import TenancyProductsDataType
from datadog_api_client.v2.model.tenancy_products_list import TenancyProductsList
from datadog_api_client.v2.model.test_example import TestExample
from datadog_api_client.v2.model.test_examples_response import TestExamplesResponse
from datadog_api_client.v2.model.test_optimization_delete_service_settings_request import (
TestOptimizationDeleteServiceSettingsRequest,
)
Expand Down Expand Up @@ -13543,6 +13545,8 @@
"TenancyProductsDataAttributesProductsItems",
"TenancyProductsDataType",
"TenancyProductsList",
"TestExample",
"TestExamplesResponse",
"TestOptimizationDeleteServiceSettingsRequest",
"TestOptimizationDeleteServiceSettingsRequestAttributes",
"TestOptimizationDeleteServiceSettingsRequestData",
Expand Down
12 changes: 12 additions & 0 deletions tests/v2/features/test_examples.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@endpoint(test-examples) @endpoint(test-examples-v2)
Feature: Test Examples
Manage test example resources.

@generated @skip @team:DataDog/webframeworks-test
Scenario: List test examples returns "OK" response
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "TestExamples" API
And new "ListTestExamples" request
When the request is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions tests/v2/features/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7776,6 +7776,12 @@
"type": "idempotent"
}
},
"ListTestExamples": {
"tag": "Test Examples",
"undo": {
"type": "safe"
}
},
"UpdateFlakyTests": {
"tag": "Test Optimization",
"undo": {
Expand Down
Loading