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

Fix Tests with FortiOS 7.6.0 #258

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion PowerFGT/Public/monitor/firewall/session.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ function Get-FGTMonitorFirewallSession {
$count = 1000
}

$uri = "api/v2/monitor/firewall/session?count=${count}"
#before 7.6.x, it is session (and not sessions) (already available with 7.4.x) but session drop with 7.6.)
if ($connection.version -lt "7.6.0") {
$uri = "api/v2/monitor/firewall/session?count=${count}"
}
else {
$uri = "api/v2/monitor/firewall/sessions?count=${count}"
}

if ( $PsBoundParameters.ContainsKey('summary') ) {
$uri += "&summary=$true"
Expand Down
17 changes: 15 additions & 2 deletions PowerFGT/Public/monitor/system/config/backup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,21 @@ function Get-FGTMonitorSystemConfigBackup {
$invokeParams.add( 'vdom', $vdom )
}

$uri = 'api/v2/monitor/system/config/backup?scope=global'
$response = Invoke-FGTRestMethod -uri $uri -method 'GET' -connection $connection @invokeParams
#before 7.6.x, config/backup is available with get method and using paramater
if ($connection.version -lt "7.6.0") {
$method = "get"
$uri = 'api/v2/monitor/system/config/backup?scope=global'
$body = ""
}
else {
$method = "post"
$uri = 'api/v2/monitor/system/config/backup'
$body = @{
"scope" = "global"
}
}

$response = Invoke-FGTRestMethod -uri $uri -method $method -body $body -connection $connection @invokeParams
$response
}

Expand Down
6 changes: 3 additions & 3 deletions Tests/integration/SystemSettings.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Describe "Set System Settings" {
$script:settings = Get-FGTSystemSettings
}

#Coming with FortiOS 7.2.x and need for some feature (like waf, ztna.. )
It "Change gui-proxy-inspection to enable" -skip:($fgt_version -lt "7.2.0") {
#Coming with FortiOS 7.2.x and need for some feature (like waf, ztna.. ) and remove with 7.6.0...
It "Change gui-proxy-inspection to enable" -skip:($fgt_version -lt "7.2.0" -or $fgt_version -ge "7.6.0") {
Set-FGTSystemSettings -gui_proxy_inspection
$ss = Get-FGTSystemSettings
$ss.'gui-proxy-inspection' | Should -Be "enable"
Expand Down Expand Up @@ -351,7 +351,7 @@ Describe "Set System Settings" {
$ss.'lldp-reception' | Should -Be "global"
}

It "Change gui-proxy-inspection to disable" -skip:($fgt_version -lt "7.2.0") {
It "Change gui-proxy-inspection to disable" -skip:($fgt_version -lt "7.2.0" -or $fgt_version -ge "7.6.0") {
Set-FGTSystemSettings -gui_proxy_inspection:$false
$ss = Get-FGTSystemSettings
$ss.'gui-proxy-inspection' | Should -Be "disable"
Expand Down
Loading