Skip to content

Add live test cases for bot service. #20830

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

Merged
merged 4 commits into from
Feb 2, 2023
Merged
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
71 changes: 71 additions & 0 deletions src/BotService/LiveTests/TestLiveScenarios.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Invoke-LiveTestScenario -Name "Create new registration bot service" -Description "Test creating a new registration bot service with all default values" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$botName = New-LiveTestResourceName
$botLocation = "westus"
$WebApplication1 = "ae96ba8b-3711-4464-abc4-9aeec3531a87"

$actual = New-AzBotService -ResourceGroupName $rgName -Name $botName -ApplicationId $WebApplication1 -Location $botLocation -Sku F0 -Description "description" -Registration
Assert-AreEqual $botName $actual.Name
Assert-AreEqual $botLocation $actual.Location
Assert-AreEqual "F0" $actual.Sku.Name
}

Invoke-LiveTestScenario -Name "List bot service" -Description "Test listing bot services in a resourcegroup" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$botName = New-LiveTestResourceName
$botLocation = "westus"
$WebApplication1 = "ae96ba8b-3711-4464-abc4-9aeec3531a87"

$null = New-AzBotService -ResourceGroupName $rgName -Name $botName -ApplicationId $WebApplication1 -Location $botLocation -Sku F0 -Description "description" -Registration
$actual = Get-AzBotService -ResourceGroupName $rgName
Assert-AreEqual 1 $actual.Count
}

Invoke-LiveTestScenario -Name "Get bot service" -Description "Test getting one specific bot service" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$botName = New-LiveTestResourceName
$botLocation = "westus"
$WebApplication1 = "ae96ba8b-3711-4464-abc4-9aeec3531a87"

$null = New-AzBotService -ResourceGroupName $rgName -Name $botName -ApplicationId $WebApplication1 -Location $botLocation -Sku F0 -Description "description" -Registration
$actual = Get-AzBotService -ResourceGroupName $rgName -Name $botName
Assert-AreEqual $botName $actual.Name
}

Invoke-LiveTestScenario -Name "Update bot service" -Description "Test Updating one specific bot service" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$botName = New-LiveTestResourceName
$botLocation = "westus"
$WebApplication1 = "ae96ba8b-3711-4464-abc4-9aeec3531a87"

$null = New-AzBotService -ResourceGroupName $rgName -Name $botName -ApplicationId $WebApplication1 -Location $botLocation -Sku F0 -Description "description" -Registration
$actual = Update-AzBotService -Name $botName -ResourceGroupName $rgName -Kind bot
Assert-AreEqual "bot" $actual.Kind
}

Invoke-LiveTestScenario -Name "Remove bot servcie" -Description "Test Removing a bot service" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$botName = New-LiveTestResourceName
$botLocation = "westus"
$WebApplication1 = "ae96ba8b-3711-4464-abc4-9aeec3531a87"

$null = New-AzBotService -ResourceGroupName $rgName -Name $botName -ApplicationId $WebApplication1 -Location $botLocation -Sku F0 -Description "description" -Registration
Invoke-LiveTestCommand -Command "Remove-AzBotService -ResourceGroupName $rgName -Name $botName"
$GetServiceList = Get-AzBotService
Assert-False { $GetServiceList.Name -contains $botName}
}