From b80db1b7e5ebde0e83f2b84e9f8825531171136a Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Mon, 9 Sep 2024 17:40:15 +0200 Subject: [PATCH] UserLocal: Add Tests for (FGTMonitorUserLocal)ChangePassword with FortiOS >= 7.4 --- Tests/integration/UserLocal.Tests.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tests/integration/UserLocal.Tests.ps1 b/Tests/integration/UserLocal.Tests.ps1 index c7bc57c7c..ff46a10d5 100644 --- a/Tests/integration/UserLocal.Tests.ps1 +++ b/Tests/integration/UserLocal.Tests.ps1 @@ -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 @@ -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"