Skip to content

Commit

Permalink
release param and remove tests from different branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jworkmanjc committed Jul 7, 2022
1 parent fbd9495 commit 61744a2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 307 deletions.
2 changes: 1 addition & 1 deletion .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ parameters:
PublishToPSGallery:
description: 'When `true` and when run against Master branch, this workflow will publish the latest code to PSGallery'
type: boolean
default: false
default: true
ManualModuleVersion:
description: 'When `true` the pipeline will use the Module Version specified in JumpCloud Module JumpCloud.psd1 file'
type: boolean
Expand Down
306 changes: 0 additions & 306 deletions PowerShell/JumpCloud Module/Tests/Public/Users/Get-JCUser.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -415,310 +415,4 @@ Describe -Tag:('JCUser') "Get-JCUser 1.12" {
$SearchUser._id | Should -Be $Newuser._id

}
}

Describe -Tag:('JCUser') "Case Insensitivity Tests" {
It "Searches parameters dynamically with mixed, lower and upper capitalaztion" {
# Get-JCuser -username uSeRnAmE should return same user as Get-JCuser -username Username
# Get-JCuser -username username should return same user as Get-JCuser -username Username
# Get-JCuser -username USERNAME should return same user as Get-JCuser -username Username
# Get-JCuser -firstname fIrStNaMe should return same user as Get-JCuser -firstname Firstname
# Get-JCuser -lastname lAsTnAmE should return same user as Get-JCuser -lastname Lastname
# Etc.
$commandParameters = (GCM Get-JCSystem).Parameters
$gmr = Get-JCUser -username $PesterParams_User1.username | GM
# Get parameters that are not ID, ORGID and have a string following the param name
$parameters = $gmr | Where-Object { ($_.Definition -notmatch "organization") -And ($_.Definition -notmatch "id") -And ($_.Definition -match "string\s\w+=(\w+)") -And ($_.Name -In $commandParameters.Keys) }

foreach ($param in $parameters.Name) {
# Write-host "Testing $param"
$string = $PesterParams_User1.$param.toLower()
$stringList = @()
$stringFinal = ""
# for i in string length, get the letters and capatlize ever other letter
for ($i = 0; $i -lt $string.length; $i++) {
<# Action that will repeat until the condition is met #>
$letter = $string.Substring($i, 1)
if ($i % 2 -eq 1) {
$letter = $letter.TOUpper()
}
$stringList += ($letter)
}
foreach ($letter in $stringList) {
<# $letter is the current item #>
$stringFinal += $letter
}
$mixedCaseSearch = "Get-JCUser -$($param) `"$stringFinal`""
$lowerCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.toLower())`""
$upperCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.TOUpper())`""
# Write-Host $mixedCaseSearch
# Write-Host $lowerCaseSearch
# Write-Host $upperCaseSearch
$userSearchMixed = Invoke-Expression -Command:($mixedCaseSearch)
$userSearchLower = Invoke-Expression -Command:($lowerCaseSearch)
$userSearchUpper = Invoke-Expression -Command:($upperCaseSearch)
# DefaultSearch is the expression without text formatting
$defaultSearch = "Get-JCUser -$($param) `"$($PesterParams_User1.$param)`""
$userSearchDefault = Invoke-Expression -Command:($defaultSearch)
# Ids returned here should return the same restuls
$userSearchUpper._id | Should -Be $userSearchDefault._id
$userSearchLower._id | Should -Be $userSearchDefault._id
$userSearchMixed._id | Should -Be $userSearchDefault._id
}
}
}

Describe -Tag:('JCUser') "Case Insensitivity Tests" {
It "Searches parameters dynamically with mixed, lower and upper capitalaztion" {
# Get-JCuser -username uSeRnAmE should return same user as Get-JCuser -username Username
# Get-JCuser -username username should return same user as Get-JCuser -username Username
# Get-JCuser -username USERNAME should return same user as Get-JCuser -username Username
# Get-JCuser -firstname fIrStNaMe should return same user as Get-JCuser -firstname Firstname
# Get-JCuser -lastname lAsTnAmE should return same user as Get-JCuser -lastname Lastname
# Etc.
$commandParameters = (GCM Get-JCSystem).Parameters
$gmr = Get-JCUser -username $PesterParams_User1.username | GM
# Get parameters that are not ID, ORGID and have a string following the param name
$parameters = $gmr | Where-Object { ($_.Definition -notmatch "organization") -And ($_.Definition -notmatch "id") -And ($_.Definition -match "string\s\w+=(\w+)") -And ($_.Name -In $commandParameters.Keys) }

foreach ($param in $parameters.Name) {
# Write-host "Testing $param"
$string = $PesterParams_User1.$param.toLower()
$stringList = @()
$stringFinal = ""
# for i in string length, get the letters and capatlize ever other letter
for ($i = 0; $i -lt $string.length; $i++) {
<# Action that will repeat until the condition is met #>
$letter = $string.Substring($i, 1)
if ($i % 2 -eq 1) {
$letter = $letter.TOUpper()
}
$stringList += ($letter)
}
foreach ($letter in $stringList) {
<# $letter is the current item #>
$stringFinal += $letter
}
$mixedCaseSearch = "Get-JCUser -$($param) `"$stringFinal`""
$lowerCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.toLower())`""
$upperCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.TOUpper())`""
# Write-Host $mixedCaseSearch
# Write-Host $lowerCaseSearch
# Write-Host $upperCaseSearch
$userSearchMixed = Invoke-Expression -Command:($mixedCaseSearch)
$userSearchLower = Invoke-Expression -Command:($lowerCaseSearch)
$userSearchUpper = Invoke-Expression -Command:($upperCaseSearch)
# DefaultSearch is the expression without text formatting
$defaultSearch = "Get-JCUser -$($param) `"$($PesterParams_User1.$param)`""
$userSearchDefault = Invoke-Expression -Command:($defaultSearch)
# Ids returned here should return the same restuls
$userSearchUpper._id | Should -Be $userSearchDefault._id
$userSearchLower._id | Should -Be $userSearchDefault._id
$userSearchMixed._id | Should -Be $userSearchDefault._id
}
}
}

Describe -Tag:('JCUser') "Case Insensitivity Tests" {
It "Searches parameters dynamically with mixed, lower and upper capitalaztion" {
# Get-JCuser -username uSeRnAmE should return same user as Get-JCuser -username Username
# Get-JCuser -username username should return same user as Get-JCuser -username Username
# Get-JCuser -username USERNAME should return same user as Get-JCuser -username Username
# Get-JCuser -firstname fIrStNaMe should return same user as Get-JCuser -firstname Firstname
# Get-JCuser -lastname lAsTnAmE should return same user as Get-JCuser -lastname Lastname
# Etc.
$commandParameters = (GCM Get-JCSystem).Parameters
$gmr = Get-JCUser -username $PesterParams_User1.username | GM
# Get parameters that are not ID, ORGID and have a string following the param name
$parameters = $gmr | Where-Object { ($_.Definition -notmatch "organization") -And ($_.Definition -notmatch "id") -And ($_.Definition -match "string\s\w+=(\w+)") -And ($_.Name -In $commandParameters.Keys) }

foreach ($param in $parameters.Name) {
# Write-host "Testing $param"
$string = $PesterParams_User1.$param.toLower()
$stringList = @()
$stringFinal = ""
# for i in string length, get the letters and capatlize ever other letter
for ($i = 0; $i -lt $string.length; $i++) {
<# Action that will repeat until the condition is met #>
$letter = $string.Substring($i, 1)
if ($i % 2 -eq 1) {
$letter = $letter.TOUpper()
}
$stringList += ($letter)
}
foreach ($letter in $stringList) {
<# $letter is the current item #>
$stringFinal += $letter
}
$mixedCaseSearch = "Get-JCUser -$($param) `"$stringFinal`""
$lowerCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.toLower())`""
$upperCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.TOUpper())`""
# Write-Host $mixedCaseSearch
# Write-Host $lowerCaseSearch
# Write-Host $upperCaseSearch
$userSearchMixed = Invoke-Expression -Command:($mixedCaseSearch)
$userSearchLower = Invoke-Expression -Command:($lowerCaseSearch)
$userSearchUpper = Invoke-Expression -Command:($upperCaseSearch)
# DefaultSearch is the expression without text formatting
$defaultSearch = "Get-JCUser -$($param) `"$($PesterParams_User1.$param)`""
$userSearchDefault = Invoke-Expression -Command:($defaultSearch)
# Ids returned here should return the same restuls
$userSearchUpper._id | Should -Be $userSearchDefault._id
$userSearchLower._id | Should -Be $userSearchDefault._id
$userSearchMixed._id | Should -Be $userSearchDefault._id
}
}
}

Describe -Tag:('JCUser') "Case Insensitivity Tests" {
It "Searches parameters dynamically with mixed, lower and upper capitalaztion" {
# Get-JCuser -username uSeRnAmE should return same user as Get-JCuser -username Username
# Get-JCuser -username username should return same user as Get-JCuser -username Username
# Get-JCuser -username USERNAME should return same user as Get-JCuser -username Username
# Get-JCuser -firstname fIrStNaMe should return same user as Get-JCuser -firstname Firstname
# Get-JCuser -lastname lAsTnAmE should return same user as Get-JCuser -lastname Lastname
# Etc.
$commandParameters = (GCM Get-JCSystem).Parameters
$gmr = Get-JCUser -username $PesterParams_User1.username | GM
# Get parameters that are not ID, ORGID and have a string following the param name
$parameters = $gmr | Where-Object { ($_.Definition -notmatch "organization") -And ($_.Definition -notmatch "id") -And ($_.Definition -match "string\s\w+=(\w+)") -And ($_.Name -In $commandParameters.Keys) }

foreach ($param in $parameters.Name) {
# Write-host "Testing $param"
$string = $PesterParams_User1.$param.toLower()
$stringList = @()
$stringFinal = ""
# for i in string length, get the letters and capatlize ever other letter
for ($i = 0; $i -lt $string.length; $i++) {
<# Action that will repeat until the condition is met #>
$letter = $string.Substring($i, 1)
if ($i % 2 -eq 1) {
$letter = $letter.TOUpper()
}
$stringList += ($letter)
}
foreach ($letter in $stringList) {
<# $letter is the current item #>
$stringFinal += $letter
}
$mixedCaseSearch = "Get-JCUser -$($param) `"$stringFinal`""
$lowerCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.toLower())`""
$upperCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.TOUpper())`""
# Write-Host $mixedCaseSearch
# Write-Host $lowerCaseSearch
# Write-Host $upperCaseSearch
$userSearchMixed = Invoke-Expression -Command:($mixedCaseSearch)
$userSearchLower = Invoke-Expression -Command:($lowerCaseSearch)
$userSearchUpper = Invoke-Expression -Command:($upperCaseSearch)
# DefaultSearch is the expression without text formatting
$defaultSearch = "Get-JCUser -$($param) `"$($PesterParams_User1.$param)`""
$userSearchDefault = Invoke-Expression -Command:($defaultSearch)
# Ids returned here should return the same restuls
$userSearchUpper._id | Should -Be $userSearchDefault._id
$userSearchLower._id | Should -Be $userSearchDefault._id
$userSearchMixed._id | Should -Be $userSearchDefault._id
}
}
}

Describe -Tag:('JCUser') "Case Insensitivity Tests" {
It "Searches parameters dynamically with mixed, lower and upper capitalaztion" {
# Get-JCuser -username uSeRnAmE should return same user as Get-JCuser -username Username
# Get-JCuser -username username should return same user as Get-JCuser -username Username
# Get-JCuser -username USERNAME should return same user as Get-JCuser -username Username
# Get-JCuser -firstname fIrStNaMe should return same user as Get-JCuser -firstname Firstname
# Get-JCuser -lastname lAsTnAmE should return same user as Get-JCuser -lastname Lastname
# Etc.
$commandParameters = (GCM Get-JCSystem).Parameters
$gmr = Get-JCUser -username $PesterParams_User1.username | GM
# Get parameters that are not ID, ORGID and have a string following the param name
$parameters = $gmr | Where-Object { ($_.Definition -notmatch "organization") -And ($_.Definition -notmatch "id") -And ($_.Definition -match "string\s\w+=(\w+)") -And ($_.Name -In $commandParameters.Keys) }

foreach ($param in $parameters.Name) {
# Write-host "Testing $param"
$string = $PesterParams_User1.$param.toLower()
$stringList = @()
$stringFinal = ""
# for i in string length, get the letters and capatlize ever other letter
for ($i = 0; $i -lt $string.length; $i++) {
<# Action that will repeat until the condition is met #>
$letter = $string.Substring($i, 1)
if ($i % 2 -eq 1) {
$letter = $letter.TOUpper()
}
$stringList += ($letter)
}
foreach ($letter in $stringList) {
<# $letter is the current item #>
$stringFinal += $letter
}
$mixedCaseSearch = "Get-JCUser -$($param) `"$stringFinal`""
$lowerCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.toLower())`""
$upperCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.TOUpper())`""
# Write-Host $mixedCaseSearch
# Write-Host $lowerCaseSearch
# Write-Host $upperCaseSearch
$userSearchMixed = Invoke-Expression -Command:($mixedCaseSearch)
$userSearchLower = Invoke-Expression -Command:($lowerCaseSearch)
$userSearchUpper = Invoke-Expression -Command:($upperCaseSearch)
# DefaultSearch is the expression without text formatting
$defaultSearch = "Get-JCUser -$($param) `"$($PesterParams_User1.$param)`""
$userSearchDefault = Invoke-Expression -Command:($defaultSearch)
# Ids returned here should return the same restuls
$userSearchUpper._id | Should -Be $userSearchDefault._id
$userSearchLower._id | Should -Be $userSearchDefault._id
$userSearchMixed._id | Should -Be $userSearchDefault._id
}
}
}

Describe -Tag:('JCUser') "Case Insensitivity Tests" {
It "Searches parameters dynamically with mixed, lower and upper capitalaztion" {
# Get-JCuser -username uSeRnAmE should return same user as Get-JCuser -username Username
# Get-JCuser -username username should return same user as Get-JCuser -username Username
# Get-JCuser -username USERNAME should return same user as Get-JCuser -username Username
# Get-JCuser -firstname fIrStNaMe should return same user as Get-JCuser -firstname Firstname
# Get-JCuser -lastname lAsTnAmE should return same user as Get-JCuser -lastname Lastname
# Etc.
$commandParameters = (GCM Get-JCSystem).Parameters
$gmr = Get-JCUser -username $PesterParams_User1.username | GM
# Get parameters that are not ID, ORGID and have a string following the param name
$parameters = $gmr | Where-Object { ($_.Definition -notmatch "organization") -And ($_.Definition -notmatch "id") -And ($_.Definition -match "string\s\w+=(\w+)") -And ($_.Name -In $commandParameters.Keys) }

foreach ($param in $parameters.Name) {
# Write-host "Testing $param"
$string = $PesterParams_User1.$param.toLower()
$stringList = @()
$stringFinal = ""
# for i in string length, get the letters and capatlize ever other letter
for ($i = 0; $i -lt $string.length; $i++) {
<# Action that will repeat until the condition is met #>
$letter = $string.Substring($i, 1)
if ($i % 2 -eq 1) {
$letter = $letter.TOUpper()
}
$stringList += ($letter)
}
foreach ($letter in $stringList) {
<# $letter is the current item #>
$stringFinal += $letter
}
$mixedCaseSearch = "Get-JCUser -$($param) `"$stringFinal`""
$lowerCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.toLower())`""
$upperCaseSearch = "Get-JCUser -$($param) `"$($stringFinal.TOUpper())`""
# Write-Host $mixedCaseSearch
# Write-Host $lowerCaseSearch
# Write-Host $upperCaseSearch
$userSearchMixed = Invoke-Expression -Command:($mixedCaseSearch)
$userSearchLower = Invoke-Expression -Command:($lowerCaseSearch)
$userSearchUpper = Invoke-Expression -Command:($upperCaseSearch)
# DefaultSearch is the expression without text formatting
$defaultSearch = "Get-JCUser -$($param) `"$($PesterParams_User1.$param)`""
$userSearchDefault = Invoke-Expression -Command:($defaultSearch)
# Ids returned here should return the same restuls
$userSearchUpper._id | Should -Be $userSearchDefault._id
$userSearchLower._id | Should -Be $userSearchDefault._id
$userSearchMixed._id | Should -Be $userSearchDefault._id
}
}
}

0 comments on commit 61744a2

Please sign in to comment.