Skip to content

Commit 05f46a7

Browse files
committed
Adding test case for new parameter.
1 parent 8530272 commit 05f46a7

File tree

2 files changed

+827
-14
lines changed

2 files changed

+827
-14
lines changed

src/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.ps1

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,16 @@ function Test-NewAzureRmAllKindsOfCognitiveServicesAccounts
6565
New-AzResourceGroup -Name $rgname -Location 'West US';
6666

6767
# Create all known kinds of Cognitive Services accounts.
68-
Test-CreateCognitiveServicesAccount $rgname 'AcademicTest' 'Academic' 'S0' $locWU
69-
Test-CreateCognitiveServicesAccount $rgname 'BingAutosuggestTest' 'Bing.Autosuggest' 'S1' $locGBL
70-
Test-CreateCognitiveServicesAccount $rgname 'BingSearchTest' 'Bing.Search' 'S1' $locGBL
71-
Test-CreateCognitiveServicesAccount $rgname 'BingSpeechTest' 'Bing.Speech' 'S0' $locGBL
72-
Test-CreateCognitiveServicesAccount $rgname 'BingSpellCheckTest' 'Bing.SpellCheck' 'S1' $locGBL
68+
Test-CreateCognitiveServicesAccount $rgname 'BingSearchTest' 'Bing.Search.v7' 'S1' $locGBL
69+
Test-CreateCognitiveServicesAccount $rgname 'BingSpeechTest' 'SpeechServices' 'S0' $locWU
70+
Test-CreateCognitiveServicesAccount $rgname 'BingSpellCheckTest' 'Bing.SpellCheck.v7' 'S1' $locGBL
7371
Test-CreateCognitiveServicesAccount $rgname 'ComputerVisionTest' 'ComputerVision' 'S0' $locWU
7472
Test-CreateCognitiveServicesAccount $rgname 'ContentModeratorTest' 'ContentModerator' 'S0' $locWU
75-
Test-CreateCognitiveServicesAccount $rgname 'EmotionTest' 'Emotion' 'S0' $locWU
7673
Test-CreateCognitiveServicesAccount $rgname 'FaceTest' 'Face' 'S0' $locWU
7774
Test-CreateCognitiveServicesAccount $rgname 'LUISTest' 'LUIS' 'S0' $locWU
78-
Test-CreateCognitiveServicesAccount $rgname 'RecommendationsTest' 'Recommendations' 'S1' $locWU
7975
Test-CreateCognitiveServicesAccount $rgname 'SpeakerRecognitionTest' 'SpeakerRecognition' 'S0' $locWU
80-
Test-CreateCognitiveServicesAccount $rgname 'SpeechTest' 'Speech' 'S0' $locWU
81-
Test-CreateCognitiveServicesAccount $rgname 'SpeechTranslationTest' 'SpeechTranslation' 'S1' $locGBL
8276
Test-CreateCognitiveServicesAccount $rgname 'TextAnalyticsTest' 'TextAnalytics' 'S1' $locWU
8377
Test-CreateCognitiveServicesAccount $rgname 'TextTranslationTest' 'TextTranslation' 'S1' $locGBL
84-
Test-CreateCognitiveServicesAccount $rgname 'WebLMTest' 'WebLM' 'S0' $locWU
8578
}
8679
finally
8780
{
@@ -292,6 +285,43 @@ function Test-NewAzureRmCognitiveServicesAccountKey
292285
}
293286
}
294287

288+
289+
<#
290+
.SYNOPSIS
291+
Test New-AzCognitiveServicesAccountKey
292+
#>
293+
function Test-NewAzureRmCognitiveServicesAccountWithCustomDomain
294+
{
295+
# Setup
296+
$rgname = Get-CognitiveServicesManagementTestResourceName;
297+
298+
try
299+
{
300+
# Test
301+
$accountname = 'csa' + $rgname;
302+
$skuname = 'S2';
303+
$accounttype = 'TextAnalytics';
304+
$loc = Get-Location -providerNamespace "Microsoft.CognitiveServices" -resourceType "accounts" -preferredLocation "West Central US";
305+
306+
New-AzResourceGroup -Name $rgname -Location $loc;
307+
308+
$createdAccount = New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc -CustomSubdomainName $accountname -Force;
309+
Assert-NotNull $createdAccount;
310+
# Call create again, expect to get the same account
311+
$createdAccountAgain = New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc -CustomSubdomainName $accountname -Force;
312+
Assert-NotNull $createdAccountAgain
313+
Assert-AreEqual $createdAccount.Name $createdAccountAgain.Name;
314+
Assert-AreEqual $createdAccount.Endpoint $createdAccountAgain.Endpoint;
315+
Assert-True {$createdAccount.Endpoint.Contains('cognitiveservices.azure.com')}
316+
Retry-IfException { Remove-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Force; }
317+
}
318+
finally
319+
{
320+
# Cleanup
321+
Clean-ResourceGroup $rgname
322+
}
323+
}
324+
295325
<#
296326
.SYNOPSIS
297327
Test Get-AzCognitiveServicesAccountSkus
@@ -306,13 +336,13 @@ function Test-GetAzureRmCognitiveServicesAccountSkus
306336
$skus = (Get-AzCognitiveServicesAccountSkus -Type 'TextAnalytics');
307337
$skuNames = $skus | Select-Object -ExpandProperty Name | Sort-Object | Get-Unique
308338

309-
$expectedSkus = "F0", "S0","S1", "S2", "S3", "S4"
339+
$expectedSkus = "F0", "S", "S0","S1", "S2", "S3", "S4"
310340
Assert-AreEqualArray $expectedSkus $skuNames
311341

312342
$skus = (Get-AzCognitiveServicesAccountSkus -Type 'TextAnalytics' -Location 'westus');
313343
$skuNames = $skus | Select-Object -ExpandProperty Name | Sort-Object | Get-Unique
314344

315-
$expectedSkus = "F0", "S0","S1", "S2", "S3", "S4"
345+
$expectedSkus = "F0", "S", "S0","S1", "S2", "S3", "S4"
316346
Assert-AreEqualArray $expectedSkus $skuNames
317347

318348
$skus = (Get-AzCognitiveServicesAccountSkus -Type 'QnAMaker' -Location 'global');
@@ -479,10 +509,10 @@ function Test-GetWithPaging
479509
New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name "facepaging_wu_$i" -Type 'Face' -SkuName 'S0' -Location $loc -Force;
480510
}
481511

482-
# 100 Emotion
512+
# 100 CV
483513
For($i = 0; $i -lt $TotalCount ; $i++)
484514
{
485-
New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name "emotionpaging_wu_$i" -Type 'Emotion' -SkuName 'S0' -Location $loc -Force;
515+
New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name "cvpaging_wu_$i" -Type 'ComputerVision' -SkuName 'S0' -Location $loc -Force;
486516
}
487517

488518
$accounts = Get-AzCognitiveServicesAccount

0 commit comments

Comments
 (0)