Skip to content

Commit

Permalink
Add Meta tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Moreau committed Sep 4, 2024
1 parent 1c745fc commit fe190b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion PowerFGT/Public/cmdb/user/local.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ function Add-FGTUserLocal {
$local | add-member -name "type" -membertype NoteProperty -Value "password"
$local | add-member -name "passwd" -membertype NoteProperty -Value $password
}
<# "radius" {
<#
"radius" {
$local | add-member -name "type" -membertype NoteProperty -Value "radius"
$local | add-member -name "radius-server" -membertype NoteProperty -Value $radius_server
}
Expand Down
20 changes: 16 additions & 4 deletions Tests/integration/UserLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ Describe "Get User Local" {
$userlocal.count | Should -Not -Be $NULL
}

It "Get ALL User Local with -meta" {
It "Get User Local with -name $pester_userlocal -meta" {
$userlocal = Get-FGTUserLocal -meta
$userlocal.count | Should -Not -Be $NULL
$userlocal.q_ref | Should -Not -BeNullOrEmpty
$userlocal.q_static | Should -Not -BeNullOrEmpty
$userlocal.q_no_rename | Should -Not -BeNullOrEmpty
$userlocal.q_global_entry | Should -Not -BeNullOrEmpty
$userlocal.q_type | Should -Not -BeNullOrEmpty
$userlocal.q_path | Should -Be "user"
$userlocal.q_name | Should -Be "local"
$userlocal.q_mkey_type | Should -Be "string"
if ($DefaultFGTConnection.version -ge "6.2.0") {
$userlocal.q_no_edit | Should -Not -BeNullOrEmpty
}
$userlocal.q_class | Should -Not -BeNullOrEmpty
}

It "Get User Local ($pester_userlocal)" {
Expand Down Expand Up @@ -98,16 +110,16 @@ Describe "Add User Local" {
$userlocal.status | Should -Be "enable"
$userlocal.'email-to' | Should -Be "[email protected]"
$userlocal.'two-factor' | Should -Be "email"
}
}

It "Add User Local $pester_userlocal email with -data" {
It "Add User Local $pester_userlocal email with -data" {
$data = @{ "email-to" = "[email protected]" }
Add-FGTUserLocal -Name $pester_userlocal -status -data $data -passwd $pester_userlocalpassword
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
$userlocal.status | Should -Be "enable"
$userlocal.'email-to' | Should -Be "[email protected]"
}
}

It "Try to Add User Local $pester_userlocal (but there is already a object with same name)" {
#Add first userlocal
Expand Down

0 comments on commit fe190b0

Please sign in to comment.