Skip to content

Commit c4c328c

Browse files
committed
Enhance New-SqlDscLogin tests to verify login creation and return values for various login types
1 parent 0ca2176 commit c4c328c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/Unit/Public/New-SqlDscLogin.Tests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ Describe 'New-SqlDscLogin' -Tag 'Public' {
303303
$script:mockSecurePassword = ConvertTo-SecureString -String 'P@ssw0rd1' -AsPlainText -Force
304304
}
305305

306-
It 'Should create a SQL Server login without throwing' {
306+
It 'Should create a SQL Server login and invoke Test-SqlDscIsLogin' {
307307
$null = New-SqlDscLogin -ServerObject $script:mockServerObject -Name 'TestLogin' -SqlLogin -SecurePassword $script:mockSecurePassword -Confirm:$false
308308

309309
Should -Invoke -CommandName Test-SqlDscIsLogin -Exactly -Times 1 -Scope It
310310
}
311311
}
312312

313313
Context 'When creating a Windows user login' {
314-
It 'Should create a Windows user login without throwing' {
314+
It 'Should create a Windows user login and return the created object' {
315315
$result = New-SqlDscLogin -ServerObject $script:mockServerObject -Name 'DOMAIN\TestUser' -WindowsUser -PassThru -Confirm:$false
316316

317317
$result | Should -Not -BeNullOrEmpty
@@ -351,7 +351,7 @@ Describe 'New-SqlDscLogin' -Tag 'Public' {
351351
Should -Invoke -CommandName Test-SqlDscIsLogin -Exactly -Times 1 -Scope It
352352
}
353353

354-
It 'Should create login without throwing when PassThru is not specified' {
354+
It 'Should not return a login object when PassThru is not specified' {
355355
$result = New-SqlDscLogin -ServerObject $script:mockServerObject -Name 'TestLogin2' -SqlLogin -SecurePassword $script:mockSecurePassword -Confirm:$false
356356
$result | Should -BeNullOrEmpty
357357

@@ -360,7 +360,7 @@ Describe 'New-SqlDscLogin' -Tag 'Public' {
360360
}
361361

362362
Context 'When creating certificate-based login' {
363-
It 'Should create a certificate login without throwing' {
363+
It 'Should create a certificate login and return the created object' {
364364
$result = New-SqlDscLogin -ServerObject $script:mockServerObject -Name 'CertLogin' -Certificate -CertificateName 'MyCert' -PassThru -Confirm:$false
365365

366366
$result | Should -Not -BeNullOrEmpty
@@ -371,7 +371,7 @@ Describe 'New-SqlDscLogin' -Tag 'Public' {
371371
}
372372

373373
Context 'When creating asymmetric key-based login' {
374-
It 'Should create an asymmetric key login without throwing' {
374+
It 'Should create an asymmetric key login and return the created object' {
375375
$result = New-SqlDscLogin -ServerObject $script:mockServerObject -Name 'KeyLogin' -AsymmetricKey -AsymmetricKeyName 'MyKey' -PassThru -Confirm:$false
376376

377377
$result | Should -Not -BeNullOrEmpty
@@ -382,7 +382,7 @@ Describe 'New-SqlDscLogin' -Tag 'Public' {
382382
}
383383

384384
Context 'When creating Windows group login' {
385-
It 'Should create a Windows group login without throwing' {
385+
It 'Should create a Windows group login and return the created object' {
386386
$result = New-SqlDscLogin -ServerObject $script:mockServerObject -Name 'NT AUTHORITY\SYSTEM' -WindowsGroup -PassThru -Confirm:$false
387387

388388
$result | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)