Skip to content

Commit 285df4a

Browse files
api-clients-generation-pipeline[bot]HantingZhang2ci.datadog-api-spec
authored
Enable create azure integration test (#1793)
* change uuid generation * use uuid * Regenerate client from commit 358fd0af of spec repo --------- Co-authored-by: HantingZhang2 <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent cb9ee82 commit 285df4a

File tree

8 files changed

+67
-13
lines changed

8 files changed

+67
-13
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-12-15 15:50:51.303374",
8-
"spec_repo_commit": "56bcf717"
7+
"regenerated": "2023-12-15 16:54:06.684134",
8+
"spec_repo_commit": "358fd0af"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-12-15 15:50:51.318688",
13-
"spec_repo_commit": "56bcf717"
12+
"regenerated": "2023-12-15 16:54:06.731519",
13+
"spec_repo_commit": "358fd0af"
1414
}
1515
}
1616
}

.generator/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ def unique(request):
183183
},
184184
}
185185

186-
187186
def relative_time(imports, calls, freezed_time, iso):
188187
time_re = re.compile(r"now( *([+-]) *(\d+)([smhdMy]))?")
189188

@@ -229,7 +228,6 @@ def store_calls(arg):
229228

230229
return store_calls
231230

232-
233231
@pytest.fixture
234232
def context(request, unique, freezed_time):
235233
"""
@@ -266,6 +264,7 @@ def is_used(self, key):
266264
"unique_hash": unique_hash,
267265
"timestamp": relative_time(imports, replace_values, freezed_time, False),
268266
"timeISO": relative_time(imports, replace_values, freezed_time, True),
267+
"uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
269268
"_replace_values": replace_values,
270269
"_imports": imports,
271270
"_given": given,

examples/v1/azure-integration/CreateAzureIntegration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
body = AzureAccount(
1010
app_service_plan_filters="key:value,filter:example",
1111
automute=True,
12-
client_id="testc7f6-1234-5678-9101-3fcbf464test",
12+
client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
1313
client_secret="testingx./Sw*g/Y33t..R1cH+hScMDt",
1414
container_app_filters="key:value,filter:example",
1515
cspm_enabled=True,
@@ -18,10 +18,10 @@
1818
"*",
1919
],
2020
host_filters="key:value,filter:example",
21-
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
22-
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
21+
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
22+
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2323
resource_collection_enabled=True,
24-
tenant_name="testc44-1234-5678-9101-cc00736ftest",
24+
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2525
)
2626

2727
configuration = Configuration()

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ def func(arg):
191191
return func
192192

193193

194+
def generate_uuid(freezed_time):
195+
freezed_time_string = str(freezed_time.timestamp())
196+
return freezed_time_string[:8] + "-0000-0000-0000-" + freezed_time_string[:10] + "00"
197+
198+
194199
@pytest.fixture
195200
def context(vcr, unique, freezed_time):
196201
"""
@@ -209,6 +214,7 @@ def context(vcr, unique, freezed_time):
209214
"unique_hash": unique_hash,
210215
"timestamp": relative_time(freezed_time, False),
211216
"timeISO": relative_time(freezed_time, True),
217+
"uuid": generate_uuid(freezed_time),
212218
}
213219

214220
yield ctx
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-12-08T15:34:43.210Z
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interactions:
2+
- request:
3+
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17020496-0000-0000-0000-170204968300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17020496-0000-0000-0000-170204968300","new_tenant_name":"17020496-0000-0000-0000-170204968300","resource_collection_enabled":true,"tenant_name":"17020496-0000-0000-0000-170204968300"}'
4+
headers:
5+
accept:
6+
- application/json
7+
content-type:
8+
- application/json
9+
method: POST
10+
uri: https://api.datadoghq.com/api/v1/integration/azure
11+
response:
12+
body:
13+
string: '{}
14+
15+
'
16+
headers:
17+
content-type:
18+
- application/json
19+
status:
20+
code: 200
21+
message: OK
22+
- request:
23+
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17020496-0000-0000-0000-170204968300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17020496-0000-0000-0000-170204968300","new_tenant_name":"17020496-0000-0000-0000-170204968300","resource_collection_enabled":true,"tenant_name":"17020496-0000-0000-0000-170204968300"}'
24+
headers:
25+
accept:
26+
- application/json
27+
content-type:
28+
- application/json
29+
method: DELETE
30+
uri: https://api.datadoghq.com/api/v1/integration/azure
31+
response:
32+
body:
33+
string: '{}
34+
35+
'
36+
headers:
37+
content-type:
38+
- application/json
39+
status:
40+
code: 200
41+
message: OK
42+
version: 1

tests/v1/features/azure_integration.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Feature: Azure Integration
1616
When the request is sent
1717
Then the response status is 400 Bad Request
1818

19-
@generated @skip @team:DataDog/azure-integrations
19+
@team:DataDog/azure-integrations
2020
Scenario: Create an Azure integration returns "OK" response
2121
Given new "CreateAzureIntegration" request
22-
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "testc7f6-1234-5678-9101-3fcbf464test", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test", "new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest", "resource_collection_enabled": true, "tenant_name": "testc44-1234-5678-9101-cc00736ftest"}
22+
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "{{ uuid }}", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "{{ uuid }}", "new_tenant_name": "{{ uuid }}", "resource_collection_enabled": true, "tenant_name": "{{ uuid }}"}
2323
When the request is sent
2424
Then the response status is 200 OK
2525

tests/v1/features/undo.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,13 @@
485485
"tag": "Azure Integration",
486486
"undo": {
487487
"operationId": "DeleteAzureIntegration",
488-
"parameters": [],
488+
"parameters": [
489+
{
490+
"name": "body",
491+
"origin": "request",
492+
"template": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"{{client_id}}\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"container_app_filters\": \"key:value,filter:example\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\"*\"],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"{{new_client_id}}\",\n \"new_tenant_name\": \"{{new_tenant_name}}\",\n \"resource_collection_enabled\": true,\n \"tenant_name\": \"{{tenant_name}}\"\n}"
493+
}
494+
],
489495
"type": "unsafe"
490496
}
491497
},

0 commit comments

Comments
 (0)