Skip to content

Commit

Permalink
UserLocal: Add Tests for (FGTMonitorUserLocal)ChangePassword with For…
Browse files Browse the repository at this point in the history
…tiOS >= 7.4
  • Loading branch information
alagoutte committed Sep 9, 2024
1 parent 15e4e7b commit b80db1b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Tests/integration/UserLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Describe "Configure User Local" {
$userlocal.'two-factor' | Should -Be "email"
}

It "Change Password (Before 7.4.0)" -skip:($fgt_version -ge "7.4.0") {
It "Change Password (With FortiOS > 7.4.0)" -skip:($fgt_version -ge "7.4.0") {
Get-FGTUserLocal -name $pester_userlocal | Set-FGTUserLocal -passwd $mywrongpassword
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Expand All @@ -184,10 +184,20 @@ Describe "Configure User Local" {
$userlocal.'two-factor' | Should -Be "email"
}

It "Try to Change Password (With FortiOS > 7.4.0)" {
It "Try to Change Password (With FortiOS >= 7.4.0)" -skip:($fgt_version -lt "7.4.0") {
{ Get-FGTUserLocal -name $pester_userlocal | Set-FGTUserLocal -passwd $mywrongpassword } | Should -Throw "Can't change passwd with FortiOS > 7.4.0 (Need to use Set-FGTMonitorUserLocalChangePassword)"
}

It "Change Password (With FortiOS >= 7.4.0) with Set-FGTMonitorUserLocalChangePassword" -skip:($fgt_version -lt "7.4.0") {
Get-FGTUserLocal -name $pester_userlocal | Set-FGTMonitorUserLocalChangePassword -new_password $mywrongpassword
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
}

It "Try to Change Password (with FortiOS < 7.4.0) with Set-FGTMonitorUserLocalChangePassword" -skip:($fgt_version -ge "7.4.0") {
{ Get-FGTUserLocal -name $pester_userlocal | Set-FGTMonitorUserLocalChangePassword -new_password $mywrongpassword } | Should -Throw "You need to use Set-FGTLocalUser -passwd..."
}

It "Change Name" {
Get-FGTUserLocal -name $pester_userlocal | Set-FGTUserLocal -name "pester_userlocal_change"
$userlocal = Get-FGTUserLocal -name "pester_userlocal_change"
Expand Down

0 comments on commit b80db1b

Please sign in to comment.