Skip to content

Commit

Permalink
Fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Moreau committed Aug 26, 2024
1 parent 9318d92 commit d59e4e0
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions Tests/integration/UserLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,34 @@ Describe "Get User Local" {
} | Should -Not -Throw
}

It "Get ALL userlocal" {
It "Get ALL User Local" {
$userlocal = Get-FGTUserLocal
$userlocal.count | Should -Not -Be $NULL
}

It "Get ALL userlocal with -skip" {
It "Get ALL User Local with -skip" {
$userlocal = Get-FGTUserLocal -skip
$userlocal.count | Should -Not -Be $NULL
}

It "Get userlocal ($pester_userlocal)" {
It "Get User Local ($pester_userlocal)" {
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
}

It "Get userlocal ($pester_userlocal) and confirm (via Confirm-FGTUserLocal)" {
It "Get User Local ($pester_userlocal) and confirm (via Confirm-FGTUserLocal)" {
$userlocal = Get-FGTUserLocal -name $pester_userlocal
Confirm-FGTUserLocal ($userlocal) | Should -Be $true
}

Context "Search" {

It "Search userlocal by name ($pester_userlocal)" {
It "Search User Local by name ($pester_userlocal)" {
$userlocal = Get-FGTUserLocal -name $pester_userlocal
@($userlocal).count | Should -be 1
$userlocal.name | Should -Be $pester_userlocal
}

<#It "Search userlocal by uuid ($script:uuid)" {
$userlocal = Get-FGTUserLocal -uuid $script:uuid
@($userlocal).count | Should -be 1
$userlocal.name | Should -Be $pester_userlocal
}#>

}

AfterAll {
Expand All @@ -68,13 +62,13 @@ Describe "Get User Local" {

Describe "Add User Local" {

Context "local" {
Context "Local User (Email, MFA, etc" {

AfterEach {
Get-FGTUserLocal -name $pester_userlocal | Remove-FGTUserLocal -confirm:$false
}

It "Add userlocal $pester_userlocal enable" {
It "Add User Local $pester_userlocal enable" {
Add-FGTUserLocal -Name $pester_userlocal -status -password $pester_userlocalpassword
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Expand All @@ -83,7 +77,7 @@ Describe "Add User Local" {
$userlocal.'two-factor' | Should -Be "disable"
}

It "Add userlocal $pester_userlocal email to" {
It "Add User Local $pester_userlocal email to" {
Add-FGTUserLocal -Name $pester_userlocal -email_to "[email protected]" -password $pester_userlocalpassword
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Expand All @@ -92,7 +86,7 @@ Describe "Add User Local" {
$userlocal.'two-factor' | Should -Be "disable"
}

It "Add userlocal $pester_userlocal MFA" {
It "Add User Local $pester_userlocal MFA by email" {
Add-FGTUserLocal -Name $pester_userlocal -status -two_factor email -email_to "[email protected]" -password $pester_userlocalpassword
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Expand All @@ -101,7 +95,7 @@ Describe "Add User Local" {
$userlocal.'two-factor' | Should -Be "email"
}

It "Try to Add userlocal $pester_userlocal (but there is already a object with same name)" {
It "Try to Add User Local $pester_userlocal (but there is already a object with same name)" {
#Add first userlocal
Add-FGTUserLocal -Name $pester_userlocal -status -password $pester_userlocalpassword
#Add Second userlocal with same name
Expand All @@ -114,13 +108,13 @@ Describe "Add User Local" {

Describe "Configure User Local" {

Context "local" {
Context "Change name, email, MFA, etc" {

BeforeAll {
Add-FGTUserLocal -Name $pester_userlocal -password $pester_userlocalpassword
}

It "Change status userlocal" {
It "Change status User Local" {
Get-FGTUserLocal -name $pester_userlocal | Set-FGTUserLocal -status
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Expand All @@ -138,7 +132,7 @@ Describe "Configure User Local" {
$userlocal.'two-factor' | Should -Be "disable"
}

It "Change MFA" {
It "Enable MFA by email" {
Get-FGTUserLocal -name $pester_userlocal | Set-FGTUserLocal -two_factor email
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal.name | Should -Be $pester_userlocal
Expand All @@ -156,7 +150,7 @@ Describe "Configure User Local" {
$userlocal.'two-factor' | Should -Be "email"
}

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

Expand All @@ -171,7 +165,7 @@ Describe "Remove User Local" {
Add-FGTUserLocal -Name $pester_userlocal -password $pester_userlocalpassword
}

It "Remove userlocal $pester_userlocal by pipeline" {
It "Remove User Local $pester_userlocal by pipeline" {
$userlocal = Get-FGTUserLocal -name $pester_userlocal
$userlocal | Remove-FGTUserLocal -confirm:$false
$userlocal = Get-FGTUserLocal -name $pester_userlocal
Expand Down

0 comments on commit d59e4e0

Please sign in to comment.