Skip to content

Commit

Permalink
import update csv tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaranionjc committed Dec 4, 2024
1 parent 9713768 commit e01ac8e
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,47 @@ Describe -Tag:('JCUsersFromCSV') "Import-JCUsersFromCSV 2.14.2" {
}
}
}
Describe -Tag:('JCUsersFromCSV') "Import-JCUsersFromCSV 2.15.1" {
Context "Import-JCUsersFromCSV with 10 or more custom attributes" {
It "When there are 10 or more custom attributes, the API should not return an error message in the status field and continue to import the user" {
$user = New-RandomUser -Domain "ImportCSVUser.$(New-RandomString -NumberOfChars 5)"
$today = Get-Date
$EnrollmentDays = 14
$CSVDATA = @{
Username = $user.username
LastName = $user.LastName
FirstName = $user.FirstName
Email = $user.Email
Attribute1_name = "Name"
Attribute1_value = "Value"
Attribute2_name = "Name1"
Attribute2_value = "Value1"
Attribute3_name = "Name2"
Attribute3_value = "Value2"
Attribute4_name = "Name3"
Attribute4_value = "Value3"
Attribute5_name = "Name4"
Attribute5_value = "Value4"
Attribute6_name = "Name5"
Attribute6_value = "Value5"
Attribute7_name = "Name6"
Attribute7_value = "Value6"
Attribute8_name = "Name7"
Attribute8_value = "Value7"
Attribute9_name = "Name8"
Attribute9_value = "Value8"
Attribute10_name = "Name9"
Attribute10_value = "Value9"
Attribute11_name = "Name10"
Attribute11_value = "Value10"
}
$CSVFILE = $CSVDATA | Export-Csv "$PesterParams_ImportPath/custom_attribute.csv" -Force
$importResults = Import-JCUsersFromCSV -CSVFilePath "$PesterParams_ImportPath/custom_attribute.csv" -force
# ImportResults should not be error
$importResults[0].Status | Should -Match "User Created"
}
}
}

AfterAll {
Get-JCUser | Where-Object Email -like *testimportcsvuser* | Remove-JCUser -force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,43 @@ Describe -Tag:('JCUsersFromCSV') "Update-JCUsersFromCSV 2.14.2" {
}
}
}

Describe -Tag:('JCUsersFromCSV') "Update-JCUsersFromCSV 2.15.1" {
Context "User should be updated even with 10 or more custom attributes" {
It "When there are 10 or more custom attributes, the user should still be updated" {
$user = New-RandomUser -Domain "testupdatecsvuser.$(New-RandomString -NumberOfChars 5)" | New-JCUser
$CSVDATA = @{
Username = $user.username
Attribute1_name = "Name"
Attribute1_value = "Value"
Attribute2_name = "Name1"
Attribute2_value = "Value1"
Attribute3_name = "Name2"
Attribute3_value = "Value2"
Attribute4_name = "Name3"
Attribute4_value = "Value3"
Attribute5_name = "Name4"
Attribute5_value = "Value4"
Attribute6_name = "Name5"
Attribute6_value = "Value5"
Attribute7_name = "Name6"
Attribute7_value = "Value6"
Attribute8_name = "Name7"
Attribute8_value = "Value7"
Attribute9_name = "Name8"
Attribute9_value = "Value8"
Attribute10_name = "Name9"
Attribute10_value = "Value9"
Attribute11_name = "Name10"
Attribute11_value = "Value10"
}
$CSVFILE = $CSVDATA | Export-Csv "$PesterParams_UpdatePath/custom_attribute.csv" -Force
$UpdateStatus = Update-JCUsersFromCSV -CSVFilePath "$PesterParams_UpdatePath/custom_attribute.csv" -force
# the error message should show that custom attribute names cannot contain spaces
$UpdateStatus[0].status | Should -Be "User Updated"
}
}
}
AfterAll {
Get-JCUser | Where-Object Email -like *testupdatecsvuser* | Remove-JCUser -force
}

0 comments on commit e01ac8e

Please sign in to comment.