Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Moreau committed Aug 30, 2024
1 parent c45ff78 commit 51e43a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
14 changes: 7 additions & 7 deletions PowerFGT/Public/cmdb/user/local.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,17 @@ function Set-FGTUserLocal {

if ( $PsBoundParameters.ContainsKey('two_factor') ) {
if ( $two_factor -eq "fortitoken" -or $two_factor -eq "fortitoken-cloud" ) {
$local | add-member -name "two-factor" -membertype NoteProperty -Value $two_factor
$local | add-member -name "two-factor-authentication" -membertype NoteProperty -Value "fortitoken"
$local | add-member -name "fortitoken" -membertype NoteProperty -Value $fortitoken
$_local | add-member -name "two-factor" -membertype NoteProperty -Value $two_factor
$_local | add-member -name "two-factor-authentication" -membertype NoteProperty -Value "fortitoken"
$_local | add-member -name "fortitoken" -membertype NoteProperty -Value $fortitoken
}
elseif ( $two_factor -eq "email" ) {
$local | add-member -name "two-factor" -membertype NoteProperty -Value $two_factor
$local | add-member -name "two-factor-authentication" -membertype NoteProperty -Value "email"
$_local | add-member -name "two-factor" -membertype NoteProperty -Value $two_factor
$_local | add-member -name "two-factor-authentication" -membertype NoteProperty -Value $two_factor
}
elseif ( $two_factor -eq "sms" ) {
$local | add-member -name "two-factor" -membertype NoteProperty -Value $two_factor
$local | add-member -name "two-factor-authentication" -membertype NoteProperty -Value "sms"
$_local | add-member -name "two-factor" -membertype NoteProperty -Value $two_factor
$_local | add-member -name "two-factor-authentication" -membertype NoteProperty -Value $two_factor++
}
}

Expand Down
9 changes: 4 additions & 5 deletions Tests/integration/UserLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ Describe "Add User Local" {
$userlocal.name | Should -Be $pester_userlocal
$userlocal.status | Should -Be "enable"
$userlocal.'email-to' | Should -Be "[email protected]"
$userlocal.'two-factor' | Should -Be "email"
}

It "Try to Add User Local $pester_userlocal (but there is already a object with same name)" {
Expand Down Expand Up @@ -167,15 +166,15 @@ Describe "Configure User Local" {

It "Change email to with -data" {
$data = @{ "email-to" = "[email protected]" }
Get-FGTUserLocal -name $pester_userlocal | Set-FGTUserLocal -data $data
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Get-FGTUserLocal -name "pester_userlocal_change" | Set-FGTUserLocal -data $data
$userlocal = Get-FGTUserLocal -name "pester_userlocal_change"
$userlocal.name | Should -Be "pester_userlocal_change"
$userlocal.status | Should -Be "disable"
$userlocal.'email-to' | Should -Be "[email protected]"
$userlocal.'two-factor' | Should -Be "disable"
}

AfterEach {
AfterAll {
Get-FGTUserLocal -name "pester_userlocal_change" | Remove-FGTUserLocal -confirm:$false
}

Expand Down

0 comments on commit 51e43a1

Please sign in to comment.