Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test support for file parameters #1839

Merged
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-01-18 23:59:52.072244",
"spec_repo_commit": "7dba000a"
"regenerated": "2024-01-19 15:18:14.559252",
"spec_repo_commit": "b407748b"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-01-18 23:59:52.086183",
"spec_repo_commit": "7dba000a"
"regenerated": "2024-01-19 15:18:14.573971",
"spec_repo_commit": "b407748b"
}
}
}
10 changes: 8 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
from datadog_api_client import exceptions
from datadog_api_client.api_client import ApiClient
from datadog_api_client.configuration import Configuration
from datadog_api_client.model_utils import OpenApiModel
from datadog_api_client.model_utils import OpenApiModel, file_type

logging.basicConfig()

Expand Down Expand Up @@ -581,7 +581,13 @@ def execute_request(undo, context, client, api_version, request):

params_map = getattr(api_request["api"], f'_{api_request["request"].__name__}_endpoint').params_map
for k, v in api_request["kwargs"].items():
api_request["kwargs"][k] = client.deserialize(v, params_map[k]["openapi_types"], True)
openapi_types = params_map[k]["openapi_types"]
if openapi_types == (file_type,):
filepath = os.path.join(os.path.dirname(__file__), api_version, "features", json.loads(v))
# We let the GC collects it, this shouldn't be an issue
api_request["kwargs"][k] = open(filepath)
else:
api_request["kwargs"][k] = client.deserialize(v, openapi_types, True)

try:
response = api_request["request"](*api_request["args"], **api_request["kwargs"])
Expand Down
2 changes: 1 addition & 1 deletion tests/v2/features/organizations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Organizations
When the request is sent
Then the response status is 400 Bad Request

@skip-go @skip-java @skip-python @skip-ruby @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/team-aaa-identity
@integration-only @skip-terraform-config @skip-validation @team:DataDog/team-aaa-identity
Scenario: Upload IdP metadata returns "OK" response
Given request contains "idp_file" parameter with value "fixtures/organizations/saml_configurations/valid_idp_metadata.xml"
When the request is sent
Expand Down
Loading