Skip to content
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

New-DbaDbUser: Refactoring and bugfixing #9386

Merged
merged 10 commits into from
Jun 29, 2024
Prev Previous commit
Next Next commit
fix tests (do New-DbaDbUser)
andreasjordan committed Jun 8, 2024
commit 15d26aac69ac92b899cae1d20541cca10afd908d
4 changes: 2 additions & 2 deletions tests/New-DbaDbUser.Tests.ps1
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan
Describe "$CommandName Unit Tests" -Tag 'UnitTests' {
Context "Validate parameters" {
[object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object { $_ -notin ('whatif', 'confirm') }
[object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeSystem', 'Login', 'Username', 'Password', 'DefaultSchema', 'ExternalProvider', 'Force', 'EnableException'
[object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'IncludeSystem', 'Username', 'Login', 'SecurePassword', 'ExternalProvider', 'DefaultSchema', 'Force', 'EnableException'
$knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters
It "Should only contain our specific parameters" {
(@(Compare-Object -ReferenceObject ($knownParameters | Where-Object { $_ }) -DifferenceObject $params).Count ) | Should Be 0
@@ -37,7 +37,7 @@ Describe "$CommandName Integration Tests" -Tag "IntegrationTests" {
It "Tries to create the user with an invalid default schema" {
$results = New-DbaDbUser -SqlInstance $script:instance2 -Database $dbname -Login $userName -DefaultSchema invalidSchemaName -WarningVariable warningMessage
$results | Should -BeNullOrEmpty
$warningMessage | Should -BeLike "*Invalid DefaultSchema*"
$warningMessage | Should -BeLike "*Schema [invalidSchemaName] does not exist in database*"
}
}
Context "Should create the user with login" {