From 37931fe4fd6da1038da788873eed1a80dd04ead3 Mon Sep 17 00:00:00 2001 From: Ken Maranion Date: Mon, 16 Dec 2024 14:58:57 -0800 Subject: [PATCH] test cascade --- .../Public/Users/Remove-JCUser.Tests.ps1 | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/PowerShell/JumpCloud Module/Tests/Public/Users/Remove-JCUser.Tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Users/Remove-JCUser.Tests.ps1 index e19613fae..cbf6ee024 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Users/Remove-JCUser.Tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Users/Remove-JCUser.Tests.ps1 @@ -133,27 +133,4 @@ Describe -Tag:('JCUser') "Remove-JCUser 2.16.0" { Remove-JCUser -UserID $ManagerUser._id -force Remove-JCUser -UserID $NewUser._id -force } - - It "Remove JumpCloud Manager1 that is also managed by a Manager2. Cascade managed users manager to Manager2" { - $ManagerUser = New-RandomUser "PesterTest$(Get-Date -Format MM-dd-yyyy)" | New-JCUser - $ManagerUser2 = New-RandomUser "PesterTest$(Get-Date -Format MM-dd-yyyy)" | New-JCUser - $NewUser = New-RandomUser -Domain "delUser.$(New-RandomString -NumberOfChars 5)" | New-JCUser - - # Set the manager for user - Set-JCUser -UserID $ManagerUser._id -manager $ManagerUser2._id # ManagerUser2 is the manager of ManagerUser - Set-JCUser -UserID $NewUser._id -manager $ManagerUser._id - - Mock -CommandName Read-Host -MockWith { return 'y' } - # Remove the manager and set the new manager - $RemoveUser = Remove-JCUser -UserID $ManagerUser._id # Remove ManagerUser and should cascade to ManagerUser2. Prompts should be auto answered with 'Y' - - # The manager should be removed and the new manager should be set - $RemoveUser.Results | Should -Be 'Deleted' - # The new manager should be set to ManagerUser2 - $manager = Get-JCUser -UserID $NewUser._id | Select-Object -ExpandProperty manager - $manager | Should -Be $ManagerUser2._id - # Clean up - Remove-JCUser -UserID $ManagerUser2._id -force - Remove-JCUser -UserID $NewUser._id -force - } } \ No newline at end of file