@@ -15,15 +15,117 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzCdnOrigin'))
15
15
}
16
16
17
17
Describe ' Get-AzCdnOrigin' {
18
- It ' List' - skip {
19
- { throw [System.NotImplementedException ] } | Should -Not - Throw
18
+ It ' List' {
19
+ {
20
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
21
+ try
22
+ {
23
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
24
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
25
+
26
+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
27
+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
28
+
29
+ $profileSku = " Standard_Microsoft" ;
30
+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
31
+
32
+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
33
+ $origin = @ {
34
+ Name = " origin1"
35
+ HostName = " host1.hello.com"
36
+ };
37
+ $location = " westus"
38
+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) , origin.Name : $ ( $origin.Name ) , origin.HostName : $ ( $origin.HostName ) "
39
+
40
+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location - Origin $origin
41
+ $origins = Get-AzCdnOrigin - EndpointName $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName
42
+
43
+ $origins.Count | Should - Be 1
44
+ } Finally
45
+ {
46
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
47
+ }
48
+ } | Should -Not - Throw
20
49
}
21
50
22
- It ' Get' - skip {
23
- { throw [System.NotImplementedException ] } | Should -Not - Throw
51
+ It ' Get' {
52
+ {
53
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
54
+ try
55
+ {
56
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
57
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
58
+
59
+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
60
+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
61
+
62
+ $profileSku = " Standard_Microsoft" ;
63
+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
64
+
65
+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
66
+ $originName = " origin1"
67
+ $originHostName = " host1.hello.com"
68
+ $originHttpPort = 80
69
+ $origin = @ {
70
+ Name = $originName
71
+ HostName = $originHostName
72
+ HttpPort = $originHttpPort
73
+ };
74
+ $location = " westus"
75
+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) , origin.Name : $ ( $origin.Name ) , origin.HostName : $ ( $origin.HostName ) "
76
+
77
+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location - Origin $origin
78
+ $origin = Get-AzCdnOrigin - Name $originName - EndpointName $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName
79
+
80
+ $origin.Name | Should - Be $originName
81
+ $origin.HostName | Should - Be $originHostName
82
+ $origin.HttpPort | Should - Be $originHttpPort
83
+ $origin.HttpsPort | Should - Be $null
84
+ } Finally
85
+ {
86
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
87
+ }
88
+ } | Should -Not - Throw
24
89
}
25
90
26
- It ' GetViaIdentity' - skip {
27
- { throw [System.NotImplementedException ] } | Should -Not - Throw
91
+ It ' GetViaIdentity' {
92
+ {
93
+ $PSDefaultParameterValues [' Disabled' ] = $true
94
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
95
+ try
96
+ {
97
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
98
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
99
+
100
+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
101
+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
102
+
103
+ $profileSku = " Standard_Microsoft" ;
104
+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
105
+
106
+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
107
+ $originName = " origin1"
108
+ $originHostName = " host1.hello.com"
109
+ $originHttpPort = 80
110
+ $origin = @ {
111
+ Name = $originName
112
+ HostName = $originHostName
113
+ HttpPort = $originHttpPort
114
+ };
115
+ $location = " westus"
116
+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) , origin.Name : $ ( $origin.Name ) , origin.HostName : $ ( $origin.HostName ) "
117
+
118
+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location - Origin $origin
119
+ $origin = Get-AzCdnOrigin - Name $originName - EndpointName $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName | Get-AzCdnOrigin
120
+
121
+ $origin.Name | Should - Be $originName
122
+ $origin.HostName | Should - Be $originHostName
123
+ $origin.HttpPort | Should - Be $originHttpPort
124
+ $origin.HttpsPort | Should - Be $null
125
+ } Finally
126
+ {
127
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
128
+ }
129
+ } | Should -Not - Throw
28
130
}
29
131
}
0 commit comments