Skip to content

Commit 80e941f

Browse files
authored
Merge pull request Azure#5 from LucasYao93/lucas/generate-timeseriesinsights-test
Add test cases for timeseriesinsights.
2 parents b1f88b0 + 2c05345 commit 80e941f

File tree

42 files changed

+4661
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4661
-0
lines changed

src/TimeSeriesInsights/readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ directive:
6161
- from: swagger-document
6262
where: $
6363
transform: return $.replace(/Microsoft.IotHub/g, "Microsoft.IoTHub")
64+
<<<<<<< HEAD
65+
=======
66+
- from: swagger-document
67+
where: $
68+
transform: return $.replace(/\/eventSources\//g, "/eventsources/")
69+
- from: swagger-document
70+
where: $
71+
transform: return $.replace(/\/accessPolicies\//g, "/accesspolicies/")
72+
>>>>>>> upstream/generation
6473
# Remove the unneeded parameter set
6574
- where:
6675
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$

src/TimeSeriesInsights/test/Az.TimeSeriesInsights-TestResults.xml

Lines changed: 173 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
{
2+
"Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accessPolicies?api-version=2018-08-15-preview+1": {
3+
"Request": {
4+
"Method": "GET",
5+
"RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accessPolicies?api-version=2018-08-15-preview",
6+
"Content": null,
7+
"Headers": {
8+
"x-ms-unique-id": [ "1" ],
9+
"x-ms-client-request-id": [ "375839ab-258d-49a8-b6ea-8a1e2e7dc011" ],
10+
"CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ],
11+
"FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_List" ],
12+
"ParameterSetName": [ "__AllParameterSets" ],
13+
"User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ],
14+
"Authorization": [ "[Filtered]" ]
15+
},
16+
"ContentHeaders": {
17+
}
18+
},
19+
"Response": {
20+
"StatusCode": 200,
21+
"Headers": {
22+
"Cache-Control": [ "no-cache" ],
23+
"Pragma": [ "no-cache" ],
24+
"x-ms-ratelimit-remaining-subscription-reads": [ "11994" ],
25+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
26+
"X-Content-Type-Options": [ "nosniff" ],
27+
"x-ms-request-id": [ "ed88bb0c-5792-49a9-9062-f61400acba11" ],
28+
"Server": [ "Microsoft-HTTPAPI/2.0" ],
29+
"x-ms-correlation-request-id": [ "278bb98b-9033-45f5-8300-c372de0e1a02" ],
30+
"x-ms-routing-request-id": [ "SOUTHEASTASIA:20200402T113147Z:278bb98b-9033-45f5-8300-c372de0e1a02" ],
31+
"Date": [ "Thu, 02 Apr 2020 11:31:47 GMT" ]
32+
},
33+
"ContentHeaders": {
34+
"Content-Length": [ "378" ],
35+
"Content-Type": [ "application/json" ],
36+
"Expires": [ "-1" ]
37+
},
38+
"Content": "{\"value\":[{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo\",\"name\":\"tsi-apr3q8wo\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}]}"
39+
}
40+
},
41+
"Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo?api-version=2018-08-15-preview+1": {
42+
"Request": {
43+
"Method": "GET",
44+
"RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo?api-version=2018-08-15-preview",
45+
"Content": null,
46+
"Headers": {
47+
"x-ms-unique-id": [ "2" ],
48+
"x-ms-client-request-id": [ "43c6ba87-619d-45ca-b67a-f30c7b49c12f" ],
49+
"CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ],
50+
"FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_Get" ],
51+
"ParameterSetName": [ "__AllParameterSets" ],
52+
"User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ],
53+
"Authorization": [ "[Filtered]" ]
54+
},
55+
"ContentHeaders": {
56+
}
57+
},
58+
"Response": {
59+
"StatusCode": 200,
60+
"Headers": {
61+
"Cache-Control": [ "no-cache" ],
62+
"Pragma": [ "no-cache" ],
63+
"x-ms-ratelimit-remaining-subscription-reads": [ "11993" ],
64+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
65+
"X-Content-Type-Options": [ "nosniff" ],
66+
"x-ms-request-id": [ "919670c2-fa6a-4ba8-a39c-5f47333859ed" ],
67+
"Server": [ "Microsoft-HTTPAPI/2.0" ],
68+
"x-ms-correlation-request-id": [ "70713022-0e53-48aa-8950-ea51c3c23b27" ],
69+
"x-ms-routing-request-id": [ "SOUTHEASTASIA:20200402T113148Z:70713022-0e53-48aa-8950-ea51c3c23b27" ],
70+
"Date": [ "Thu, 02 Apr 2020 11:31:47 GMT" ]
71+
},
72+
"ContentHeaders": {
73+
"Content-Length": [ "366" ],
74+
"Content-Type": [ "application/json" ],
75+
"Expires": [ "-1" ]
76+
},
77+
"Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo\",\"name\":\"tsi-apr3q8wo\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}"
78+
}
79+
},
80+
"Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo?api-version=2018-08-15-preview+1": {
81+
"Request": {
82+
"Method": "GET",
83+
"RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo?api-version=2018-08-15-preview",
84+
"Content": null,
85+
"Headers": {
86+
"x-ms-unique-id": [ "3" ],
87+
"x-ms-client-request-id": [ "310003bf-3b8f-4e19-8fb7-f9eb5de19b85" ],
88+
"CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ],
89+
"FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_Get" ],
90+
"ParameterSetName": [ "__AllParameterSets" ],
91+
"User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ],
92+
"Authorization": [ "[Filtered]" ]
93+
},
94+
"ContentHeaders": {
95+
}
96+
},
97+
"Response": {
98+
"StatusCode": 200,
99+
"Headers": {
100+
"Cache-Control": [ "no-cache" ],
101+
"Pragma": [ "no-cache" ],
102+
"x-ms-ratelimit-remaining-subscription-reads": [ "11992" ],
103+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
104+
"X-Content-Type-Options": [ "nosniff" ],
105+
"x-ms-request-id": [ "362683e7-ac93-4f21-bfe0-016d998b1c5b" ],
106+
"Server": [ "Microsoft-HTTPAPI/2.0" ],
107+
"x-ms-correlation-request-id": [ "3aa70351-ae48-44b7-950e-3bb7e619f6eb" ],
108+
"x-ms-routing-request-id": [ "SOUTHEASTASIA:20200402T113148Z:3aa70351-ae48-44b7-950e-3bb7e619f6eb" ],
109+
"Date": [ "Thu, 02 Apr 2020 11:31:48 GMT" ]
110+
},
111+
"ContentHeaders": {
112+
"Content-Length": [ "366" ],
113+
"Content-Type": [ "application/json" ],
114+
"Expires": [ "-1" ]
115+
},
116+
"Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo\",\"name\":\"tsi-apr3q8wo\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}"
117+
}
118+
},
119+
"Get-AzTimeSeriesInsightsAccessPolicy+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo?api-version=2018-08-15-preview+2": {
120+
"Request": {
121+
"Method": "GET",
122+
"RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo?api-version=2018-08-15-preview",
123+
"Content": null,
124+
"Headers": {
125+
"x-ms-unique-id": [ "4" ],
126+
"x-ms-client-request-id": [ "bebaa654-0a4e-42f3-8f9f-7beb7ed97cb8" ],
127+
"CommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy" ],
128+
"FullCommandName": [ "Get-AzTimeSeriesInsightsAccessPolicy_GetViaIdentity" ],
129+
"ParameterSetName": [ "__AllParameterSets" ],
130+
"User-Agent": [ "AzurePowerShell/Az4.0.0-preview" ],
131+
"Authorization": [ "[Filtered]" ]
132+
},
133+
"ContentHeaders": {
134+
}
135+
},
136+
"Response": {
137+
"StatusCode": 200,
138+
"Headers": {
139+
"Cache-Control": [ "no-cache" ],
140+
"Pragma": [ "no-cache" ],
141+
"x-ms-ratelimit-remaining-subscription-reads": [ "11991" ],
142+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
143+
"X-Content-Type-Options": [ "nosniff" ],
144+
"x-ms-request-id": [ "ec2ce78a-08ea-4b6a-980d-5dee62a5a219" ],
145+
"Server": [ "Microsoft-HTTPAPI/2.0" ],
146+
"x-ms-correlation-request-id": [ "b61b675f-b9a0-4251-8808-6535b1cebe59" ],
147+
"x-ms-routing-request-id": [ "SOUTHEASTASIA:20200402T113149Z:b61b675f-b9a0-4251-8808-6535b1cebe59" ],
148+
"Date": [ "Thu, 02 Apr 2020 11:31:48 GMT" ]
149+
},
150+
"ContentHeaders": {
151+
"Content-Length": [ "366" ],
152+
"Content-Type": [ "application/json" ],
153+
"Expires": [ "-1" ]
154+
},
155+
"Content": "{\"properties\":{\"principalObjectId\":\"97deab6c-e478-40b4-b4da-e7d9353dc1e8\",\"roles\":[\"Reader\"]},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/tsi-test-796bte/providers/Microsoft.TimeSeriesInsights/environments/tsi-envr0gwcm/accesspolicies/tsi-apr3q8wo\",\"name\":\"tsi-apr3q8wo\",\"type\":\"Microsoft.TimeSeriesInsights/Environments/AccessPolicies\"}"
156+
}
157+
}
158+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
2+
if (-Not (Test-Path -Path $loadEnvPath)) {
3+
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
4+
}
5+
. ($loadEnvPath)
6+
$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzTimeSeriesInsightsAccessPolicy.Recording.json'
7+
$currentPath = $PSScriptRoot
8+
while(-not $mockingPath) {
9+
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
10+
$currentPath = Split-Path -Path $currentPath -Parent
11+
}
12+
. ($mockingPath | Select-Object -First 1).FullName
13+
14+
Describe 'Get-AzTimeSeriesInsightsAccessPolicy' {
15+
It 'List' {
16+
$policyList = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup
17+
$policyList.Count | Should -Be 1
18+
}
19+
20+
It 'Get' {
21+
$policy = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.accessPolicy
22+
$policy.Name | Should -Be $env.accessPolicy
23+
}
24+
25+
It 'GetViaIdentity' {
26+
$policy01 = Get-AzTimeSeriesInsightsAccessPolicy -EnvironmentName $env.tsiEnvName -ResourceGroupName $env.resourceGroup -Name $env.accessPolicy
27+
$policy = Get-AzTimeSeriesInsightsAccessPolicy -InputObject $policy01
28+
$policy.Name | Should -Be $env.accessPolicy
29+
}
30+
}

0 commit comments

Comments
 (0)