From 8daf885246d5843736496dae95f33d427a834489 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 11 Mar 2019 10:13:19 +0100 Subject: [PATCH 001/145] Update Get-UMSDevice.md --- Docs/Get-UMSDevice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Get-UMSDevice.md b/Docs/Get-UMSDevice.md index 3d709d1..e9ef3da 100644 --- a/Docs/Get-UMSDevice.md +++ b/Docs/Get-UMSDevice.md @@ -60,7 +60,7 @@ MovedToBin : False ### Example 2 -Get 'online' information on device with ID 195.: +Get 'online' information on device with ID 195: ```powershell Get-UMSDevice -ComputerName 'igelrmserver' -WebSession $WebSession -Id 58 -Filter online From 235479ff08fa3febc4b6e55f57548226812d7abe Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 11 Mar 2019 10:13:22 +0100 Subject: [PATCH 002/145] Update New-UMSAPICookie.md --- Docs/New-UMSAPICookie.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/New-UMSAPICookie.md b/Docs/New-UMSAPICookie.md index 9e51b4e..12a5dae 100644 --- a/Docs/New-UMSAPICookie.md +++ b/Docs/New-UMSAPICookie.md @@ -35,7 +35,7 @@ Create / use process to store and read credential to and from file and use it to ```powershell #Save credential securely to file (one time only): -Get-Credential | Export-Clixml -Path ('{0}\igelums@igelrmserver.cred' -f ${env:\userprofile}) -Credential (Get-Credential) +Get-Credential | Export-Clixml -Path ('{0}\igelums@igelrmserver.cred' -f ${env:\userprofile}) #Load credential from file $Credential = Import-Clixml -Path ('{0}\igelums@igelrmserver.cred' -f ${env:\userprofile}) From 684e71a9af39cc8e13d238ceef2b141348bd2020 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 11 Mar 2019 12:21:18 +0100 Subject: [PATCH 003/145] Create Invoke-Parallel.ps1 --- Scripts/Invoke-Parallel.ps1 | 558 ++++++++++++++++++++++++++++++++++++ 1 file changed, 558 insertions(+) create mode 100644 Scripts/Invoke-Parallel.ps1 diff --git a/Scripts/Invoke-Parallel.ps1 b/Scripts/Invoke-Parallel.ps1 new file mode 100644 index 0000000..6888c83 --- /dev/null +++ b/Scripts/Invoke-Parallel.ps1 @@ -0,0 +1,558 @@ +function Invoke-Parallel { + <# + .SYNOPSIS + Function to control parallel processing using runspaces + + .DESCRIPTION + Function to control parallel processing using runspaces + + Note that each runspace will not have access to variables and commands loaded in your session or in other runspaces by default. + This behaviour can be changed with parameters. + + .PARAMETER ScriptFile + File to run against all input objects. Must include parameter to take in the input object, or use $args. Optionally, include parameter to take in parameter. Example: C:\script.ps1 + + .PARAMETER ScriptBlock + Scriptblock to run against all computers. + + You may use $Using: language in PowerShell 3 and later. + + The parameter block is added for you, allowing behaviour similar to foreach-object: + Refer to the input object as $_. + Refer to the parameter parameter as $parameter + + .PARAMETER InputObject + Run script against these specified objects. + + .PARAMETER Parameter + This object is passed to every script block. You can use it to pass information to the script block; for example, the path to a logging folder + + Reference this object as $parameter if using the scriptblock parameterset. + + .PARAMETER ImportVariables + If specified, get user session variables and add them to the initial session state + + .PARAMETER ImportModules + If specified, get loaded modules and pssnapins, add them to the initial session state + + .PARAMETER Throttle + Maximum number of threads to run at a single time. + + .PARAMETER SleepTimer + Milliseconds to sleep after checking for completed runspaces and in a few other spots. I would not recommend dropping below 200 or increasing above 500 + + .PARAMETER RunspaceTimeout + Maximum time in seconds a single thread can run. If execution of your code takes longer than this, it is disposed. Default: 0 (seconds) + + WARNING: Using this parameter requires that maxQueue be set to throttle (it will be by default) for accurate timing. Details here: + http://gallery.technet.microsoft.com/Run-Parallel-Parallel-377fd430 + + .PARAMETER NoCloseOnTimeout + Do not dispose of timed out tasks or attempt to close the runspace if threads have timed out. This will prevent the script from hanging in certain situations where threads become non-responsive, at the expense of leaking memory within the PowerShell host. + + .PARAMETER MaxQueue + Maximum number of powershell instances to add to runspace pool. If this is higher than $throttle, $timeout will be inaccurate + + If this is equal or less than throttle, there will be a performance impact + + The default value is $throttle times 3, if $runspaceTimeout is not specified + The default value is $throttle, if $runspaceTimeout is specified + + .PARAMETER LogFile + Path to a file where we can log results, including run time for each thread, whether it completes, completes with errors, or times out. + + .PARAMETER AppendLog + Append to existing log + + .PARAMETER Quiet + Disable progress bar + + .EXAMPLE + Each example uses Test-ForPacs.ps1 which includes the following code: + param($computer) + + if(test-connection $computer -count 1 -quiet -BufferSize 16){ + $object = [pscustomobject] @{ + Computer=$computer; + Available=1; + Kodak=$( + if((test-path "\\$computer\c$\users\public\desktop\Kodak Direct View Pacs.url") -or (test-path "\\$computer\c$\documents and settings\all users\desktop\Kodak Direct View Pacs.url") ){"1"}else{"0"} + ) + } + } + else{ + $object = [pscustomobject] @{ + Computer=$computer; + Available=0; + Kodak="NA" + } + } + + $object + + .EXAMPLE + Invoke-Parallel -scriptfile C:\public\Test-ForPacs.ps1 -inputobject $(get-content C:\pcs.txt) -runspaceTimeout 10 -throttle 10 + + Pulls list of PCs from C:\pcs.txt, + Runs Test-ForPacs against each + If any query takes longer than 10 seconds, it is disposed + Only run 10 threads at a time + + .EXAMPLE + Invoke-Parallel -scriptfile C:\public\Test-ForPacs.ps1 -inputobject c-is-ts-91, c-is-ts-95 + + Runs against c-is-ts-91, c-is-ts-95 (-computername) + Runs Test-ForPacs against each + + .EXAMPLE + $stuff = [pscustomobject] @{ + ContentFile = "windows\system32\drivers\etc\hosts" + Logfile = "C:\temp\log.txt" + } + + $computers | Invoke-Parallel -parameter $stuff { + $contentFile = join-path "\\$_\c$" $parameter.contentfile + Get-Content $contentFile | + set-content $parameter.logfile + } + + This example uses the parameter argument. This parameter is a single object. To pass multiple items into the script block, we create a custom object (using a PowerShell v3 language) with properties we want to pass in. + + Inside the script block, $parameter is used to reference this parameter object. This example sets a content file, gets content from that file, and sets it to a predefined log file. + + .EXAMPLE + $test = 5 + 1..2 | Invoke-Parallel -ImportVariables {$_ * $test} + + Add variables from the current session to the session state. Without -ImportVariables $Test would not be accessible + + .EXAMPLE + $test = 5 + 1..2 | Invoke-Parallel {$_ * $Using:test} + + Reference a variable from the current session with the $Using: syntax. Requires PowerShell 3 or later. Note that -ImportVariables parameter is no longer necessary. + + .FUNCTIONALITY + PowerShell Language + + .NOTES + Credit to Boe Prox for the base runspace code and $Using implementation + http://learn-powershell.net/2012/05/10/speedy-network-information-query-using-powershell/ + http://gallery.technet.microsoft.com/scriptcenter/Speedy-Network-Information-5b1406fb#content + https://github.com/proxb/PoshRSJob/ + + Credit to T Bryce Yehl for the Quiet and NoCloseOnTimeout implementations + + Credit to Sergei Vorobev for the many ideas and contributions that have improved functionality, reliability, and ease of use + + .LINK + https://github.com/RamblingCookieMonster/Invoke-Parallel + #> + [cmdletbinding(DefaultParameterSetName='ScriptBlock')] + Param ( + [Parameter(Mandatory=$false,position=0,ParameterSetName='ScriptBlock')] + [System.Management.Automation.ScriptBlock]$ScriptBlock, + + [Parameter(Mandatory=$false,ParameterSetName='ScriptFile')] + [ValidateScript({Test-Path $_ -pathtype leaf})] + $ScriptFile, + + [Parameter(Mandatory=$true,ValueFromPipeline=$true)] + [Alias('CN','__Server','IPAddress','Server','ComputerName')] + [PSObject]$InputObject, + + [PSObject]$Parameter, + + [switch]$ImportVariables, + [switch]$ImportModules, + [switch]$ImportFunctions, + + [int]$Throttle = 20, + [int]$SleepTimer = 200, + [int]$RunspaceTimeout = 0, + [switch]$NoCloseOnTimeout = $false, + [int]$MaxQueue, + + [validatescript({Test-Path (Split-Path $_ -parent)})] + [switch] $AppendLog = $false, + [string]$LogFile, + + [switch] $Quiet = $false + ) + begin { + #No max queue specified? Estimate one. + #We use the script scope to resolve an odd PowerShell 2 issue where MaxQueue isn't seen later in the function + if( -not $PSBoundParameters.ContainsKey('MaxQueue') ) { + if($RunspaceTimeout -ne 0){ $script:MaxQueue = $Throttle } + else{ $script:MaxQueue = $Throttle * 3 } + } + else { + $script:MaxQueue = $MaxQueue + } + $ProgressId = Get-Random + Write-Verbose "Throttle: '$throttle' SleepTimer '$sleepTimer' runSpaceTimeout '$runspaceTimeout' maxQueue '$maxQueue' logFile '$logFile'" + + #If they want to import variables or modules, create a clean runspace, get loaded items, use those to exclude items + if ($ImportVariables -or $ImportModules -or $ImportFunctions) { + $StandardUserEnv = [powershell]::Create().addscript({ + + #Get modules, snapins, functions in this clean runspace + $Modules = Get-Module | Select-Object -ExpandProperty Name + $Snapins = Get-PSSnapin | Select-Object -ExpandProperty Name + $Functions = Get-ChildItem function:\ | Select-Object -ExpandProperty Name + + #Get variables in this clean runspace + #Called last to get vars like $? into session + $Variables = Get-Variable | Select-Object -ExpandProperty Name + + #Return a hashtable where we can access each. + @{ + Variables = $Variables + Modules = $Modules + Snapins = $Snapins + Functions = $Functions + } + }).invoke()[0] + + if ($ImportVariables) { + #Exclude common parameters, bound parameters, and automatic variables + Function _temp {[cmdletbinding(SupportsShouldProcess=$True)] param() } + $VariablesToExclude = @( (Get-Command _temp | Select-Object -ExpandProperty parameters).Keys + $PSBoundParameters.Keys + $StandardUserEnv.Variables ) + Write-Verbose "Excluding variables $( ($VariablesToExclude | Sort-Object ) -join ", ")" + + # we don't use 'Get-Variable -Exclude', because it uses regexps. + # One of the veriables that we pass is '$?'. + # There could be other variables with such problems. + # Scope 2 required if we move to a real module + $UserVariables = @( Get-Variable | Where-Object { -not ($VariablesToExclude -contains $_.Name) } ) + Write-Verbose "Found variables to import: $( ($UserVariables | Select-Object -expandproperty Name | Sort-Object ) -join ", " | Out-String).`n" + } + if ($ImportModules) { + $UserModules = @( Get-Module | Where-Object {$StandardUserEnv.Modules -notcontains $_.Name -and (Test-Path $_.Path -ErrorAction SilentlyContinue)} | Select-Object -ExpandProperty Path ) + $UserSnapins = @( Get-PSSnapin | Select-Object -ExpandProperty Name | Where-Object {$StandardUserEnv.Snapins -notcontains $_ } ) + } + if($ImportFunctions) { + $UserFunctions = @( Get-ChildItem function:\ | Where-Object { $StandardUserEnv.Functions -notcontains $_.Name } ) + } + } + + #region functions + Function Get-RunspaceData { + [cmdletbinding()] + param( [switch]$Wait ) + #loop through runspaces + #if $wait is specified, keep looping until all complete + Do { + #set more to false for tracking completion + $more = $false + + #Progress bar if we have inputobject count (bound parameter) + if (-not $Quiet) { + Write-Progress -Id $ProgressId -Activity "Running Query" -Status "Starting threads"` + -CurrentOperation "$startedCount threads defined - $totalCount input objects - $script:completedCount input objects processed"` + -PercentComplete $( Try { $script:completedCount / $totalCount * 100 } Catch {0} ) + } + + #run through each runspace. + Foreach($runspace in $runspaces) { + + #get the duration - inaccurate + $currentdate = Get-Date + $runtime = $currentdate - $runspace.startTime + $runMin = [math]::Round( $runtime.totalminutes ,2 ) + + #set up log object + $log = "" | Select-Object Date, Action, Runtime, Status, Details + $log.Action = "Removing:'$($runspace.object)'" + $log.Date = $currentdate + $log.Runtime = "$runMin minutes" + + #If runspace completed, end invoke, dispose, recycle, counter++ + If ($runspace.Runspace.isCompleted) { + + $script:completedCount++ + + #check if there were errors + if($runspace.powershell.Streams.Error.Count -gt 0) { + #set the logging info and move the file to completed + $log.status = "CompletedWithErrors" + Write-Verbose ($log | ConvertTo-Csv -Delimiter ";" -NoTypeInformation)[1] + foreach($ErrorRecord in $runspace.powershell.Streams.Error) { + Write-Error -ErrorRecord $ErrorRecord + } + } + else { + #add logging details and cleanup + $log.status = "Completed" + Write-Verbose ($log | ConvertTo-Csv -Delimiter ";" -NoTypeInformation)[1] + } + + #everything is logged, clean up the runspace + $runspace.powershell.EndInvoke($runspace.Runspace) + $runspace.powershell.dispose() + $runspace.Runspace = $null + $runspace.powershell = $null + } + #If runtime exceeds max, dispose the runspace + ElseIf ( $runspaceTimeout -ne 0 -and $runtime.totalseconds -gt $runspaceTimeout) { + $script:completedCount++ + $timedOutTasks = $true + + #add logging details and cleanup + $log.status = "TimedOut" + Write-Verbose ($log | ConvertTo-Csv -Delimiter ";" -NoTypeInformation)[1] + Write-Error "Runspace timed out at $($runtime.totalseconds) seconds for the object:`n$($runspace.object | out-string)" + + #Depending on how it hangs, we could still get stuck here as dispose calls a synchronous method on the powershell instance + if (!$noCloseOnTimeout) { $runspace.powershell.dispose() } + $runspace.Runspace = $null + $runspace.powershell = $null + $completedCount++ + } + + #If runspace isn't null set more to true + ElseIf ($runspace.Runspace -ne $null ) { + $log = $null + $more = $true + } + + #log the results if a log file was indicated + if($logFile -and $log) { + ($log | ConvertTo-Csv -Delimiter ";" -NoTypeInformation)[1] | out-file $LogFile -append + } + } + + #Clean out unused runspace jobs + $temphash = $runspaces.clone() + $temphash | Where-Object { $_.runspace -eq $Null } | ForEach-Object { + $Runspaces.remove($_) + } + + #sleep for a bit if we will loop again + if($PSBoundParameters['Wait']){ Start-Sleep -milliseconds $SleepTimer } + + #Loop again only if -wait parameter and there are more runspaces to process + } while ($more -and $PSBoundParameters['Wait']) + + #End of runspace function + } + #endregion functions + + #region Init + + if($PSCmdlet.ParameterSetName -eq 'ScriptFile') { + $ScriptBlock = [scriptblock]::Create( $(Get-Content $ScriptFile | out-string) ) + } + elseif($PSCmdlet.ParameterSetName -eq 'ScriptBlock') { + #Start building parameter names for the param block + [string[]]$ParamsToAdd = '$_' + if( $PSBoundParameters.ContainsKey('Parameter') ) { + $ParamsToAdd += '$Parameter' + } + + $UsingVariableData = $Null + + # This code enables $Using support through the AST. + # This is entirely from Boe Prox, and his https://github.com/proxb/PoshRSJob module; all credit to Boe! + + if($PSVersionTable.PSVersion.Major -gt 2) { + #Extract using references + $UsingVariables = $ScriptBlock.ast.FindAll({$args[0] -is [System.Management.Automation.Language.UsingExpressionAst]},$True) + + If ($UsingVariables) { + $List = New-Object 'System.Collections.Generic.List`1[System.Management.Automation.Language.VariableExpressionAst]' + ForEach ($Ast in $UsingVariables) { + [void]$list.Add($Ast.SubExpression) + } + + $UsingVar = $UsingVariables | Group-Object -Property SubExpression | ForEach-Object {$_.Group | Select-Object -First 1} + + #Extract the name, value, and create replacements for each + $UsingVariableData = ForEach ($Var in $UsingVar) { + try { + $Value = Get-Variable -Name $Var.SubExpression.VariablePath.UserPath -ErrorAction Stop + [pscustomobject]@{ + Name = $Var.SubExpression.Extent.Text + Value = $Value.Value + NewName = ('$__using_{0}' -f $Var.SubExpression.VariablePath.UserPath) + NewVarName = ('__using_{0}' -f $Var.SubExpression.VariablePath.UserPath) + } + } + catch { + Write-Error "$($Var.SubExpression.Extent.Text) is not a valid Using: variable!" + } + } + $ParamsToAdd += $UsingVariableData | Select-Object -ExpandProperty NewName -Unique + + $NewParams = $UsingVariableData.NewName -join ', ' + $Tuple = [Tuple]::Create($list, $NewParams) + $bindingFlags = [Reflection.BindingFlags]"Default,NonPublic,Instance" + $GetWithInputHandlingForInvokeCommandImpl = ($ScriptBlock.ast.gettype().GetMethod('GetWithInputHandlingForInvokeCommandImpl',$bindingFlags)) + + $StringScriptBlock = $GetWithInputHandlingForInvokeCommandImpl.Invoke($ScriptBlock.ast,@($Tuple)) + + $ScriptBlock = [scriptblock]::Create($StringScriptBlock) + + Write-Verbose $StringScriptBlock + } + } + + $ScriptBlock = $ExecutionContext.InvokeCommand.NewScriptBlock("param($($ParamsToAdd -Join ", "))`r`n" + $Scriptblock.ToString()) + } + else { + Throw "Must provide ScriptBlock or ScriptFile"; Break + } + + Write-Debug "`$ScriptBlock: $($ScriptBlock | Out-String)" + Write-Verbose "Creating runspace pool and session states" + + #If specified, add variables and modules/snapins to session state + $sessionstate = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault() + if($ImportVariables -and $UserVariables.count -gt 0) { + foreach($Variable in $UserVariables) { + $sessionstate.Variables.Add((New-Object -TypeName System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList $Variable.Name, $Variable.Value, $null) ) + } + } + if ($ImportModules) { + if($UserModules.count -gt 0) { + foreach($ModulePath in $UserModules) { + $sessionstate.ImportPSModule($ModulePath) + } + } + if($UserSnapins.count -gt 0) { + foreach($PSSnapin in $UserSnapins) { + [void]$sessionstate.ImportPSSnapIn($PSSnapin, [ref]$null) + } + } + } + if($ImportFunctions -and $UserFunctions.count -gt 0) { + foreach ($FunctionDef in $UserFunctions) { + $sessionstate.Commands.Add((New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList $FunctionDef.Name,$FunctionDef.ScriptBlock)) + } + } + + #Create runspace pool + $runspacepool = [runspacefactory]::CreateRunspacePool(1, $Throttle, $sessionstate, $Host) + $runspacepool.Open() + + Write-Verbose "Creating empty collection to hold runspace jobs" + $Script:runspaces = New-Object System.Collections.ArrayList + + #If inputObject is bound get a total count and set bound to true + $bound = $PSBoundParameters.keys -contains "InputObject" + if(-not $bound) { + [System.Collections.ArrayList]$allObjects = @() + } + + #Set up log file if specified + if( $LogFile -and (-not (Test-Path $LogFile) -or $AppendLog -eq $false)){ + New-Item -ItemType file -Path $logFile -Force | Out-Null + ("" | Select-Object -Property Date, Action, Runtime, Status, Details | ConvertTo-Csv -NoTypeInformation -Delimiter ";")[0] | Out-File $LogFile + } + + #write initial log entry + $log = "" | Select-Object -Property Date, Action, Runtime, Status, Details + $log.Date = Get-Date + $log.Action = "Batch processing started" + $log.Runtime = $null + $log.Status = "Started" + $log.Details = $null + if($logFile) { + ($log | convertto-csv -Delimiter ";" -NoTypeInformation)[1] | Out-File $LogFile -Append + } + $timedOutTasks = $false + #endregion INIT + } + process { + #add piped objects to all objects or set all objects to bound input object parameter + if($bound) { + $allObjects = $InputObject + } + else { + [void]$allObjects.add( $InputObject ) + } + } + end { + #Use Try/Finally to catch Ctrl+C and clean up. + try { + #counts for progress + $totalCount = $allObjects.count + $script:completedCount = 0 + $startedCount = 0 + foreach($object in $allObjects) { + #region add scripts to runspace pool + #Create the powershell instance, set verbose if needed, supply the scriptblock and parameters + $powershell = [powershell]::Create() + + if ($VerbosePreference -eq 'Continue') { + [void]$PowerShell.AddScript({$VerbosePreference = 'Continue'}) + } + + [void]$PowerShell.AddScript($ScriptBlock).AddArgument($object) + + if ($parameter) { + [void]$PowerShell.AddArgument($parameter) + } + + # $Using support from Boe Prox + if ($UsingVariableData) { + Foreach($UsingVariable in $UsingVariableData) { + Write-Verbose "Adding $($UsingVariable.Name) with value: $($UsingVariable.Value)" + [void]$PowerShell.AddArgument($UsingVariable.Value) + } + } + + #Add the runspace into the powershell instance + $powershell.RunspacePool = $runspacepool + + #Create a temporary collection for each runspace + $temp = "" | Select-Object PowerShell, StartTime, object, Runspace + $temp.PowerShell = $powershell + $temp.StartTime = Get-Date + $temp.object = $object + + #Save the handle output when calling BeginInvoke() that will be used later to end the runspace + $temp.Runspace = $powershell.BeginInvoke() + $startedCount++ + + #Add the temp tracking info to $runspaces collection + Write-Verbose ( "Adding {0} to collection at {1}" -f $temp.object, $temp.starttime.tostring() ) + $runspaces.Add($temp) | Out-Null + + #loop through existing runspaces one time + Get-RunspaceData + + #If we have more running than max queue (used to control timeout accuracy) + #Script scope resolves odd PowerShell 2 issue + $firstRun = $true + while ($runspaces.count -ge $Script:MaxQueue) { + #give verbose output + if($firstRun) { + Write-Verbose "$($runspaces.count) items running - exceeded $Script:MaxQueue limit." + } + $firstRun = $false + + #run get-runspace data and sleep for a short while + Get-RunspaceData + Start-Sleep -Milliseconds $sleepTimer + } + #endregion add scripts to runspace pool + } + Write-Verbose ( "Finish processing the remaining runspace jobs: {0}" -f ( @($runspaces | Where-Object {$_.Runspace -ne $Null}).Count) ) + + Get-RunspaceData -wait + if (-not $quiet) { + Write-Progress -Id $ProgressId -Activity "Running Query" -Status "Starting threads" -Completed + } + } + finally { + #Close the runspace pool, unless we specified no close on timeout and something timed out + if ( ($timedOutTasks -eq $false) -or ( ($timedOutTasks -eq $true) -and ($noCloseOnTimeout -eq $false) ) ) { + Write-Verbose "Closing the runspace pool" + $runspacepool.close() + } + #collect garbage + [gc]::Collect() + } + } +} From b4ae41a9182ef7718ee22d6ca7aaf4e22ad1bf69 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 11 Mar 2019 12:21:24 +0100 Subject: [PATCH 004/145] Update GetOSDeviceWifiInformation.ps1 --- Scripts/GetOSDeviceWifiInformation.ps1 | 68 +++++++++++++++++--------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/Scripts/GetOSDeviceWifiInformation.ps1 b/Scripts/GetOSDeviceWifiInformation.ps1 index 981703b..f75bb05 100644 --- a/Scripts/GetOSDeviceWifiInformation.ps1 +++ b/Scripts/GetOSDeviceWifiInformation.ps1 @@ -1,35 +1,59 @@ -$UMSCredPath = 'C:\Credentials\UmsRmdb.cred' -$UMSUser = 'rmdb' -$UMSPassword = Get-Content $UMSCredPath | ConvertTo-SecureString -$RootCredPath = 'C:\Credentials\TCRoot.cred' -$RootCredential = (Import-Clixml -Path $RootCredPath) -#Id of the devicedirectory -[Int]$TcDirId = 999 +<# + requires function Invoke-Parallel: + https://raw.githubusercontent.com/RamblingCookieMonster/Invoke-Parallel/master/Invoke-Parallel/Invoke-Parallel.ps1 +#> + +[Int]$DeviceDirId = 75 +[String]$Computername = 'igelrmserver' +#[String[]]$SecurityProtocol = 'Tls12' +[String[]]$SecurityProtocol = 'Tls' +[String]$UMSCPath = 'C:\Credentials\UmsRmdb.cred' +[String]$DeviceCPath = 'C:\Credentials\DeviceRoot.cred' +[Switch]$Online = $false +[String]$PathToInvokeParallel = '{0}\Invoke-Parallel.ps1' -f $PSScriptRoot $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = (New-Object System.Management.Automation.PsCredential($UMSUser, $UMSPassword)) - '*-UMS*:Computername' = 'igelrmserver.acme.org' - '*-UMS*:SecurityProtocol' = 'Tls12' + '*-UMS*:Credential' = (Import-Clixml -Path $UMSCPath) + '*-UMS*:Computername' = $Computername + '*-UMS*:SecurityProtocol' = $SecurityProtocol } -$WebSession = New-UMSAPICookie - $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession + '*-UMS*:WebSession' = (New-UMSAPICookie) +} + +if (!(Get-Command Invoke-Parallel -ErrorAction SilentlyContinue)) +{ + . $PathToInvokeParallel } -$DirColl = (Get-UMSDeviceDirectory -Id $TcDirId -Filter children).DirectoryChildren -$DeviceColl = $DirColl.where{$_.ObjectType -eq 'tc'} | Get-UMSDevice -Filter online -$OnlineDeviceColl = $DeviceColl.Where{$_.Online -eq $true} +$SSHCredential = (Import-Clixml -Path $DeviceCPath) + +$DirColl = (Get-UMSDeviceDirectory -Id $DeviceDirId -Filter children).DirectoryChildren + +switch ($Online) +{ + $true + { + $DeviceColl = ($DirColl.where{$_.ObjectType -eq 'tc'} | Get-UMSDevice -Filter online).where{$_.Online -eq $true} + } + Default + { + $DeviceColl = $DirColl.where{$_.ObjectType -eq 'tc'} | Get-UMSDevice + } +} -$UpdateConfigurationColl = $OnlineDeviceColl | - Invoke-Parallel -RunspaceTimeout 10 -ScriptBlock { - $SshSession = New-SSHSession -Computername $_.Name -Credential $Using:RootCredential -AcceptKey - Get-OSWifiConnection -SSHSession $SshSession - $null = Remove-SSHSession -SSHSession $SshSession +$DeviceWifiColl = $DeviceColl | + Invoke-Parallel -RunspaceTimeout 20 -ScriptBlock { + $SshSession = New-SSHSession -Computername $_.Name -Credential $Using:SSHCredential -AcceptKey -ErrorAction SilentlyContinue + if ($SshSession) + { + Get-OSWifiConnection -SSHSession $SshSession + $null = Remove-SSHSession -SSHSession $SshSession + } } -$UpdateConfigurationColl | Select-Object Host, Interface, ESSID, Mode, Frequency, AccessPoint, BitRate, @{ +$DeviceWifiColl | Select-Object Host, Interface, ESSID, Mode, Frequency, AccessPoint, BitRate, @{ name = 'LinkQuality' expression = { [math]::Round(($_.LinkQualityActual / $_.LinkQualityMax * 100), 0) } }, SignalLevel | From a8a578908e5e55df63a63b72ded04819f3ea6edd Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 11 Mar 2019 13:45:29 +0100 Subject: [PATCH 005/145] Update GetOSDeviceWifiInformation.ps1 --- Scripts/GetOSDeviceWifiInformation.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Scripts/GetOSDeviceWifiInformation.ps1 b/Scripts/GetOSDeviceWifiInformation.ps1 index f75bb05..da644ce 100644 --- a/Scripts/GetOSDeviceWifiInformation.ps1 +++ b/Scripts/GetOSDeviceWifiInformation.ps1 @@ -5,12 +5,12 @@ [Int]$DeviceDirId = 75 [String]$Computername = 'igelrmserver' -#[String[]]$SecurityProtocol = 'Tls12' -[String[]]$SecurityProtocol = 'Tls' +[String[]]$SecurityProtocol = 'Tls12' [String]$UMSCPath = 'C:\Credentials\UmsRmdb.cred' [String]$DeviceCPath = 'C:\Credentials\DeviceRoot.cred' [Switch]$Online = $false [String]$PathToInvokeParallel = '{0}\Invoke-Parallel.ps1' -f $PSScriptRoot +$SSHCredential = (Import-Clixml -Path $DeviceCPath) $PSDefaultParameterValues = @{ '*-UMS*:Credential' = (Import-Clixml -Path $UMSCPath) @@ -27,8 +27,6 @@ if (!(Get-Command Invoke-Parallel -ErrorAction SilentlyContinue)) . $PathToInvokeParallel } -$SSHCredential = (Import-Clixml -Path $DeviceCPath) - $DirColl = (Get-UMSDeviceDirectory -Id $DeviceDirId -Filter children).DirectoryChildren switch ($Online) From 8cb2be238307e20a969748bdd322097a41800d3f Mon Sep 17 00:00:00 2001 From: Falk Date: Wed, 13 Mar 2019 10:04:55 +0100 Subject: [PATCH 006/145] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 749a88d..c31d184 100644 --- a/README.MD +++ b/README.MD @@ -8,7 +8,7 @@ This is a module to interact with the IGEL UMS via API and IGEL OS Devices via S To connect to the Devices via **SSH**, the Module [Posh-SSH](https://github.com/darkoperator/Posh-SSH) by Carlos Perez aka darkoperator is required. -The **API** uses a cookie as authentication. You can create it with [New-UMSAPICookie](/#new-umsapicookie): +The **API** uses a cookie as authentication. You can create it with [New-UMSAPICookie](/README.MD#new-umsapicookie): ```powershell $Websession = New-UMSAPICookie -Computername igelrmserver From f66b046e4d00bdfa56516e550e81b8f14818b1d5 Mon Sep 17 00:00:00 2001 From: Falk Date: Wed, 13 Mar 2019 10:05:02 +0100 Subject: [PATCH 007/145] Update Reset-UMSDevice.md --- Docs/Reset-UMSDevice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Reset-UMSDevice.md b/Docs/Reset-UMSDevice.md index afb2867..85a9a57 100644 --- a/Docs/Reset-UMSDevice.md +++ b/Docs/Reset-UMSDevice.md @@ -19,7 +19,7 @@ Reset-UMSDevice [-Computername] [[-TCPPort] ] [[-ApiVersion] Date: Tue, 18 Jun 2019 12:17:41 +0200 Subject: [PATCH 008/145] Update Get-UMSDevice.ps1 added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber --- PSIGEL/Public/Get-UMSDevice.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PSIGEL/Public/Get-UMSDevice.ps1 b/PSIGEL/Public/Get-UMSDevice.ps1 index 936ba4e..359d79f 100644 --- a/PSIGEL/Public/Get-UMSDevice.ps1 +++ b/PSIGEL/Public/Get-UMSDevice.ps1 @@ -42,7 +42,7 @@ WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } Switch ($PsCmdlet.ParameterSetName) @@ -90,7 +90,13 @@ { $Properties += [ordered]@{ 'NetworkName' = [String]$APIObject.networkName + 'Site ' = [String]$APIObject.site 'Comment' = [String]$APIObject.comment + 'Department' = [String]$APIObject.department + 'CostCenter' = [String]$APIObject.costCenter + 'AssetID' = [String]$APIObject.assetID + 'InServiceDate' = [String]$APIObject.inServiceDate + 'SerialNumber' = [String]$APIObject.serialNumber 'ProductId' = [String]$APIObject.productId 'CpuSpeed' = [Int]$APIObject.cpuSpeed 'CpuType' = [String]$APIObject.cpuType From 61944a1eef65c41bc8fa915268931dae200843f3 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 14:12:31 +0200 Subject: [PATCH 009/145] cast Version data types --- PSIGEL/Public/Get-OSFirmware.ps1 | 2 +- PSIGEL/Public/Get-UMSFirmware.ps1 | 4 ++-- PSIGEL/Public/Get-UMSStatus.ps1 | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PSIGEL/Public/Get-OSFirmware.ps1 b/PSIGEL/Public/Get-OSFirmware.ps1 index f532d87..c0f77b4 100644 --- a/PSIGEL/Public/Get-OSFirmware.ps1 +++ b/PSIGEL/Public/Get-OSFirmware.ps1 @@ -17,7 +17,7 @@ function Get-OSFirmware { $CommandResultColl = (Invoke-SSHCommandStream -SSHSession $SSHSession -Command $Command) -replace ('\s', '') $Properties = [ordered]@{ - 'Version' = [string]$CommandResultColl + 'Version' = [Version]::new($CommandResultColl) } $Result = New-Object psobject -Property $Properties $Result diff --git a/PSIGEL/Public/Get-UMSFirmware.ps1 b/PSIGEL/Public/Get-UMSFirmware.ps1 index 561d4b8..0b303a6 100644 --- a/PSIGEL/Public/Get-UMSFirmware.ps1 +++ b/PSIGEL/Public/Get-UMSFirmware.ps1 @@ -38,7 +38,7 @@ WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } Switch ($PsCmdlet.ParameterSetName) @@ -59,7 +59,7 @@ $Properties = [ordered]@{ 'Id' = [Int]$APIObject.id 'Product' = [String]$APIObject.product - 'Version' = [String]$APIObject.version + 'Version' = [Version]::new($APIObject.version) 'FirmwareType' = [String]$APIObject.firmwareType } New-Object psobject -Property $Properties diff --git a/PSIGEL/Public/Get-UMSStatus.ps1 b/PSIGEL/Public/Get-UMSStatus.ps1 index 28e042b..eb0a91a 100644 --- a/PSIGEL/Public/Get-UMSStatus.ps1 +++ b/PSIGEL/Public/Get-UMSStatus.ps1 @@ -34,7 +34,7 @@ WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } Uri = $BaseURL SecurityProtocol = ($SecurityProtocol -join ',') } @@ -43,10 +43,10 @@ $Result = foreach ($APIObject in $APIObjectColl) { $Properties = [ordered]@{ - 'RmGuiServerVersion' = [String]$APIObject.rmGuiServerVersion + 'RmGuiServerVersion' = [Version]::new($APIObject.rmGuiServerVersion) 'BuildNumber' = [Int]$APIObject.buildNumber - 'ActiveMqVersion' = [String]$APIObject.activeMQVersion - 'DerbyVersion' = [String]$APIObject.derbyVersion + 'ActiveMqVersion' = [Version]::new($APIObject.activeMQVersion) + 'DerbyVersion' = [Version]::new($APIObject.derbyVersion) 'ServerUuid' = [String]$APIObject.serverUUID 'Server' = [String]$APIObject.server } From d14835cdafd38a79a84279119fbbb8d3875b7815 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 14:12:47 +0200 Subject: [PATCH 010/145] Update Get-OSWifiConnection.ps1 Removed unused pattern --- PSIGEL/Public/Get-OSWifiConnection.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/PSIGEL/Public/Get-OSWifiConnection.ps1 b/PSIGEL/Public/Get-OSWifiConnection.ps1 index 6e24caf..ac9f926 100644 --- a/PSIGEL/Public/Get-OSWifiConnection.ps1 +++ b/PSIGEL/Public/Get-OSWifiConnection.ps1 @@ -20,7 +20,6 @@ function Get-OSWifiConnection $PatternAccessPoint = 'Access Point:\s(?[^\s]*)' $PatternBitRate = 'Bit Rate(:|=)(?[^\s]*)\s(?[^\s]*)' $PatternTxPower = 'Tx-Power(:|=)(?[^\s]*)\s(?[^\s]*)' - #$PatternLinkQuality = 'Link Quality(:|=)(?[^\s]*)' $PatternLinkQualityActual = 'Link Quality(:|=)(?\d+)' $PatternLinkQualityMax = 'Link Quality(:|=)\d*\/(?\d+)' $PatternSignalLevel = 'Signal level(:|=)(?[^\s]*)\s(?[^\s]*)' From e30ad2bd668cdbc4c4ab5eaa4827efc22491dcc0 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 14:21:42 +0200 Subject: [PATCH 011/145] Update PSIGEL.psd1 set (minimum) PowerShellVersion = '5.1' --- PSIGEL/PSIGEL.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index d30cbe2..34a8fde 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -32,7 +32,7 @@ Description = 'Tools for use with device products of IGEL Technology GmbH' # Die fuer dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls - # PowerShellVersion = '' + PowerShellVersion = '5.1' # Der Name des fuer dieses Modul erforderlichen Windows PowerShell-Hosts # PowerShellHostName = '' From 519b7ced0812fe66053c51b3b0d08da796a3bdf0 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 14:36:26 +0200 Subject: [PATCH 012/145] Update Get-UMSDevice.md --- Docs/Get-UMSDevice.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Docs/Get-UMSDevice.md b/Docs/Get-UMSDevice.md index e9ef3da..5217adc 100644 --- a/Docs/Get-UMSDevice.md +++ b/Docs/Get-UMSDevice.md @@ -94,7 +94,13 @@ FirmwareId : 2 LastIp : 192.168.56.101 MovedToBin : False NetworkName : V11-01 +Site : testsite Comment : [SingleLicensed] +Department : +CostCenter : +AssetID : +InServiceDate : +SerialNumber : ProductId : UC1-LX CpuSpeed : 1608 CpuType : Intel(R) Core(TM) i7-7Y75 CPU @ 1.30GHz @@ -173,7 +179,7 @@ Accepted values: short, details, online, shadow Required: False Position: Benannt -Default value: None +Default value: short Accept pipeline input: False Accept wildcard characters: False ``` From 6ba991fd05235f3036eca51cc6111a5cf921b0d8 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 14:36:47 +0200 Subject: [PATCH 013/145] Update PSIGEL.psd1 '*' -> @() --- PSIGEL/PSIGEL.psd1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 34a8fde..aa1f87b 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -107,13 +107,13 @@ ) # Aus diesem Modul zu exportierende Cmdlets. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und loeschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Cmdlets vorhanden sind. - CmdletsToExport = '*' + CmdletsToExport = @() # Die aus diesem Modul zu exportierenden Variablen - VariablesToExport = '*' + VariablesToExport = @() # Aus diesem Modul zu exportierende Aliase. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und loeschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Aliase vorhanden sind. - AliasesToExport = '*' + AliasesToExport = @() # Aus diesem Modul zu exportierende DSC-Ressourcen # DscResourcesToExport = @() From dc09a037d19f9c94fc6e857af7bd0d8824ff1fd9 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 14:37:54 +0200 Subject: [PATCH 014/145] Update Get-UMSDevice.md --- Docs/Get-UMSDevice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Get-UMSDevice.md b/Docs/Get-UMSDevice.md index 5217adc..0f24edb 100644 --- a/Docs/Get-UMSDevice.md +++ b/Docs/Get-UMSDevice.md @@ -94,7 +94,7 @@ FirmwareId : 2 LastIp : 192.168.56.101 MovedToBin : False NetworkName : V11-01 -Site : testsite +Site : Comment : [SingleLicensed] Department : CostCenter : From 0d2034f298366734cf39db0fd39c915dcffa3b38 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 18 Jun 2019 15:14:02 +0200 Subject: [PATCH 015/145] Update PSIGEL.psd1 --- PSIGEL/PSIGEL.psd1 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index aa1f87b..1c66426 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -130,19 +130,24 @@ PSData = @{ # 'Tags' wurde auf das Modul angewendet und unterstuetzt die Modulermittlung in Onlinekatalogen. - Tags = @('IGEL') + Tags = @('IGEL') # Eine URL zur Lizenz fuer dieses Modul. - LicenseUri = 'https://github.com/IGEL-Community/PSIGEL/blob/master/LICENSE' + LicenseUri = 'https://github.com/IGEL-Community/PSIGEL/blob/master/LICENSE' # Eine URL zur Hauptwebsite fuer dieses Projekt. - ProjectUri = 'https://github.com/IGEL-Community/PSIGEL' + ProjectUri = 'https://github.com/IGEL-Community/PSIGEL' # Eine URL zu einem Symbol, das das Modul darstellt. # IconUri = '' # 'ReleaseNotes' des Moduls - # ReleaseNotes = '' + ReleaseNotes = @' +0.9.1 2019xxxx +* set minimum Powershell Requirement for the module to 5.1 (Core not supported) +* added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter detail +* support for Datatype Version in Get-OSFirmware, Get-UMSFirmware, Get-UMSStatus +'@ } # Ende der PSData-Hashtabelle From 0d511d0c67b9a1459ca9bb46495d7447fa85a096 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 19 Jun 2019 09:16:56 +0200 Subject: [PATCH 016/145] Update README.MD added PS Version support note --- README.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.MD b/README.MD index c31d184..f269e02 100644 --- a/README.MD +++ b/README.MD @@ -2,6 +2,8 @@ This is a module to interact with the IGEL UMS via API and IGEL OS Devices via SSH. +Currently the module only supports PowerShell version **5.1** . + **API** functions got the noun-prefix **UMS** (for Universal Management Server), e.g. Get-**UMS**Something **SSH** functions got the noun-prefix **OS** (for Device), e.g. Get-**OS**Something From 80ad3fe4ae463cf018bb2098cd0d909adf6a3388 Mon Sep 17 00:00:00 2001 From: Falk Date: Sat, 22 Jun 2019 07:20:54 +0200 Subject: [PATCH 017/145] Update UMS.json --- Tests/UMS.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/UMS.json b/Tests/UMS.json index 71c2e2d..a1ca8ec 100644 --- a/Tests/UMS.json +++ b/Tests/UMS.json @@ -114,8 +114,8 @@ ], "UMSStatus": [ { - "RmGuiServerVersion": "6.01.100", - "BuildNumber": "40023" + "RmGuiServerVersion": "6.01.130", + "BuildNumber": "41020" } ], "UMSDevice": [ From 96e382c3fc8b47ccd9896ac426a44f7953e11b41 Mon Sep 17 00:00:00 2001 From: Falk Date: Wed, 26 Jun 2019 22:23:04 +0200 Subject: [PATCH 018/145] Update Get-UMSDevice.ps1 fixed typo --- PSIGEL/Public/Get-UMSDevice.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSIGEL/Public/Get-UMSDevice.ps1 b/PSIGEL/Public/Get-UMSDevice.ps1 index 359d79f..9ae9e5f 100644 --- a/PSIGEL/Public/Get-UMSDevice.ps1 +++ b/PSIGEL/Public/Get-UMSDevice.ps1 @@ -90,7 +90,7 @@ { $Properties += [ordered]@{ 'NetworkName' = [String]$APIObject.networkName - 'Site ' = [String]$APIObject.site + 'Site' = [String]$APIObject.site 'Comment' = [String]$APIObject.comment 'Department' = [String]$APIObject.department 'CostCenter' = [String]$APIObject.costCenter From 1dce6c64a81f5572856c9b2adbc30c9d72980952 Mon Sep 17 00:00:00 2001 From: Falk Date: Sun, 30 Jun 2019 21:19:01 +0200 Subject: [PATCH 019/145] Create GetDirectories --- Scripts/GetDirectories.ps1 | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Scripts/GetDirectories.ps1 diff --git a/Scripts/GetDirectories.ps1 b/Scripts/GetDirectories.ps1 new file mode 100644 index 0000000..d83f09c --- /dev/null +++ b/Scripts/GetDirectories.ps1 @@ -0,0 +1,40 @@ +$UMSCredPath = 'C:\Credentials\UmsRmdb.cred' + +$PSDefaultParameterValues = @{ + 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath + '*-UMS*:Computername' = 'igelrmserver' +} +$PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = (New-UMSAPICookie) +} + +#$DeviceColl = Get-UMSDevice +$DeviceDirectoryColl = Get-UMSDeviceDirectory +$StartDirectoryColl = ($DeviceDirectoryColl).where{@(1917) -contains $_.Id} + +function Get-Coll +{ + param ( + $id + ) + + $Coll = @() + + $Coll += ($DeviceDirectoryColl).where{$_.Id -eq $id} + + $ChildDirColl = ($DeviceDirectoryColl).where{$_.ParentId -eq $id} + + foreach ($ChildDir in $ChildDirColl) + { + $childColl = Get-Coll -id $ChildDir.Id + $Coll += $childColl + } + $Coll +} + +$Result = foreach ($StartDirectory in $StartDirectoryColl) +{ + Get-Coll -id $StartDirectory.Id +} + +$Result From d16d16cf5fe0bf517c31b711787a221a0ab759a9 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 14:36:08 +0200 Subject: [PATCH 020/145] Create Get-UMSDirectoryRecursive.md --- Docs/Get-UMSDirectoryRecursive.md | 241 ++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 Docs/Get-UMSDirectoryRecursive.md diff --git a/Docs/Get-UMSDirectoryRecursive.md b/Docs/Get-UMSDirectoryRecursive.md new file mode 100644 index 0000000..4231a8c --- /dev/null +++ b/Docs/Get-UMSDirectoryRecursive.md @@ -0,0 +1,241 @@ +--- +external help file: PSIGEL-help.xml +Module Name: PSIGEL +online version: +schema: 2.0.0 +--- + +# Get-UMSDirectoryRecursive + +## SYNOPSIS +Gets either all directory or element ids from below given directory id. + +## SYNTAX + +### Directory (Default) +``` +Get-UMSDirectoryRecursive [-Id] [-DirectoryColl] [] +``` + +### Element +``` +Get-UMSDirectoryRecursive [-Id] [-DirectoryColl] [-ElementColl] [] +``` + +## DESCRIPTION +Gets either all directory or element ids from below given directory id. + +## EXAMPLES + +### Example 1 +Get information on all directories below device directory with the ID 197: + +```powershell +$DeviceDirectoryColl = Get-UMSDeviceDirectory -ComputerName 'igelrmserver' -WebSession $WebSession +Get-UMSDirectoryRecursive -Id 197 -DirectoryColl $DeviceDirectoryColl + +Id : 197 +Name : Computers +ParentId : 48 +MovedToBin : False +ObjectType : tcdirectory + +Id : 198 +Name : Computers01 +ParentId : 197 +MovedToBin : False +ObjectType : tcdirectory + +Id : 199 +Name : Room1013 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 200 +Name : Room1014 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 201 +Name : Room1015 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 202 +Name : Room1108 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 203 +Name : Room1U07 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 208 +Name : Computers2 +ParentId : 197 +MovedToBin : False +ObjectType : tcdirectory + +Id : 209 +Name : Room2204 +ParentId : 208 +MovedToBin : False +ObjectType : tcdirectory + +``` + +### Example 2 +Get 'short' information on all devices below device directory with the ID 197: + +```powershell +$DeviceColl = Get-UMSDevice -ComputerName 'igelrmserver' -WebSession $WebSession +$DeviceDirectoryColl = Get-UMSDeviceDirectory -ComputerName 'igelrmserver' -WebSession $WebSession +Get-UMSDirectoryRecursive -Id 197 -DirectoryColl $DeviceDirectoryColl -ElementColl $DeviceColl + +Id : 112567 +ObjectType : tc +UnitId : 00E0C5347154 +Mac : 00E0C5347154 +Name : DEV1417 +ParentId : 201 +FirmwareId : 6 +LastIp : 192.168.11.123 +MovedToBin : False + +Id : 3404 +ObjectType : tc +UnitId : 00E0C537A54E +Mac : 00E0C537A54E +Name : DEV0577 +ParentId : 203 +FirmwareId : 6 +LastIp : 192.168.73.1 +MovedToBin : False + +Id : 3430 +ObjectType : tc +UnitId : 00E0C5417B66 +Mac : 00E0C5417B66 +Name : DEV0006 +ParentId : 203 +FirmwareId : 6 +LastIp : 192.168.85.11 +MovedToBin : False + +... + +Id : 4308 +ObjectType : tc +UnitId : 00E0C53FF551 +Mac : 00E0C53FF551 +Name : DEV7479 +ParentId : 216 +FirmwareId : 20 +LastIp : +MovedToBin : False +``` + +### Example 3 +Get information on all profiles below profile directory with the ID 908: + +```powershell +$ProfileDirectoryColl = Get-UMSProfileDirectory -ComputerName 'igelrmserver' -WebSession $WebSession +$ProfileColl = Get-UMSProfile -ComputerName 'igelrmserver' -WebSession $WebSession +908 | Get-UMSDirectoryRecursive -DirectoryColl $ProfileDirectoryColl -ElementColl $ProfileColl + +FirmwareId : 39 +IsMasterProfile : False +OverridesSessions : False +Id : 18902 +Name : 05|USBStorageHotplug:Disable +ParentId : 11722 +MovedToBin : False +ObjectType : profile + +FirmwareId : 39 +IsMasterProfile : False +OverridesSessions : False +Id : 12047 +Name : 06|Passwort_DomaineAutomaticLogin:Off|UDW +ParentId : 11724 +MovedToBin : False +ObjectType : profile + +... + +FirmwareId : 39 +IsMasterProfile : False +OverridesSessions : False +Id : 94461 +Name : 07|Update_Snapshots_Download_W10|UDW +ParentId : 11726 +MovedToBin : False +ObjectType : profile +``` + +## PARAMETERS + +### -DirectoryColl +Collection of all Directories. Can be determined from Get-UMSDeviceDirectory or Get-UMSProfileDirectory. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: Benannt +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ElementColl +Collection of all Elements. Can be determined from Get-UMSDevice or Get-UMSProfile. + +```yaml +Type: Object +Parameter Sets: Element +Aliases: + +Required: True +Position: Benannt +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +ID of the starting device directory + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: True +Position: Benannt +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Int32 + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS From 3ae7fbb3b6e56a1f2769d412f3b8b891dc02213a Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 14:36:59 +0200 Subject: [PATCH 021/145] Update PSIGEL.psd1 added Get-UMSDirectoryRecursive --- PSIGEL/PSIGEL.psd1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 1c66426..7235f93 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -76,6 +76,7 @@ 'Get-UMSDeviceAssignment' 'Get-UMSDeviceDirectory' 'Get-UMSDeviceDirectoryAssignment' + 'Get-UMSDirectoryRecursive' 'Get-UMSFirmware' 'Get-UMSProfile' 'Get-UMSProfileDirectory' @@ -147,6 +148,7 @@ * set minimum Powershell Requirement for the module to 5.1 (Core not supported) * added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter detail * support for Datatype Version in Get-OSFirmware, Get-UMSFirmware, Get-UMSStatus +* added Get-UMSDirectoryRecursive '@ } # Ende der PSData-Hashtabelle From 8205b03167b5ddc3d5a47e65b66473b5c37d31df Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 14:37:08 +0200 Subject: [PATCH 022/145] Create Get-UMSDirectoryRecursive.ps1 --- PSIGEL/Public/Get-UMSDirectoryRecursive.ps1 | 53 +++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 PSIGEL/Public/Get-UMSDirectoryRecursive.ps1 diff --git a/PSIGEL/Public/Get-UMSDirectoryRecursive.ps1 b/PSIGEL/Public/Get-UMSDirectoryRecursive.ps1 new file mode 100644 index 0000000..f96f621 --- /dev/null +++ b/PSIGEL/Public/Get-UMSDirectoryRecursive.ps1 @@ -0,0 +1,53 @@ +function Get-UMSDirectoryRecursive +{ + [CmdletBinding(DefaultParameterSetName = 'Directory')] + param ( + [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] + [Int] + $Id, + + [Parameter(Mandatory)] + $DirectoryColl, + + [Parameter(Mandatory, ParameterSetName = 'Element')] + $ElementColl + ) + Begin + { + } + Process + { + $ResultDirectoryColl = { + ($DirectoryColl).where{ $_.Id -eq $Id } + $ChildDirColl = ($DirectoryColl).where{ $_.ParentId -eq $Id } + foreach ($ChildDir in $ChildDirColl) + { + Get-UMSDirectoryRecursive -Id $ChildDir.Id -DirectoryColl $DirectoryColl + } + } + Switch ($PsCmdlet.ParameterSetName) + { + 'Directory' + { + $Result = (& $ResultDirectoryColl) + } + 'Element' + { + $Result = foreach ($Directory in (& $ResultDirectoryColl)) + { + foreach ($Element in $ElementColl) + { + if ($Element.ParentId -eq $Directory.Id) + { + $Element + } + } + } + } + } + $Result + } + End + { + } +} \ No newline at end of file From 61e4d1f404d392e747370ef8ab0a6f75f978a95f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 14:37:17 +0200 Subject: [PATCH 023/145] Update GetDirectories.ps1 --- Scripts/GetDirectories.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Scripts/GetDirectories.ps1 b/Scripts/GetDirectories.ps1 index d83f09c..dac65bb 100644 --- a/Scripts/GetDirectories.ps1 +++ b/Scripts/GetDirectories.ps1 @@ -3,6 +3,7 @@ $UMSCredPath = 'C:\Credentials\UmsRmdb.cred' $PSDefaultParameterValues = @{ 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath '*-UMS*:Computername' = 'igelrmserver' + '*-UMS*:SecurityProtocol' = 'Tls' } $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = (New-UMSAPICookie) @@ -10,7 +11,7 @@ $PSDefaultParameterValues += @{ #$DeviceColl = Get-UMSDevice $DeviceDirectoryColl = Get-UMSDeviceDirectory -$StartDirectoryColl = ($DeviceDirectoryColl).where{@(1917) -contains $_.Id} +$StartDirectoryColl = ($DeviceDirectoryColl).where{ @(197) -contains $_.Id } function Get-Coll { @@ -20,9 +21,9 @@ function Get-Coll $Coll = @() - $Coll += ($DeviceDirectoryColl).where{$_.Id -eq $id} + $Coll += ($DeviceDirectoryColl).where{ $_.Id -eq $id } - $ChildDirColl = ($DeviceDirectoryColl).where{$_.ParentId -eq $id} + $ChildDirColl = ($DeviceDirectoryColl).where{ $_.ParentId -eq $id } foreach ($ChildDir in $ChildDirColl) { From c62f809db0dbdae89ae50af72c07b6bd33996333 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 14:41:00 +0200 Subject: [PATCH 024/145] Update PSIGEL-help.xml added 'Get-UMSDirectoryRecursive' --- PSIGEL/en-US/PSIGEL-help.xml | 285 ++++++++++++++++++++++++++++++++++- 1 file changed, 281 insertions(+), 4 deletions(-) diff --git a/PSIGEL/en-US/PSIGEL-help.xml b/PSIGEL/en-US/PSIGEL-help.xml index 52c416a..e42657c 100644 --- a/PSIGEL/en-US/PSIGEL-help.xml +++ b/PSIGEL/en-US/PSIGEL-help.xml @@ -372,7 +372,7 @@ SignalLevel : -42 String - None + short Id @@ -465,7 +465,7 @@ SignalLevel : -42 String - None + short Id @@ -603,7 +603,13 @@ FirmwareId : 2 LastIp : 192.168.56.101 MovedToBin : False NetworkName : V11-01 +Site : Comment : [SingleLicensed] +Department : +CostCenter : +AssetID : +InServiceDate : +SerialNumber : ProductId : UC1-LX CpuSpeed : 1608 CpuType : Intel(R) Core(TM) i7-7Y75 CPU @ 1.30GHz @@ -1357,6 +1363,277 @@ AssignmentPosition : 1 + + + Get-UMSDirectoryRecursive + Get + UMSDirectoryRecursive + + Gets either all directory or element ids from below given directory id. + + + + Gets either all directory or element ids from below given directory id. + + + + Get-UMSDirectoryRecursive + + DirectoryColl + + Collection of all Directories. Can be determined from Get-UMSDeviceDirectory or Get-UMSProfileDirectory. + + Object + + Object + + + None + + + ElementColl + + Collection of all Elements. Can be determined from Get-UMSDevice or Get-UMSProfile. + + Object + + Object + + + None + + + Id + + ID of the starting device directory + + Int32 + + Int32 + + + None + + + + + + DirectoryColl + + Collection of all Directories. Can be determined from Get-UMSDeviceDirectory or Get-UMSProfileDirectory. + + Object + + Object + + + None + + + ElementColl + + Collection of all Elements. Can be determined from Get-UMSDevice or Get-UMSProfile. + + Object + + Object + + + None + + + Id + + ID of the starting device directory + + Int32 + + Int32 + + + None + + + + + + System.Int32 + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + $DeviceDirectoryColl = Get-UMSDeviceDirectory -ComputerName 'igelrmserver' -WebSession $WebSession +Get-UMSDirectoryRecursive -Id 197 -DirectoryColl $DeviceDirectoryColl + +Id : 197 +Name : Computers +ParentId : 48 +MovedToBin : False +ObjectType : tcdirectory + +Id : 198 +Name : Computers01 +ParentId : 197 +MovedToBin : False +ObjectType : tcdirectory + +Id : 199 +Name : Room1013 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 200 +Name : Room1014 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 201 +Name : Room1015 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 202 +Name : Room1108 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 203 +Name : Room1U07 +ParentId : 198 +MovedToBin : False +ObjectType : tcdirectory + +Id : 208 +Name : Computers2 +ParentId : 197 +MovedToBin : False +ObjectType : tcdirectory + +Id : 209 +Name : Room2204 +ParentId : 208 +MovedToBin : False +ObjectType : tcdirectory + + + + + + -------------------------- Example 2 -------------------------- + $DeviceColl = Get-UMSDevice -ComputerName 'igelrmserver' -WebSession $WebSession +$DeviceDirectoryColl = Get-UMSDeviceDirectory -ComputerName 'igelrmserver' -WebSession $WebSession +Get-UMSDirectoryRecursive -Id 197 -DirectoryColl $DeviceDirectoryColl -ElementColl $DeviceColl + +Id : 112567 +ObjectType : tc +UnitId : 00E0C5347154 +Mac : 00E0C5347154 +Name : DEV1417 +ParentId : 201 +FirmwareId : 6 +LastIp : 192.168.11.123 +MovedToBin : False + +Id : 3404 +ObjectType : tc +UnitId : 00E0C537A54E +Mac : 00E0C537A54E +Name : DEV0577 +ParentId : 203 +FirmwareId : 6 +LastIp : 192.168.73.1 +MovedToBin : False + +Id : 3430 +ObjectType : tc +UnitId : 00E0C5417B66 +Mac : 00E0C5417B66 +Name : DEV0006 +ParentId : 203 +FirmwareId : 6 +LastIp : 192.168.85.11 +MovedToBin : False + +... + +Id : 4308 +ObjectType : tc +UnitId : 00E0C53FF551 +Mac : 00E0C53FF551 +Name : DEV7479 +ParentId : 216 +FirmwareId : 20 +LastIp : +MovedToBin : False + + + + + + -------------------------- Example 3 -------------------------- + $ProfileDirectoryColl = Get-UMSProfileDirectory -ComputerName 'igelrmserver' -WebSession $WebSession +$ProfileColl = Get-UMSProfile -ComputerName 'igelrmserver' -WebSession $WebSession +908 | Get-UMSDirectoryRecursive -DirectoryColl $ProfileDirectoryColl -ElementColl $ProfileColl + +FirmwareId : 39 +IsMasterProfile : False +OverridesSessions : False +Id : 18902 +Name : 05|USBStorageHotplug:Disable +ParentId : 11722 +MovedToBin : False +ObjectType : profile + +FirmwareId : 39 +IsMasterProfile : False +OverridesSessions : False +Id : 12047 +Name : 06|Passwort_DomaineAutomaticLogin:Off|UDW +ParentId : 11724 +MovedToBin : False +ObjectType : profile + +... + +FirmwareId : 39 +IsMasterProfile : False +OverridesSessions : False +Id : 94461 +Name : 07|Update_Snapshots_Download_W10|UDW +ParentId : 11726 +MovedToBin : False +ObjectType : profile + + + + + + + Get-UMSFirmware @@ -3992,7 +4269,7 @@ $PSDefaultParameterValues += @{ -------------------------- Example 2 -------------------------- #Save credential securely to file (one time only): -Get-Credential | Export-Clixml -Path ('{0}\igelums@igelrmserver.cred' -f ${env:\userprofile}) -Credential (Get-Credential) +Get-Credential | Export-Clixml -Path ('{0}\igelums@igelrmserver.cred' -f ${env:\userprofile}) #Load credential from file $Credential = Import-Clixml -Path ('{0}\igelums@igelrmserver.cred' -f ${env:\userprofile}) @@ -7017,7 +7294,7 @@ Deletion successful. 230 - Resets a device to factory defaults and removes it completely (without recycle bin) via API. The device has to be online to be reset, otherwise the device is only removed. + Resets a device to factory defaults and removes it completely (without recycle bin) via API. From f384b36d06dfe594342ccc6210867ca4d97600db Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 14:51:26 +0200 Subject: [PATCH 025/145] Update Get-UMSDirectoryRecursive.md --- Docs/Get-UMSDirectoryRecursive.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Get-UMSDirectoryRecursive.md b/Docs/Get-UMSDirectoryRecursive.md index 4231a8c..e76be0c 100644 --- a/Docs/Get-UMSDirectoryRecursive.md +++ b/Docs/Get-UMSDirectoryRecursive.md @@ -162,7 +162,7 @@ FirmwareId : 39 IsMasterProfile : False OverridesSessions : False Id : 12047 -Name : 06|Passwort_DomaineAutomaticLogin:Off|UDW +Name : 06|Password_DomaineAutomaticLogin:Off|UDW ParentId : 11724 MovedToBin : False ObjectType : profile From c423d06cc9a74dc3efd4b50f172776e6599fa10f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 15:08:04 +0200 Subject: [PATCH 026/145] Update Get-UMSDirectoryRecursive.md --- Docs/Get-UMSDirectoryRecursive.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Get-UMSDirectoryRecursive.md b/Docs/Get-UMSDirectoryRecursive.md index e76be0c..4148f59 100644 --- a/Docs/Get-UMSDirectoryRecursive.md +++ b/Docs/Get-UMSDirectoryRecursive.md @@ -162,7 +162,7 @@ FirmwareId : 39 IsMasterProfile : False OverridesSessions : False Id : 12047 -Name : 06|Password_DomaineAutomaticLogin:Off|UDW +Name : 06|Password_DomainAutomaticLogin:Off|UDW ParentId : 11724 MovedToBin : False ObjectType : profile From 22af6e21a3dbbd9b9aa6577a93bb8bd919d11d1b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 15:27:44 +0200 Subject: [PATCH 027/145] Update README.MD --- README.MD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.MD b/README.MD index f269e02..535fc57 100644 --- a/README.MD +++ b/README.MD @@ -50,6 +50,9 @@ Gets information on a device directory. ### [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) Gets information on a profile or master profile assignment of a device directory. +### [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive) +Gets either all directory or element ids from below given directory id. + ### [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) Gets information on a firmware. From 77a9ba661a6e8065848dfa90e3a511397f12223e Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 15:31:10 +0200 Subject: [PATCH 028/145] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 535fc57..4e82a38 100644 --- a/README.MD +++ b/README.MD @@ -50,7 +50,7 @@ Gets information on a device directory. ### [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) Gets information on a profile or master profile assignment of a device directory. -### [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive) +### [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md Gets either all directory or element ids from below given directory id. ### [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) From 0cad7893c2216ac7ecb0a129eff6e651f6f3d954 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 15:31:40 +0200 Subject: [PATCH 029/145] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 4e82a38..c965100 100644 --- a/README.MD +++ b/README.MD @@ -50,7 +50,7 @@ Gets information on a device directory. ### [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) Gets information on a profile or master profile assignment of a device directory. -### [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md +### [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md) Gets either all directory or element ids from below given directory id. ### [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) From d38267843f18d0990a4e6389068155da73cba787 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 16:37:36 +0200 Subject: [PATCH 030/145] Create GetUMSDeviceUpgradeToOs11.ps1 --- Scripts/GetUMSDeviceUpgradeToOs11.ps1 | 90 +++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 Scripts/GetUMSDeviceUpgradeToOs11.ps1 diff --git a/Scripts/GetUMSDeviceUpgradeToOs11.ps1 b/Scripts/GetUMSDeviceUpgradeToOs11.ps1 new file mode 100644 index 0000000..7bddc5d --- /dev/null +++ b/Scripts/GetUMSDeviceUpgradeToOs11.ps1 @@ -0,0 +1,90 @@ +<# + +IGEL Devices That Can Be Upgraded to IGEL OS 11 +CPU with 64-bit support +≥ 2 GB RAM +≥ 2 GB Flash +No VIA graphics adapter +https://kb.igel.com/igelos-10.05.800/en/igel-devices-that-can-be-upgraded-to-igel-os-11-14686133.html + +#> +#$Path = '{0}\IGELDevicesAbleToUpgradeToOS11-{1}.xlsx' -f $Env:TEMP, ((Get-Date).ToString('s') -replace '(-|:)', '') + +$SupportedDeviceCollJson = @' +{ + "ProductId": + [ + "UD2-LX 40", + "UD3-LX 51", + "UD3-LX 50", + "UD5-LX 50", + "UD6-LX 51", + "UD7-LX 10", + "UD9-LX 41", + "UD9-LX 40", + "IZ2 40", + "IZ3 51", + "IZ3 50" + ] +} +'@ +$SupportedDeviceColl = $SupportedDeviceCollJson | ConvertFrom-Json + +$PSDefaultParameterValues = @{ + '*-UMS*:Credential' = (Import-Clixml -Path 'C:\Credentials\UmsRmdb.cred') + '*-UMS*:Computername' = 'igelrmserver' + #'*-UMS*:SecurityProtocol' = 'Tls' +} + +$PSDefaultParameterValues += @{ + '*UMS*:WebSession' = (New-UMSAPICookie) +} + +$FirmwareColl = Get-UMSFirmware + +$DeviceColl = Get-UMSDevice -Filter details | +Where-Object { ($_.ProductId) -and ($_.DeviceType -notmatch '^Legacy') } | #excludes devices which never reported to the UMS and non IGEL devices +Select-Object -Property Name, Id, FirmwareId, MemorySize, FlashSize, OsType, DeviceType, ProductId, @{ + name = 'ProductIdParsed' + expression = + { + ([regex]::match($_.ProductId, "^(UD(2|3|5|6|7|9)-LX\s\d{2,2})")).value + } +}, @{ + name = 'Codec' + expression = + { + ([regex]::match($_.ProductId, "(a|c|ac)$")).value + } +} + +$JoinObjectParams = @{ + Left = $DeviceColl + LeftJoinProperty = 'FirmwareId' + Right = $FirmwareColl + RightJoinProperty = 'Id' + RightProperties = 'Product', 'Version', 'FirmwareTyp' + Type = 'AllInLeft' +} +$DeviceFirmwareColl = Join-Object @JoinObjectParams + +$AddMemberParams = @{ + MemberType = 'NoteProperty' + Name = 'Upgrade to OS11' + PassThru = $True + Force = $True +} + +$Result = foreach ($Device in $DeviceFirmwareColl) +{ + if (($SupportedDeviceColl.ProductId -contains $Device.ProductIdParsed) -and ($Device.Version -lt '11.0.0')) + { + $Device | Add-Member @AddMemberParams -Value $True + } + else + { + $Device | Add-Member @AddMemberParams -Value $False + } +} + +$Result | Out-GridView From baed313985370d792b25a28a919692a465a9e049 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 1 Jul 2019 16:43:10 +0200 Subject: [PATCH 031/145] Update GetUMSDeviceUpgradeToOs11.ps1 --- Scripts/GetUMSDeviceUpgradeToOs11.ps1 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Scripts/GetUMSDeviceUpgradeToOs11.ps1 b/Scripts/GetUMSDeviceUpgradeToOs11.ps1 index 7bddc5d..2fa59fd 100644 --- a/Scripts/GetUMSDeviceUpgradeToOs11.ps1 +++ b/Scripts/GetUMSDeviceUpgradeToOs11.ps1 @@ -1,5 +1,10 @@ <# +- Gets all devices and all firmwares from UMS +- throws out all 'legacy' devices (non-IGEL devices) +- looks for devices with product ids from $SupportedDeviceCollJson +- categorizes devices with OS11 and higher as non upgradeble + IGEL Devices That Can Be Upgraded to IGEL OS 11 CPU with 64-bit support ≥ 2 GB RAM @@ -31,9 +36,9 @@ $SupportedDeviceCollJson = @' $SupportedDeviceColl = $SupportedDeviceCollJson | ConvertFrom-Json $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = (Import-Clixml -Path 'C:\Credentials\UmsRmdb.cred') - '*-UMS*:Computername' = 'igelrmserver' - #'*-UMS*:SecurityProtocol' = 'Tls' + '*-UMS*:Credential' = (Get-Credential) + '*-UMS*:Computername' = 'igelrmserver' + '*-UMS*:SecurityProtocol' = 'Tls12' } $PSDefaultParameterValues += @{ @@ -43,7 +48,7 @@ $PSDefaultParameterValues += @{ $FirmwareColl = Get-UMSFirmware $DeviceColl = Get-UMSDevice -Filter details | -Where-Object { ($_.ProductId) -and ($_.DeviceType -notmatch '^Legacy') } | #excludes devices which never reported to the UMS and non IGEL devices +Where-Object { ($_.ProductId) -and ($_.DeviceType -notmatch '^Legacy') } Select-Object -Property Name, Id, FirmwareId, MemorySize, FlashSize, OsType, DeviceType, ProductId, @{ name = 'ProductIdParsed' expression = From 39ed7a4fffe49d8d69183f79f633e0fcd94eff29 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 2 Jul 2019 16:31:09 +0200 Subject: [PATCH 032/145] Update GetUMSDeviceUpgradeToOs11.ps1 --- Scripts/GetUMSDeviceUpgradeToOs11.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Scripts/GetUMSDeviceUpgradeToOs11.ps1 b/Scripts/GetUMSDeviceUpgradeToOs11.ps1 index 2fa59fd..111a222 100644 --- a/Scripts/GetUMSDeviceUpgradeToOs11.ps1 +++ b/Scripts/GetUMSDeviceUpgradeToOs11.ps1 @@ -1,5 +1,8 @@ <# +Join-Object function is required +https://github.com/RamblingCookieMonster/PowerShell/blob/master/Join-Object.ps1 + - Gets all devices and all firmwares from UMS - throws out all 'legacy' devices (non-IGEL devices) - looks for devices with product ids from $SupportedDeviceCollJson From 01edfdc9cd0c44bca0274a680844d110d373387d Mon Sep 17 00:00:00 2001 From: Falk Date: Fri, 5 Jul 2019 15:25:48 +0200 Subject: [PATCH 033/145] edited test parameters --- Tests/Get-UMSDevice.Tests.ps1 | 4 +-- Tests/Get-UMSDeviceAssignment.Tests.ps1 | 10 +++--- Tests/Get-UMSDeviceDirectory.Tests.ps1 | 4 +-- ...Get-UMSDeviceDirectoryAssignment.Tests.ps1 | 8 ++--- Tests/Get-UMSFirmware.Tests.ps1 | 8 ++--- Tests/Get-UMSProfile.Tests.ps1 | 4 +-- Tests/Get-UMSProfileAssignment.Tests.ps1 | 4 +-- Tests/Get-UMSProfileDirectory.Tests.ps1 | 12 +++---- Tests/Get-UMSStatus.Tests.ps1 | 8 ++--- Tests/Move-UMSDevice.Tests.ps1 | 4 +-- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 4 +-- Tests/Move-UMSProfile.Tests.ps1 | 4 +-- Tests/Move-UMSProfileDirectory.Tests.ps1 | 4 +-- Tests/New-UMSDevice.Tests.ps1 | 4 +-- Tests/New-UMSDeviceDirectory.Tests.ps1 | 4 +-- Tests/New-UMSProfileAssignment.Tests.ps1 | 4 +-- Tests/New-UMSProfileDirectory.Tests.ps1 | 4 +-- Tests/Pester.ps1 | 19 ++++++----- Tests/Remove-UMSDevice.Tests.ps1 | 5 +-- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 4 +-- Tests/Remove-UMSProfile.Tests.ps1 | 4 +-- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 4 +-- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 4 +-- Tests/Reset-UMSDevice.Tests.ps1 | 4 +-- Tests/Restart-UMSDevice.Tests.ps1 | 4 +-- Tests/Send-UMSDeviceSetting.Tests.ps1 | 4 +-- Tests/Start-UMSDevice.Tests.ps1 | 4 +-- Tests/Stop-UMSDevice.Tests.ps1 | 4 +-- Tests/UMS.json | 33 ++++++++++++++++--- Tests/Update-UMSDevice.Tests.ps1 | 4 +-- Tests/Update-UMSDeviceDirectory.Tests.ps1 | 4 +-- Tests/Update-UMSProfile.Tests.ps1 | 4 +-- Tests/Update-UMSProfileDirectory.Tests.ps1 | 4 +-- 33 files changed, 82 insertions(+), 121 deletions(-) diff --git a/Tests/Get-UMSDevice.Tests.ps1 b/Tests/Get-UMSDevice.Tests.ps1 index 029c68a..60713cc 100644 --- a/Tests/Get-UMSDevice.Tests.ps1 +++ b/Tests/Get-UMSDevice.Tests.ps1 @@ -464,9 +464,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[0].Id $Mac = $UMS.UMSDevice[0].Mac diff --git a/Tests/Get-UMSDeviceAssignment.Tests.ps1 b/Tests/Get-UMSDeviceAssignment.Tests.ps1 index 606e828..7cefa2f 100644 --- a/Tests/Get-UMSDeviceAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceAssignment.Tests.ps1 @@ -35,8 +35,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { InModuleScope $Script:ModuleName { $PSDefaultParameterValues = @{ - '*:WebSession' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' - '*:Computername' = 'igelrmserver.acme.org' + '*:WebSession' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' + '*:Computername' = 'igelrmserver.acme.org' 'Get-UMSDeviceAssignment:Id' = 2 } @@ -129,9 +129,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDeviceAssignment[0].Id $ReceiverType = $UMS.UMSDeviceAssignment.ReceiverType $AssigneeId = $UMS.UMSDeviceAssignment.AssigneeId @@ -162,7 +160,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result.Id | Should -HaveType [Int] } - It "Result.Id should be exactly $UMS.UMSDeviceAssignment.Id" { + It "Result.Id should be exactly $($UMS.UMSDeviceAssignment.Id)" { $Result.Id | Should -BeExactly $UMS.UMSDeviceAssignment.Id } diff --git a/Tests/Get-UMSDeviceDirectory.Tests.ps1 b/Tests/Get-UMSDeviceDirectory.Tests.ps1 index 0b0b36e..ae3cf69 100644 --- a/Tests/Get-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectory.Tests.ps1 @@ -219,9 +219,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDeviceDirectory[0].Id $Name = $UMS.UMSDeviceDirectory[0].Name diff --git a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 index 69cbf5e..1917750 100644 --- a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 @@ -35,8 +35,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { InModuleScope $Script:ModuleName { $PSDefaultParameterValues = @{ - '*:WebSession' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' - '*:Computername' = 'igelrmserver.acme.org' + '*:WebSession' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' + '*:Computername' = 'igelrmserver.acme.org' 'Get-UMSDeviceDirectoryAssignment:Id' = 2 } @@ -129,9 +129,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDeviceDirectoryAssignment[0].Id $ReceiverType = $UMS.UMSDeviceDirectoryAssignment.ReceiverType $AssigneeId = $UMS.UMSDeviceDirectoryAssignment.AssigneeId diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index 5c2691a..e2d06d0 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -159,9 +159,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSFirmware[0].id $PSDefaultParameterValues = @{ @@ -194,8 +192,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result.Id | Should -BeExactly $UMS.UMSFirmware[0].id } - It 'Result.Version should have type [String]' { - $Result.Version | Should -HaveType [String] + It 'Result.Version should have type [Version]' { + $Result.Version | Should -HaveType [Version] } It "Result.Version should be exactly $($UMS.UMSFirmware[0].Version)" { diff --git a/Tests/Get-UMSProfile.Tests.ps1 b/Tests/Get-UMSProfile.Tests.ps1 index 5307117..ddfdecc 100644 --- a/Tests/Get-UMSProfile.Tests.ps1 +++ b/Tests/Get-UMSProfile.Tests.ps1 @@ -173,9 +173,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfile[0].id $PSDefaultParameterValues = @{ diff --git a/Tests/Get-UMSProfileAssignment.Tests.ps1 b/Tests/Get-UMSProfileAssignment.Tests.ps1 index 7531f3a..ea8d613 100644 --- a/Tests/Get-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Get-UMSProfileAssignment.Tests.ps1 @@ -174,9 +174,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileAssignment[0].id $ReceiverID = $UMS.UMSProfileAssignment[0].ReceiverID diff --git a/Tests/Get-UMSProfileDirectory.Tests.ps1 b/Tests/Get-UMSProfileDirectory.Tests.ps1 index 1bbd9fe..5a99fd1 100644 --- a/Tests/Get-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Get-UMSProfileDirectory.Tests.ps1 @@ -219,17 +219,15 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileDirectory[0].id $ObjectType = $UMS.UMSProfileDirectory[0].DirectoryChildren.ObjectType $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $UMS.Computername + '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol + '*-UMS*:Id' = $Id 'Get-UMSProfileDirectory:Filter' = 'children' } diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index c8ec080..6bf0b11 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -117,9 +117,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $RmGuiServerVersion = $UMS.UMSStatus.RmGuiServerVersion $BuildNumber = $UMS.UMSStatus.BuildNumber @@ -144,8 +142,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result | Should not BeNullOrEmpty } - It 'Result.RmGuiServerVersion should have type [String]' { - $Result.RmGuiServerVersion | Should -HaveType [String] + It 'Result.RmGuiServerVersion should have type [Version]' { + $Result.RmGuiServerVersion | Should -HaveType [Version] } It "Result.RmGuiServerVersion should be exactly $RmGuiServerVersion" { diff --git a/Tests/Move-UMSDevice.Tests.ps1 b/Tests/Move-UMSDevice.Tests.ps1 index 548d3e4..7385504 100644 --- a/Tests/Move-UMSDevice.Tests.ps1 +++ b/Tests/Move-UMSDevice.Tests.ps1 @@ -133,9 +133,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[0].Id $DestId = $UMS.UMSDevice[0].DestId diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index a77d154..e4ccf14 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -133,9 +133,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDeviceDirectory[0].Id $DestId = $UMS.UMSDeviceDirectory[0].DestId diff --git a/Tests/Move-UMSProfile.Tests.ps1 b/Tests/Move-UMSProfile.Tests.ps1 index 8d2deff..1eddb32 100644 --- a/Tests/Move-UMSProfile.Tests.ps1 +++ b/Tests/Move-UMSProfile.Tests.ps1 @@ -132,9 +132,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfile[0].Id $DestId = $UMS.UMSProfile[0].DestId diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index cd7f122..bfc3625 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -132,9 +132,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileDirectory[0].Id $DestId = $UMS.UMSProfileDirectory[0].DestId diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index 5ed473f..1034d19 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -135,9 +135,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Name = $UMS.UMSDevice[2].NameNew $Mac = $UMS.UMSDevice[2].MacNew $FirmwareId = $UMS.UMSDevice[2].FirmwareIdNew diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index e636d4c..c010879 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -133,9 +133,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Name = $UMS.UMSDeviceDirectory[3].NameNew $PSDefaultParameterValues = @{ diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 110437e..531dfab 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -189,9 +189,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileAssignment[0].Id $ReceiverId = $UMS.UMSProfileAssignment[0].ReceiverIdNew $ReceiverType = $UMS.UMSProfileAssignment[0].ReceiverTypeNew diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index f2bc91e..5dd5caf 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -132,9 +132,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Name = $UMS.UMSProfileDirectory[2].NameNew $PSDefaultParameterValues = @{ diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 1356e2e..9a6f09f 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -14,15 +14,15 @@ $OutputPath = '{0}\Tests\Data' -f $ProjectRoot $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $ProjectRoot) | ConvertFrom-Json -$Password = Get-Content $UMS.CredPath | ConvertTo-SecureString -$Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $PSDefaultParameterValues = @{ - '*:Computername' = $UMS.Computername - '*-UMS*:TCPPort' = [Int]$UMS.TCPPort - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Confirm' = $false - 'Invoke-Pester:Show' = 'Failed' + '*:Computername' = $UMS.Computername + 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMS.Credpath + '*-UMS*:TCPPort' = [Int]$UMS.TCPPort + '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol + '*-UMS*:Confirm' = $false + 'Invoke-Pester:Show' = 'Failed' } <# @@ -52,9 +52,10 @@ switch ($IgelRmGuiServerService) } #> -$WebSession = New-UMSAPICookie -Credential $Credential +#$WebSession = New-UMSAPICookie -Credential $Credential $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession + #'*-UMS*:WebSession' = $WebSession + '*-UMS*:WebSession' = (New-UMSAPICookie) } Invoke-Pester -Script ('{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $ModuleName) -OutputFile ('{0}\{1}.Tests.xml' -f $OutputPath, $ModuleName) diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index 6e39420..c4838f5 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -185,11 +185,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[0].Id - $Mac = $UMS.UMSDevice[0].Mac $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 3558486..2fa864a 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -135,9 +135,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDeviceDirectory[2].Id $PSDefaultParameterValues = @{ diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index bfb98cb..ec8fb8b 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -135,9 +135,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfile[1].Id $PSDefaultParameterValues = @{ diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index 648c0f4..c50b6bf 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -185,9 +185,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileAssignment[1].Id $ReceiverId = $UMS.UMSProfileAssignment[1].ReceiverId $ReceiverType = $UMS.UMSProfileAssignment[1].ReceiverType diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 8b7ecf8..6bbf3f1 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -135,9 +135,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileDirectory[3].Id $PSDefaultParameterValues = @{ diff --git a/Tests/Reset-UMSDevice.Tests.ps1 b/Tests/Reset-UMSDevice.Tests.ps1 index 41365d4..3c0d487 100644 --- a/Tests/Reset-UMSDevice.Tests.ps1 +++ b/Tests/Reset-UMSDevice.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Restart-UMSDevice.Tests.ps1 b/Tests/Restart-UMSDevice.Tests.ps1 index 4d06dec..7b525aa 100644 --- a/Tests/Restart-UMSDevice.Tests.ps1 +++ b/Tests/Restart-UMSDevice.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Send-UMSDeviceSetting.Tests.ps1 b/Tests/Send-UMSDeviceSetting.Tests.ps1 index df4f707..08966cd 100644 --- a/Tests/Send-UMSDeviceSetting.Tests.ps1 +++ b/Tests/Send-UMSDeviceSetting.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Start-UMSDevice.Tests.ps1 b/Tests/Start-UMSDevice.Tests.ps1 index c223da8..9e4314f 100644 --- a/Tests/Start-UMSDevice.Tests.ps1 +++ b/Tests/Start-UMSDevice.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Stop-UMSDevice.Tests.ps1 b/Tests/Stop-UMSDevice.Tests.ps1 index 3ef2edc..7b4b901 100644 --- a/Tests/Stop-UMSDevice.Tests.ps1 +++ b/Tests/Stop-UMSDevice.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/UMS.json b/Tests/UMS.json index a1ca8ec..3dce312 100644 --- a/Tests/UMS.json +++ b/Tests/UMS.json @@ -19,6 +19,7 @@ "Get-UMSDevice", "Get-UMSDeviceAssignment", "Get-UMSDeviceDirectory", + "Get-UMSDirectoryRecursive", "Get-UMSDeviceDirectoryAssignment", "Start-UMSDevice", "Send-UMSDeviceSetting", @@ -48,11 +49,11 @@ "UMSFirmware": [ { "Id": "2", - "Version": "11.01.100.01" + "Version": "11.1.100.1" }, { "Id": "3", - "Version": "10.05.500.01" + "Version": "10.5.500.1" } ], "UMSProfile": [ @@ -108,14 +109,14 @@ "NameNew": "P_ProfileDir03" }, { - "Id": "632", + "Id": "1759", "Name": "P_ProfileDir04" } ], "UMSStatus": [ { - "RmGuiServerVersion": "6.01.130", - "BuildNumber": "41020" + "RmGuiServerVersion": "6.2.100", + "BuildNumber": "42027" } ], "UMSDevice": [ @@ -148,6 +149,13 @@ "password": "a9484d4b-6fb9-4f60-82fb-114a5eafdd24" } }, + { + "Id": "1831", + "ObjectType": "tc", + "Mac": "334455667788", + "Name": "P_TC01_01_01", + "ParentId": "1829" + }, { "NameNew": "P_TC03", "MacNew": "223344556677", @@ -200,6 +208,21 @@ "Name": "P_TCDir03", "ParentId": "-1" }, + { + "Id": "1827", + "Name": "P_TCDir01_01", + "ParentId": "457" + }, + { + "Id": "1828", + "Name": "P_TCDir01_02", + "ParentId": "457" + }, + { + "Id": "1829", + "Name": "P_TCDir01_01_01", + "ParentId": "1827" + }, { "NameNew": "P_TCDir04" } diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index 5d8a857..ca62f3f 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -161,9 +161,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $CommentUpdate = $UMS.UMSDevice[1].CommentUpdate diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index 1f0fdef..db5ab2a 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDeviceDirectory[1].Id $NameUpdate = $UMS.UMSDeviceDirectory[1].NameUpdate diff --git a/Tests/Update-UMSProfile.Tests.ps1 b/Tests/Update-UMSProfile.Tests.ps1 index 7fc0077..4655693 100644 --- a/Tests/Update-UMSProfile.Tests.ps1 +++ b/Tests/Update-UMSProfile.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfile[0].Id $NameUpdate = $UMS.UMSProfile[0].NameUpdate diff --git a/Tests/Update-UMSProfileDirectory.Tests.ps1 b/Tests/Update-UMSProfileDirectory.Tests.ps1 index a52c342..89a502c 100644 --- a/Tests/Update-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Update-UMSProfileDirectory.Tests.ps1 @@ -143,9 +143,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSProfileDirectory[0].Id $NameUpdate = $UMS.UMSProfileDirectory[0].NameUpdate From 3559941242460828c00a60bb63d198c6e1160f4f Mon Sep 17 00:00:00 2001 From: Falk Date: Fri, 5 Jul 2019 15:25:54 +0200 Subject: [PATCH 034/145] Create Get-UMSDirectoryRecursive.Tests.ps1 --- Tests/Get-UMSDirectoryRecursive.Tests.ps1 | 354 ++++++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 Tests/Get-UMSDirectoryRecursive.Tests.ps1 diff --git a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 new file mode 100644 index 0000000..5019afc --- /dev/null +++ b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 @@ -0,0 +1,354 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) + +Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { + + BeforeAll { + if ($null -ne $Result) + { + Clear-Variable -Name $Result -ErrorAction SilentlyContinue + $Script:Result = '' + } + } + + Context "Basics" { + + It "Is valid Powershell (Has no script errors)" { + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $ErrorColl = $Null + $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) + $ErrorColl | Should -HaveCount 0 + } + + [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + $KnownParameters = 'Id', 'DirectoryColl', 'ElementColl' + + It "Should contain our specific parameters" { + (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + } + } + + InModuleScope $Script:ModuleName { + + <# + $PSDefaultParameterValues = @{ + '*:Id' = 999 + '*:DirectoryColl' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' + '*:ElementColl' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' + } + #> + + Context "General Execution" { + + $Script:Result = '' + + Mock 'Get-UMSDirectoryRecursive' {} + + It 'Get-UMSDirectoryRecursive Should not throw' { + { Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{} } | Should -Not -Throw + } + + It 'Get-UMSDirectoryRecursive -ApiVersion 10 Stop Should throw' { + { Get-UMSDirectoryRecursive -ApiVersion 10 -ErrorAction Stop } | Should -Throw + } + + } + + #<# + Context "Mock Get-UMSDirectoryRecursive" { + + $Script:Result = '' + + $DirectoryColl = @( + [pscustomobject]@{ + Id = 99 + Name = 'Directory1' + ParentId = 9 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 999 + Name = 'Directory11' + ParentId = 99 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 9999 + Name = 'Directory111' + ParentId = 999 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + Mock 'Get-UMSDirectoryRecursive' {$DirectoryColl} + + Get-UMSDirectoryRecursive -Id 99 -DirectoryColl $DirectoryColl + + It 'Assert Get-UMSDirectoryRecursive is called exactly 1 time' { + $AMCParams = @{ + CommandName = 'Get-UMSDirectoryRecursive' + Times = 1 + Exactly = $true + } + Assert-MockCalled @AMCParams + } + } + #> + + #<# + Context "ParameterSetName Directory" { + + $Script:Result = '' + + $DirectoryColl = @( + [pscustomobject]@{ + Id = 99 + Name = 'Directory1' + ParentId = 9 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 999 + Name = 'Directory11' + ParentId = 99 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 9999 + Name = 'Directory111' + ParentId = 999 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 8888 + Name = 'Directory888' + ParentId = 888 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + + It "doesn't throw" { + { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl $DirectoryColl } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result should have type pscustomobject' { + $Result | Should -HaveType ([pscustomobject]) + } + + It 'Result should have 3 elements' { + @($Result).Count | Should BeExactly 3 + } + + It 'Result.Id should mot contain 8888' { + $Result.Id | Should Not Contain 8888 + } + + It 'Result[0].Id should be exactly 99' { + $Result[0].Id | Should Be 99 + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + } + #> + + #<# + Context "ParameterSetName Element" { + + $Script:Result = '' + + $DirectoryColl = @( + [pscustomobject]@{ + Id = 99 + Name = 'Directory1' + ParentId = 9 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 999 + Name = 'Directory11' + ParentId = 99 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + }, + [pscustomobject]@{ + Id = 9999 + Name = 'Directory111' + ParentId = 999 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + $ElementColl = @( + [pscustomobject]@{ + Id = 11 + ObjectType = 'tc' + UnitId = '112233445566' + Mac = '112233445566' + Name = 'Element1' + ParentId = 99 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + }, + [pscustomobject]@{ + Id = 111 + ObjectType = 'tc' + UnitId = '223344556677' + Mac = '223344556677' + Name = 'Element11' + ParentId = 999 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + }, + [pscustomobject]@{ + Id = 1111 + ObjectType = 'tc' + UnitId = '334455667788' + Mac = '334455667788' + Name = 'Element111' + ParentId = 9999 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + }, + [pscustomobject]@{ + Id = 8888 + ObjectType = 'tc' + UnitId = '445566778899' + Mac = '445566778899' + Name = 'Element888' + ParentId = 888 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + } + ) + + It "doesn't throw" { + { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl $DirectoryColl -ElementColl $ElementColl } | Should Not Throw + } + + It 'Result should have type pscustomobject' { + $Result | Should -HaveType ([pscustomobject]) + } + + It 'Result should have 3 elements' { + @($Result).Count | Should BeExactly 3 + } + + It 'Result.Id should mot contain 8888' { + $Result.Id | Should Not Contain 8888 + } + + It 'Result[0].Name should be Element1' { + $Result[0].Name | Should Be 'Element1' + } + + It 'Result[0].Id should be 11' { + $Result[0].Id | Should Be 11 + } + + It 'Result[0].ObjectType should be tc' { + $Result[0].ObjectType | should be 'tc' + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + } + #> + + #<# + Context "Error Handling" { + + $Script:Result = '' + Write-Host $Result + + Mock 'Get-UMSDirectoryRecursive' {throw 'Error'} + + it 'should throw Error' { + { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{} -ElementColl @{} } | should throw 'Error' + } + + It 'Result should be null or empty' { + $Script:Result | Should BeNullOrEmpty + } + } + #> + } +} + +<# +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + BeforeAll { + if ($null -ne $Result) + { + Clear-Variable -Name $Result + } + } + + $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | + ConvertFrom-Json + $Credential = Import-Clixml -Path $UMS.CredPath + $Id = $UMS.UMSDirectoryRecursive[0].Id + $Name = $UMS.UMSDirectoryRecursive[0].Name + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $UMS.Computername + '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol + '*-UMS*:Id' = $Id + } + + $WebSession = New-UMSAPICookie -Credential $Credential + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ParameterSetName All" { + + It "doesn't throw" { + { $Script:Result = Get-UMSDirectoryRecursive } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result.Id should have type [Int]' { + $Result.Id | Should -HaveType [Int] + } + + It "Result.Id should be exactly $Id" { + $Result.Id | Should -BeExactly $Id + } + + It 'Result.Name should have type [String]' { + $Result.Name | Should -HaveType [String] + } + + It "Result.Name should be exactly $Name" { + $Result.Name | Should -BeExactly $Name + } + } +} +#> \ No newline at end of file From 901fe5f85df80241b5d69ed0e6bbed435839241c Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 29 Jul 2019 11:13:34 +0200 Subject: [PATCH 035/145] Update PSIGEL.psd1 --- PSIGEL/PSIGEL.psd1 | 1 + 1 file changed, 1 insertion(+) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 7235f93..e173aa9 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -149,6 +149,7 @@ * added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter detail * support for Datatype Version in Get-OSFirmware, Get-UMSFirmware, Get-UMSStatus * added Get-UMSDirectoryRecursive +* edited SerialNumber Length to 18 '@ } # Ende der PSData-Hashtabelle From 4fb428d654679b8f42941eff1e94877f0046ba21 Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 29 Jul 2019 11:13:53 +0200 Subject: [PATCH 036/145] changed serialnumber length --- PSIGEL/Public/New-UMSDevice.ps1 | 2 +- PSIGEL/Public/Update-UMSDevice.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PSIGEL/Public/New-UMSDevice.ps1 b/PSIGEL/Public/New-UMSDevice.ps1 index 1204355..dcf1c65 100644 --- a/PSIGEL/Public/New-UMSDevice.ps1 +++ b/PSIGEL/Public/New-UMSDevice.ps1 @@ -70,7 +70,7 @@ $InserviceDate, [Parameter(ValueFromPipelineByPropertyName)] - [ValidateLength(19, 19)] + [ValidateLength(18, 18)] [String] $SerialNumber ) diff --git a/PSIGEL/Public/Update-UMSDevice.ps1 b/PSIGEL/Public/Update-UMSDevice.ps1 index 9b3f47b..cebe126 100644 --- a/PSIGEL/Public/Update-UMSDevice.ps1 +++ b/PSIGEL/Public/Update-UMSDevice.ps1 @@ -61,7 +61,7 @@ $InserviceDate, [Parameter(ParameterSetName = 'Set')] - [ValidateLength(19, 19)] + [ValidateLength(18, 18)] [String] $SerialNumber ) From e3580f65cf070fa7df9dab3d3fe42b366521a9f3 Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 29 Jul 2019 11:13:57 +0200 Subject: [PATCH 037/145] Create ImportDevices.ps1 --- Scripts/ImportDevices.ps1 | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Scripts/ImportDevices.ps1 diff --git a/Scripts/ImportDevices.ps1 b/Scripts/ImportDevices.ps1 new file mode 100644 index 0000000..e2f17fd --- /dev/null +++ b/Scripts/ImportDevices.ps1 @@ -0,0 +1,42 @@ +$UMSCredPath = 'C:\Credentials\UmsRmdb.cred' + +$PSDefaultParameterValues = @{ + 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath + '*-UMS*:Computername' = 'igelrmserver' + #'*-UMS*:SecurityProtocol' = 'Tls' +} +$PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = (New-UMSAPICookie) +} + +$IGELImportFile = 'C:\Temp\2000000-000010.csv' +$AssetExportFile = 'C:\Temp\Asset.csv' + +$IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile +$AssetExportColl = Import-Csv -Delimiter ';' -Path $AssetExportFile + +$MajorVersion = 10 +$FirmwareId = (((Get-UMSFirmware).where{$_.Version.Major -eq $MajorVersion} | + Sort-Object -Property Version -Descending)[0]).Id + +$NewDeviceCollParams = @{ + Left = $IGELImportColl + LeftJoinProperty = 'Serien-Nr. ' + LeftProperties = 'Serien-Nr. ', 'Mac-Adressen' + Right = $AssetExportColl + RightJoinProperty = 'Serien_Nr' + RightProperties = 'Inventar_Nr' + Type = 'AllInBoth' +} +$NewDeviceColl = Join-Object @NewDeviceCollParams + +foreach ($NewDevice in $NewDeviceColl) +{ + $NewDeviceParams = @{ + Mac = $NewDevice.'Mac-Adressen' + FirmwareId = $FirmwareId + Name = 'TC{0}' -f $NewDevice.Inventar_Nr + SerialNumber = $NewDevice.'Serien-Nr. ' + } + New-UMSDevice @NewDeviceParams -Confirm +} \ No newline at end of file From 9b230f1c02fcb413ff33178e000597043d56f10c Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 29 Jul 2019 15:26:57 +0200 Subject: [PATCH 038/145] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index c965100..66687c6 100644 --- a/README.MD +++ b/README.MD @@ -10,7 +10,7 @@ Currently the module only supports PowerShell version **5.1** . To connect to the Devices via **SSH**, the Module [Posh-SSH](https://github.com/darkoperator/Posh-SSH) by Carlos Perez aka darkoperator is required. -The **API** uses a cookie as authentication. You can create it with [New-UMSAPICookie](/README.MD#new-umsapicookie): +The **API** uses a cookie as authentication. You can create it with [New-UMSAPICookie](/Docs/New-UMSAPICookie.md): ```powershell $Websession = New-UMSAPICookie -Computername igelrmserver From 74b098f4bb519e190d2bf3135896db95e6485c61 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 30 Jul 2019 11:14:55 +0200 Subject: [PATCH 039/145] Update ImportDevices.ps1 --- Scripts/ImportDevices.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Scripts/ImportDevices.ps1 b/Scripts/ImportDevices.ps1 index e2f17fd..8375fe7 100644 --- a/Scripts/ImportDevices.ps1 +++ b/Scripts/ImportDevices.ps1 @@ -3,21 +3,21 @@ $UMSCredPath = 'C:\Credentials\UmsRmdb.cred' $PSDefaultParameterValues = @{ 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath '*-UMS*:Computername' = 'igelrmserver' - #'*-UMS*:SecurityProtocol' = 'Tls' + '*-UMS*:SecurityProtocol' = 'Tls' } $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = (New-UMSAPICookie) } -$IGELImportFile = 'C:\Temp\2000000-000010.csv' -$AssetExportFile = 'C:\Temp\Asset.csv' +$IGELImportFile = 'C:\Temp\2262332160-000010.csv' +$AssetExportFile = 'C:\Temp\Geraete.csv' $IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile $AssetExportColl = Import-Csv -Delimiter ';' -Path $AssetExportFile $MajorVersion = 10 -$FirmwareId = (((Get-UMSFirmware).where{$_.Version.Major -eq $MajorVersion} | - Sort-Object -Property Version -Descending)[0]).Id +$FirmwareId = (((Get-UMSFirmware).where{ $_.Version.Major -eq $MajorVersion } | + Sort-Object -Property Version -Descending)[0]).Id $NewDeviceCollParams = @{ Left = $IGELImportColl @@ -26,7 +26,7 @@ $NewDeviceCollParams = @{ Right = $AssetExportColl RightJoinProperty = 'Serien_Nr' RightProperties = 'Inventar_Nr' - Type = 'AllInBoth' + Type = 'AllInLeft' } $NewDeviceColl = Join-Object @NewDeviceCollParams @@ -37,6 +37,8 @@ foreach ($NewDevice in $NewDeviceColl) FirmwareId = $FirmwareId Name = 'TC{0}' -f $NewDevice.Inventar_Nr SerialNumber = $NewDevice.'Serien-Nr. ' + ParentId = 216020 + AssetId = $NewDevice.Inventar_Nr } - New-UMSDevice @NewDeviceParams -Confirm -} \ No newline at end of file + New-UMSDevice @NewDeviceParams +} From fe97fbb312f260d30c69d1be00f389ed7264bbcf Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 5 Aug 2019 12:43:13 +0200 Subject: [PATCH 040/145] Update ImportDevices.ps1 --- Scripts/ImportDevices.ps1 | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Scripts/ImportDevices.ps1 b/Scripts/ImportDevices.ps1 index 8375fe7..5bb5dd5 100644 --- a/Scripts/ImportDevices.ps1 +++ b/Scripts/ImportDevices.ps1 @@ -3,42 +3,46 @@ $UMSCredPath = 'C:\Credentials\UmsRmdb.cred' $PSDefaultParameterValues = @{ 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath '*-UMS*:Computername' = 'igelrmserver' - '*-UMS*:SecurityProtocol' = 'Tls' + #'*-UMS*:SecurityProtocol' = 'Tls' } $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = (New-UMSAPICookie) } -$IGELImportFile = 'C:\Temp\2262332160-000010.csv' -$AssetExportFile = 'C:\Temp\Geraete.csv' +$Path = 'E:\GitHub\PSIGEL\Drafts\' +#$Path = 'C:\Temp\' -$IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile +$IGELImportFile = '{0}2260123456-000010.csv' -f $Path +$AssetExportFile = '{0}Assets.csv' -f $Path + +$IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile -Header '0', 'SerialNumber', 'MacAddress', '3', '4' $AssetExportColl = Import-Csv -Delimiter ';' -Path $AssetExportFile +$DevicePrefix = 'DEV' $MajorVersion = 10 + $FirmwareId = (((Get-UMSFirmware).where{ $_.Version.Major -eq $MajorVersion } | - Sort-Object -Property Version -Descending)[0]).Id + Sort-Object -Property Version -Descending)[0]).Id $NewDeviceCollParams = @{ Left = $IGELImportColl - LeftJoinProperty = 'Serien-Nr. ' - LeftProperties = 'Serien-Nr. ', 'Mac-Adressen' + LeftJoinProperty = 'SerialNumber' + LeftProperties = 'SerialNumber', 'MacAddress' Right = $AssetExportColl - RightJoinProperty = 'Serien_Nr' - RightProperties = 'Inventar_Nr' + RightJoinProperty = 'SerialNumber' + RightProperties = 'InventoryNumber' Type = 'AllInLeft' } -$NewDeviceColl = Join-Object @NewDeviceCollParams +$NewDeviceColl = Join-Object @NewDeviceCollParams | Sort-Object -Property SerialNumber foreach ($NewDevice in $NewDeviceColl) { $NewDeviceParams = @{ - Mac = $NewDevice.'Mac-Adressen' + Mac = $NewDevice.MacAddress FirmwareId = $FirmwareId - Name = 'TC{0}' -f $NewDevice.Inventar_Nr - SerialNumber = $NewDevice.'Serien-Nr. ' - ParentId = 216020 - AssetId = $NewDevice.Inventar_Nr + Name = '{0}-{1}' -f $DevicePrefix, $NewDevice.InventoryNumber + SerialNumber = $NewDevice.SerialNumber + AssetId = $NewDevice.InventoryNumber } New-UMSDevice @NewDeviceParams } From 4be8b05a6581ffde7eebc26ac3ee511f04781e0e Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 5 Aug 2019 14:46:46 +0200 Subject: [PATCH 041/145] Update ImportDevices.ps1 --- Scripts/ImportDevices.ps1 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Scripts/ImportDevices.ps1 b/Scripts/ImportDevices.ps1 index 5bb5dd5..986a3db 100644 --- a/Scripts/ImportDevices.ps1 +++ b/Scripts/ImportDevices.ps1 @@ -9,8 +9,7 @@ $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = (New-UMSAPICookie) } -$Path = 'E:\GitHub\PSIGEL\Drafts\' -#$Path = 'C:\Temp\' +$Path = 'C:\Temp\' $IGELImportFile = '{0}2260123456-000010.csv' -f $Path $AssetExportFile = '{0}Assets.csv' -f $Path @@ -18,7 +17,7 @@ $AssetExportFile = '{0}Assets.csv' -f $Path $IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile -Header '0', 'SerialNumber', 'MacAddress', '3', '4' $AssetExportColl = Import-Csv -Delimiter ';' -Path $AssetExportFile -$DevicePrefix = 'DEV' +$DevicePrefix = 'DEV-' $MajorVersion = 10 $FirmwareId = (((Get-UMSFirmware).where{ $_.Version.Major -eq $MajorVersion } | @@ -33,14 +32,14 @@ $NewDeviceCollParams = @{ RightProperties = 'InventoryNumber' Type = 'AllInLeft' } -$NewDeviceColl = Join-Object @NewDeviceCollParams | Sort-Object -Property SerialNumber +$NewDeviceColl = Join-Object @NewDeviceCollParams foreach ($NewDevice in $NewDeviceColl) { $NewDeviceParams = @{ Mac = $NewDevice.MacAddress FirmwareId = $FirmwareId - Name = '{0}-{1}' -f $DevicePrefix, $NewDevice.InventoryNumber + Name = '{0}{1}' -f $DevicePrefix, $NewDevice.InventoryNumber SerialNumber = $NewDevice.SerialNumber AssetId = $NewDevice.InventoryNumber } From 92e9bf7005f4b323653008aac44a0469a018c93e Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 5 Aug 2019 15:05:33 +0200 Subject: [PATCH 042/145] Update ImportDevices.ps1 --- Scripts/ImportDevices.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Scripts/ImportDevices.ps1 b/Scripts/ImportDevices.ps1 index 986a3db..e0779be 100644 --- a/Scripts/ImportDevices.ps1 +++ b/Scripts/ImportDevices.ps1 @@ -1,12 +1,9 @@ -$UMSCredPath = 'C:\Credentials\UmsRmdb.cred' - $PSDefaultParameterValues = @{ - 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath '*-UMS*:Computername' = 'igelrmserver' - #'*-UMS*:SecurityProtocol' = 'Tls' + 'New-UMSAPICookie:Credential' = (Get-Credential) } $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = (New-UMSAPICookie) + '*-UMS*:WebSession' = New-UMSAPICookie } $Path = 'C:\Temp\' From 1d07de692cb140d38b213058838fee7a86e55763 Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 12 Aug 2019 12:47:17 +0200 Subject: [PATCH 043/145] Update Update-UMSDevice.Tests.ps1 removed 1 digit from SerialNumber --- Tests/Update-UMSDevice.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index ca62f3f..f40f9e5 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -78,7 +78,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Comment = 'NewComment' AssetId = 'NewAssetId' InserviceDate = 'NewInserviceDate' - SerialNumber = '0123456789012345678' + SerialNumber = '012345678901234567' } $Result = Update-UMSDevice @Params From 41128efd573f3449494bce8e9a2ccf031a9f3efb Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 12 Aug 2019 13:28:13 +0200 Subject: [PATCH 044/145] Removed Clear-Variable Block --- Tests/Get-UMSDevice.Tests.ps1 | 14 ------------ Tests/Get-UMSDeviceAssignment.Tests.ps1 | 14 ------------ Tests/Get-UMSDeviceDirectory.Tests.ps1 | 14 ------------ ...Get-UMSDeviceDirectoryAssignment.Tests.ps1 | 14 ------------ Tests/Get-UMSFirmware.Tests.ps1 | 14 ------------ Tests/Get-UMSProfile.Tests.ps1 | 14 ------------ Tests/Get-UMSProfileAssignment.Tests.ps1 | 14 ------------ Tests/Get-UMSProfileDirectory.Tests.ps1 | 14 ------------ Tests/Get-UMSStatus.Tests.ps1 | 14 ------------ .../Invoke-UMSRestMethodWebSession.Tests.ps1 | 7 ------ Tests/Move-UMSDevice.Tests.ps1 | 14 ------------ Tests/Move-UMSDeviceDirectory.Tests.ps1 | 14 ------------ Tests/Move-UMSProfile.Tests.ps1 | 14 ------------ Tests/Move-UMSProfileDirectory.Tests.ps1 | 14 ------------ Tests/New-UMSAPICookie.Tests.ps1 | 14 ------------ Tests/New-UMSDevice.Tests.ps1 | 22 ++++--------------- Tests/New-UMSDeviceDirectory.Tests.ps1 | 14 ------------ Tests/New-UMSFunctionString.Tests.ps1 | 7 ------ Tests/New-UMSProfileAssignment.Tests.ps1 | 14 ------------ Tests/New-UMSProfileDirectory.Tests.ps1 | 14 ------------ Tests/Pester.ps1 | 2 +- Tests/Remove-UMSDevice.Tests.ps1 | 14 ------------ Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 14 ------------ Tests/Remove-UMSProfile.Tests.ps1 | 14 ------------ Tests/Remove-UMSProfileAssignment.Tests.ps1 | 14 ------------ Tests/Remove-UMSProfileDirectory.Tests.ps1 | 14 ------------ Tests/Reset-UMSDevice.Tests.ps1 | 14 ------------ Tests/Restart-UMSDevice.Tests.ps1 | 14 ------------ Tests/Send-UMSDeviceSetting.Tests.ps1 | 14 ------------ Tests/Start-UMSDevice.Tests.ps1 | 14 ------------ Tests/Stop-UMSDevice.Tests.ps1 | 14 ------------ Tests/UMS.json | 4 ++-- Tests/Update-UMSDevice.Tests.ps1 | 14 ------------ Tests/Update-UMSDeviceDirectory.Tests.ps1 | 14 ------------ Tests/Update-UMSProfile.Tests.ps1 | 14 ------------ Tests/Update-UMSProfileDirectory.Tests.ps1 | 14 ------------ 36 files changed, 7 insertions(+), 469 deletions(-) diff --git a/Tests/Get-UMSDevice.Tests.ps1 b/Tests/Get-UMSDevice.Tests.ps1 index 60713cc..1a71f78 100644 --- a/Tests/Get-UMSDevice.Tests.ps1 +++ b/Tests/Get-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -455,13 +448,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSDeviceAssignment.Tests.ps1 b/Tests/Get-UMSDeviceAssignment.Tests.ps1 index 7cefa2f..4c2d5a0 100644 --- a/Tests/Get-UMSDeviceAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceAssignment.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -120,13 +113,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSDeviceDirectory.Tests.ps1 b/Tests/Get-UMSDeviceDirectory.Tests.ps1 index ae3cf69..d4f22c4 100644 --- a/Tests/Get-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -210,13 +203,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 index 1917750..65d602b 100644 --- a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -120,13 +113,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index e2d06d0..a63169e 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -150,13 +143,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSProfile.Tests.ps1 b/Tests/Get-UMSProfile.Tests.ps1 index ddfdecc..2a51029 100644 --- a/Tests/Get-UMSProfile.Tests.ps1 +++ b/Tests/Get-UMSProfile.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -164,13 +157,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSProfileAssignment.Tests.ps1 b/Tests/Get-UMSProfileAssignment.Tests.ps1 index ea8d613..8d38d29 100644 --- a/Tests/Get-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Get-UMSProfileAssignment.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -165,13 +158,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSProfileDirectory.Tests.ps1 b/Tests/Get-UMSProfileDirectory.Tests.ps1 index 5a99fd1..387ed5a 100644 --- a/Tests/Get-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Get-UMSProfileDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -210,13 +203,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index 6bf0b11..6f5565d 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -108,13 +101,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 index c7e9932..c832d9b 100644 --- a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 +++ b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { diff --git a/Tests/Move-UMSDevice.Tests.ps1 b/Tests/Move-UMSDevice.Tests.ps1 index 7385504..02e4cea 100644 --- a/Tests/Move-UMSDevice.Tests.ps1 +++ b/Tests/Move-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -124,13 +117,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index e4ccf14..dee6c2c 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -124,13 +117,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Move-UMSProfile.Tests.ps1 b/Tests/Move-UMSProfile.Tests.ps1 index 1eddb32..62b4740 100644 --- a/Tests/Move-UMSProfile.Tests.ps1 +++ b/Tests/Move-UMSProfile.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -123,13 +116,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index bfc3625..601d2a7 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -123,13 +116,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index be0dfb9..ff75238 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -115,13 +108,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $CredPath = $UMS.CredPath diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index 1034d19..13a1320 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -126,20 +119,13 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath - $Name = $UMS.UMSDevice[2].NameNew - $Mac = $UMS.UMSDevice[2].MacNew - $FirmwareId = $UMS.UMSDevice[2].FirmwareIdNew - $ParentId = $UMS.UMSDevice[2].ParentId + $Name = $UMS.UMSDevice[3].NameNew + $Mac = $UMS.UMSDevice[3].MacNew + $FirmwareId = $UMS.UMSDevice[3].FirmwareIdNew + $ParentId = $UMS.UMSDevice[3].ParentId $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index c010879..6040bf0 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -124,13 +117,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/New-UMSFunctionString.Tests.ps1 b/Tests/New-UMSFunctionString.Tests.ps1 index 755be5e..4d14854 100644 --- a/Tests/New-UMSFunctionString.Tests.ps1 +++ b/Tests/New-UMSFunctionString.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 531dfab..9c09c44 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -180,13 +173,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index 5dd5caf..94744f0 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -123,13 +116,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 9a6f09f..438e9fb 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -22,7 +22,7 @@ $PSDefaultParameterValues = @{ '*-UMS*:TCPPort' = [Int]$UMS.TCPPort '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol '*-UMS*:Confirm' = $false - 'Invoke-Pester:Show' = 'Failed' + #'Invoke-Pester:Show' = 'Failed' } <# diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index c4838f5..82b9325 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -176,13 +169,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 2fa864a..dc347c5 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -126,13 +119,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index ec8fb8b..7be1b9a 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -126,13 +119,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index c50b6bf..ae3b608 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -176,13 +169,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 6bbf3f1..0d22b13 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -126,13 +119,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Reset-UMSDevice.Tests.ps1 b/Tests/Reset-UMSDevice.Tests.ps1 index 3c0d487..5721617 100644 --- a/Tests/Reset-UMSDevice.Tests.ps1 +++ b/Tests/Reset-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Restart-UMSDevice.Tests.ps1 b/Tests/Restart-UMSDevice.Tests.ps1 index 7b525aa..db546c6 100644 --- a/Tests/Restart-UMSDevice.Tests.ps1 +++ b/Tests/Restart-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Send-UMSDeviceSetting.Tests.ps1 b/Tests/Send-UMSDeviceSetting.Tests.ps1 index 08966cd..f9ac986 100644 --- a/Tests/Send-UMSDeviceSetting.Tests.ps1 +++ b/Tests/Send-UMSDeviceSetting.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Start-UMSDevice.Tests.ps1 b/Tests/Start-UMSDevice.Tests.ps1 index 9e4314f..ddde707 100644 --- a/Tests/Start-UMSDevice.Tests.ps1 +++ b/Tests/Start-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Stop-UMSDevice.Tests.ps1 b/Tests/Stop-UMSDevice.Tests.ps1 index 7b4b901..04f39fe 100644 --- a/Tests/Stop-UMSDevice.Tests.ps1 +++ b/Tests/Stop-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/UMS.json b/Tests/UMS.json index 3dce312..7cc607c 100644 --- a/Tests/UMS.json +++ b/Tests/UMS.json @@ -19,8 +19,8 @@ "Get-UMSDevice", "Get-UMSDeviceAssignment", "Get-UMSDeviceDirectory", - "Get-UMSDirectoryRecursive", "Get-UMSDeviceDirectoryAssignment", + "Get-UMSDirectoryRecursive", "Start-UMSDevice", "Send-UMSDeviceSetting", "Restart-UMSDevice", @@ -210,7 +210,7 @@ }, { "Id": "1827", - "Name": "P_TCDir01_01", + "NameNew": "P_TCDir01_01", "ParentId": "457" }, { diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index f40f9e5..e2ae908 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -152,13 +145,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index db5ab2a..78b0edd 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Update-UMSProfile.Tests.ps1 b/Tests/Update-UMSProfile.Tests.ps1 index 4655693..01d4b19 100644 --- a/Tests/Update-UMSProfile.Tests.ps1 +++ b/Tests/Update-UMSProfile.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath diff --git a/Tests/Update-UMSProfileDirectory.Tests.ps1 b/Tests/Update-UMSProfileDirectory.Tests.ps1 index 89a502c..d3015ec 100644 --- a/Tests/Update-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Update-UMSProfileDirectory.Tests.ps1 @@ -7,13 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -134,13 +127,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath From 7dc1589e8dee14016e511fe1b150b656cc8c8b9c Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 12 Aug 2019 13:28:29 +0200 Subject: [PATCH 045/145] Update Get-UMSDirectoryRecursive.Tests.ps1 --- Tests/Get-UMSDirectoryRecursive.Tests.ps1 | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 index 5019afc..3789b76 100644 --- a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 +++ b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 @@ -59,7 +59,6 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } - #<# Context "Mock Get-UMSDirectoryRecursive" { $Script:Result = '' @@ -157,7 +156,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It 'Result.Id should mot contain 8888' { $Result.Id | Should Not Contain 8888 } - + It 'Result[0].Id should be exactly 99' { $Result[0].Id | Should Be 99 } @@ -166,9 +165,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { $Result[0].Id | Should -HaveType [Int] } } - #> - #<# Context "ParameterSetName Element" { $Script:Result = '' @@ -275,9 +272,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { $Result[0].Id | Should -HaveType [Int] } } - #> - #<# Context "Error Handling" { $Script:Result = '' @@ -293,19 +288,11 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { $Script:Result | Should BeNullOrEmpty } } - #> } } <# -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - BeforeAll { - if ($null -ne $Result) - { - Clear-Variable -Name $Result - } - } - +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath From 9e93c87af3c033e1efaf725c87d86527ec319736 Mon Sep 17 00:00:00 2001 From: Falk Date: Mon, 12 Aug 2019 16:39:01 +0200 Subject: [PATCH 046/145] Update Get-UMSDirectoryRecursive.Tests.ps1 --- Tests/Get-UMSDirectoryRecursive.Tests.ps1 | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 index 3789b76..6a9c672 100644 --- a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 +++ b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 @@ -291,32 +291,32 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -<# -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +#<# +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDirectoryRecursive[0].Id + $Credential = Import-Clixml -Path $UMS.CredPath + $Id = $UMS.UMSDirectoryRecursive[0].Id $Name = $UMS.UMSDirectoryRecursive[0].Name - + $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential '*-UMS*:Computername' = $UMS.Computername '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol '*-UMS*:Id' = $Id } - + $WebSession = New-UMSAPICookie -Credential $Credential $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - + Context "ParameterSetName All" { - + It "doesn't throw" { - { $Script:Result = Get-UMSDirectoryRecursive } | Should Not Throw + { $Script:Result = Get-UMSDirectoryRecursive - } | Should Not Throw } - + It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } @@ -324,11 +324,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { It 'Result.Id should have type [Int]' { $Result.Id | Should -HaveType [Int] } - + It "Result.Id should be exactly $Id" { $Result.Id | Should -BeExactly $Id } - + It 'Result.Name should have type [String]' { $Result.Name | Should -HaveType [String] } From 3cfd780d5d0d4e1ee7ba333399321fb0308c7f0e Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 2 Feb 2020 15:28:30 +0100 Subject: [PATCH 047/145] expanding tests --- .vscode/settings.json | 3 +- Docs/IntTestAfter.wsd | 250 +++++++++++++++++++++++++++++++++++++++++ Docs/IntTestBefore.wsd | 205 +++++++++++++++++++++++++++++++++ Docs/Untitled-1.wsd | 249 ++++++++++++++++++++++++++++++++++++++++ Tests/PSIGEL.Tests.ps1 | 24 ++-- Tests/Pester.ps1 | 8 +- 6 files changed, 722 insertions(+), 17 deletions(-) create mode 100644 Docs/IntTestAfter.wsd create mode 100644 Docs/IntTestBefore.wsd create mode 100644 Docs/Untitled-1.wsd diff --git a/.vscode/settings.json b/.vscode/settings.json index e706ec6..d699d89 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,6 @@ "igel", "igelos", "psigel" - ] + ], + "favorites.sortDirection": "ASC" } \ No newline at end of file diff --git a/Docs/IntTestAfter.wsd b/Docs/IntTestAfter.wsd new file mode 100644 index 0000000..e2349c6 --- /dev/null +++ b/Docs/IntTestAfter.wsd @@ -0,0 +1,250 @@ +@startuml before +allow_mixing + +skinparam sequence { + ArrowColor DarkRed +} + +actor PSIGEL + +frame Profiles as PRO #LightGrey { + + package PRO_PI as "PSIGEL" #SlateGrey { + + package PRO_PI_Session as "Sessions" #LightGrey { + + folder PRO_PI_Session_RDP as "RDP" #SlateGrey { + node [PRO_RDP_Session01] + } + } + + package PRO_PI_Accessories as "Accessories" #LightGrey { + + folder PRO_PI_Accessories_Terminal as "Terminal" #SlateGrey { + node [PRO_Terminal_LocalTerminal] + } + } + + package PRO_PI_UserInterface as "User Interface" #LightGrey { + + folder PRO_PI_UserInterface_Language as "Language" #SlateGrey { + node [PRO_LNG_DE] + + } + + } + + package PRO_PI_Network as "Network" #LightGrey { + + folder PRO_PI_Network_LANInterfaces as "LAN Interfaces" #SlateGrey { + node [PRO_NW_LAN] + node [PRO_NW_WLAN] + } + + } + + package PRO_PI_Devices as "Devices" #LightGrey { + + folder PRO_PI_Devices_StorageDevices as "Storage Devices" #SlateGrey { + node [PRO_USB_G] + } + + } + + package PRO_PI_Security as "Security" #LightGrey { + + folder PRO_PI_Security_Password as "Password" #SlateGrey { + node [PRO_PW_Root] + } + } + + package PRO_PI_System as "System" #LightGrey { + + folder PRO_PI_System_TimeAndDate as "Time and Date" #SlateGrey { + node [PRO_TZ_CET] + } + + } + + } + + PRO_RDP_Session01 -down. PRO_Terminal_LocalTerminal + PRO_Terminal_LocalTerminal -down. PRO_LNG_DE + PRO_LNG_DE -down. PRO_NW_LAN + PRO_NW_LAN -down. PRO_NW_WLAN + PRO_NW_WLAN -down. PRO_USB_G + PRO_USB_G -down. PRO_PW_Root + PRO_PW_Root -down. PRO_TZ_CET + +} + +frame Devices as DEV #LightGrey { + + package DEV_PI as "PSIGEL" #SlateGrey { + + package DEV_PI_BR as "Bremen" #LightGrey { + + package DEV_PI_BR_HR as "HR" #SlateGrey { + + object 0A0000000001 { + id = + name = DEV_PI_B_HR_001 + mac = 0A0000000001 + } + + object 0A0000000002 { + id = + name = DEV_PI_B_HR_002 + mac = 0A0000000002 + } + + } + + package DEV_PI_BR_MKT as "Marketing" #SlateGrey { + + object 0A0000000003 { + id = + name = DEV_PI_BR_MKT_001 + mac = 0A0000000003 + } + + object 0A0000000004 { + id = + name = DEV_PI_BR_MKT_002 + mac = 0A0000000004 + } + + } + + package DEV_PI_BR_DEV as "DEV" #Yellow { + + object 0A0000000010 #Yellow { + id = + name = DEV_PI_BR_DEV_001 + mac = 0A0000000010 + } + + } + + } + + package DEV_PI_A as "Augsburg" #LightGrey { + + package DEV_PI_A_DEV as "DEV" #SlateGrey { + + object 0A0000000005 { + id = + name = DEV_PI_A_DEV_001 + mac = 0A0000000005 + } + + object 0A0000000006 { + id = + name = DEV_PI_A_DEV_002 + mac = 0A0000000006 + } + + object 0A0000000009 #Yellow { + id = + name = DEV_PI_L_DEV_001 + mac = 0A0000000009 + } + + } + + package DEV_PI_A_QA as "QandA" #Green { + + object 0A0000000007 #Green { + id = + name = DEV_PI_A_QA_001 + mac = 0A0000000007 + } + + object 0A0000000008 #Green { + id = + name = DEV_PI_A_QA_002 + mac = 0A0000000008 + } + + } + + } + + package DEV_PI_L as "Leipzig" #LightGrey { + + package DEV_PI_L_DIS as "Distribution" #Red { + + object 0A0000000011 #Red { + id = + name = DEV_PI_L_DIS_001 + mac = 0A0000000011 + } + + object 0A0000000012 #Red { + id = + name = DEV_PI_L_DIS_002 + mac = 0A0000000012 + } + + } + + } + } + + 0A0000000001 -down. 0A0000000002 + 0A0000000002 -down. 0A0000000003 + 0A0000000003 -down. 0A0000000004 + 0A0000000004 -down. 0A0000000010 + 0A0000000010 -down. 0A0000000005 + 0A0000000005 -down. 0A0000000006 + 0A0000000006 -down. 0A0000000009 + 0A0000000009 -down. 0A0000000007 + 0A0000000007 -down. 0A0000000008 + 0A0000000008 -down. 0A0000000011 + 0A0000000011 -down. 0A0000000012 + +} + +PSIGEL -right. PRO +PSIGEL -right. DEV +PRO -right. DEV + +PRO_RDP_Session01 -right-+ DEV_PI +PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV +PRO_Terminal_LocalTerminal -right-+ DEV_PI_BR_DEV +PRO_LNG_DE -right-+ DEV_PI +PRO_NW_LAN -right-+ DEV_PI_BR +PRO_NW_WLAN -right-+ DEV_PI_A +PRO_NW_WLAN -right-+ DEV_PI_BR_DEV +PRO_USB_G -right-+ DEV_PI_A_DEV +'PRO_USB_G -right-+ 0A0000000011 +PRO_PI_Security_Password -right-+ DEV_PI +PRO_TZ_CET -right-+ DEV_PI + +'New +PSIGEL -right-> DEV_PI_A_QA : 01 - New-UMSDeviceDirectory +PSIGEL -right-> 0A0000000007 : 01 - New-UMSDevice +PSIGEL -right-> 0A0000000008 : 01 - New-UMSDevice + +'Remove +PSIGEL -right-> 0A0000000011 : 01 - Remove-UMSDevice +PSIGEL -right-> 0A0000000012 : 02 - Remove-UMSDevice +PSIGEL -right-> DEV_PI_L_DIS : 03 - Remove-UMSDeviceDirectory + +'Move +PSIGEL -right-> 0A0000000009 : 04 - Move-UMSDevice + +'Update +PSIGEL -right-> DEV_PI_BR_DEV : 05 - Update-UMSDeviceDirectory +PSIGEL -right-> 0A0000000010 : 05 - Update-UMSDevice +PSIGEL -right-> 0A0000000009 : 05 - Update-UMSDevice + +'Get +PSIGEL -right-> DEV : 01 - Get-UMSDevice +PSIGEL -right-> 0A0000000001 : 02 - Get-UMSDevice +PSIGEL -right-> 0A0000000007 : 02 - Get-UMSDevice +PSIGEL -right-> DEV : 03 - Get-UMSDeviceDirectory +PSIGEL -right-> DEV_PI_BR_HR : 04 - Get-UMSDeviceDirectory +PSIGEL -right-> DEV_PI_A_QA : 04 - Get-UMSDeviceDirectory + +@enduml \ No newline at end of file diff --git a/Docs/IntTestBefore.wsd b/Docs/IntTestBefore.wsd new file mode 100644 index 0000000..59ca206 --- /dev/null +++ b/Docs/IntTestBefore.wsd @@ -0,0 +1,205 @@ +@startuml before +allow_mixing + +skinparam sequence { + ArrowColor DarkRed +} + +frame Profiles as PRO #LightGrey { + + package PRO_PI as "PSIGEL" #SlateGrey { + + package PRO_PI_Session as "Sessions" #LightGrey { + + folder PRO_PI_Session_RDP as "RDP" #SlateGrey { + node [PRO_RDP_Session01] + } + } + + package PRO_PI_Accessories as "Accessories" #LightGrey { + + folder PRO_PI_Accessories_Terminal as "Terminal" #SlateGrey { + node [PRO_Terminal_LocalTerminal] + } + } + + package PRO_PI_UserInterface as "User Interface" #LightGrey { + + folder PRO_PI_UserInterface_Language as "Language" #SlateGrey { + node [PRO_LNG_DE] + + } + + } + + package PRO_PI_Network as "Network" #LightGrey { + + folder PRO_PI_Network_LANInterfaces as "LAN Interfaces" #SlateGrey { + node [PRO_NW_LAN] + node [PRO_NW_WLAN] + } + + } + + package PRO_PI_Devices as "Devices" #LightGrey { + + folder PRO_PI_Devices_StorageDevices as "Storage Devices" #SlateGrey { + node [PRO_USB_G] + } + + } + + package PRO_PI_Security as "Security" #LightGrey { + + folder PRO_PI_Security_Password as "Password" #SlateGrey { + node [PRO_PW_Root] + } + } + + package PRO_PI_System as "System" #LightGrey { + + folder PRO_PI_System_TimeAndDate as "Time and Date" #SlateGrey { + node [PRO_TZ_CET] + } + + } + + } + + PRO_RDP_Session01 -down. PRO_Terminal_LocalTerminal + PRO_Terminal_LocalTerminal -down. PRO_LNG_DE + PRO_LNG_DE -down. PRO_NW_LAN + PRO_NW_LAN -down. PRO_NW_WLAN + PRO_NW_WLAN -down. PRO_USB_G + PRO_USB_G -down. PRO_PW_Root + PRO_PW_Root -down. PRO_TZ_CET + +} + +frame Devices as DEV #LightGrey { + + package DEV_PI as "PSIGEL" #SlateGrey { + + package DEV_PI_BR as "Bremen" #LightGrey { + + package DEV_PI_BR_HR as "HR" #SlateGrey { + + object 0A0000000001 { + id = + name = DEV_PI_B_HR_001 + mac = 0A0000000001 + } + + object 0A0000000002 { + id = + name = DEV_PI_B_HR_002 + mac = 0A0000000002 + } + + } + + package DEV_PI_BR_MKT as "Marketing" #SlateGrey { + + object 0A0000000003 { + id = + name = DEV_PI_BR_MKT_001 + mac = 0A0000000003 + } + + object 0A0000000004 { + id = + name = DEV_PI_BR_MKT_002 + mac = 0A0000000004 + } + + } + + } + + package DEV_PI_A as "Augsburg" #LightGrey { + + package DEV_PI_A_DEV as "DEV" #SlateGrey { + + object 0A0000000005 { + id = + name = DEV_PI_A_DEV_001 + mac = 0A0000000005 + } + + object 0A0000000006 { + id = + name = DEV_PI_A_DEV_002 + mac = 0A0000000006 + } + + } + + } + + package DEV_PI_L as "Leipzig" #LightGrey { + + package DEV_PI_L_DEV as "DEV" #SlateGrey { + + object 0A0000000009 { + id = + name = DEV_PI_L_DEV_001 + mac = 0A0000000009 + } + + object 0A0000000010 { + id = + name = DEV_PI_L_DEV_002 + mac = 0A0000000010 + } + + } + + package DEV_PI_L_DIS as "Distribution" #SlateGrey { + + object 0A0000000011 { + id = + name = DEV_PI_L_DIS_001 + mac = 0A0000000011 + } + + object 0A0000000012 { + id = + name = DEV_PI_L_DIS_002 + mac = 0A0000000012 + } + + } + + } + } + + 0A0000000001 -down. 0A0000000002 + 0A0000000002 -down. 0A0000000003 + 0A0000000003 -down. 0A0000000004 + 0A0000000004 -down. 0A0000000005 + 0A0000000005 -down. 0A0000000006 + 0A0000000006 -down. 0A0000000009 + 0A0000000009 -down. 0A0000000010 + 0A0000000010 -down. 0A0000000011 + 0A0000000011 -down. 0A0000000012 + +} + + +PRO -right. DEV + +PRO_RDP_Session01 -right-+ DEV_PI +PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV +PRO_Terminal_LocalTerminal -right-+ DEV_PI_L_DEV +PRO_LNG_DE -right-+ DEV_PI +PRO_NW_LAN -right-+ DEV_PI_BR +PRO_NW_WLAN -right-+ DEV_PI_A +PRO_NW_WLAN -right-+ DEV_PI_L_DEV +PRO_USB_G -right-+ DEV_PI_A_DEV +PRO_USB_G -right-+ 0A0000000011 +PRO_PI_Security_Password -right-+ DEV_PI +PRO_TZ_CET -right-+ DEV_PI + + + +@enduml \ No newline at end of file diff --git a/Docs/Untitled-1.wsd b/Docs/Untitled-1.wsd new file mode 100644 index 0000000..cf50500 --- /dev/null +++ b/Docs/Untitled-1.wsd @@ -0,0 +1,249 @@ +@startuml before +allow_mixing + +frame Profiles as PRO { + + package PRO_PI as "PSIGEL" { + + package PRO_PI_Session as "Sessions" { + + folder PRO_PI_Session_RDP as "RDP" { + node [PRO_RDP_Session01] + } + } + + package PRO_PI_Accessories as "Accessories" { + } + + package PRO_PI_UserInterface as "User Interface" { + + folder PRO_PI_UserInterface_Language as "Language" { + node [PRO_LNG_DE] + node [PRO_LNG_US] + node [PRO_LNG_JP] + + } + + } + + package PRO_PI_Network as "Network" { + + package PRO_PI_Network_LANInterfaces as "LAN Interfaces" { + node [PRO_NW_LAN] + node [PRO_NW_WLAN] + } + + } + + package PRO_PI_Devices as "Devices" { + } + + package PRO_PI_Security as "Security" { + } + + package PRO_PI_System as "System" { + + package PRO_PI_System_TimeAndDate as "Time and Date" { + node [PRO_TZ_CET] + node [PRO_TZ_EST] + node [PRO_TZ_PST] + node [PRO_TZ_JST] + } + + } + + } + +} + +frame Devices as DEV { + + package DEV_PI as "PSIGEL" { + + package DEV_PI_BR as "Bremen" { + + package DEV_PI_BR_HR as "HR" { + + object 0A0000000001 { + id = + name = DEV_PI_B_HR_001 + mac = 0A0000000001 + } + + object 0A0000000002 { + id = + name = DEV_PI_B_HR_002 + mac = 0A0000000002 + } + + } + + package DEV_PI_BR_MKT as "Marketing" { + + object 0A0000000003 { + id = + name = DEV_PI_BR_MKT_001 + mac = 0A0000000003 + } + + object 0A0000000004 { + id = + name = DEV_PI_BR_MKT_002 + mac = 0A0000000004 + } + + } + + } + + package DEV_PI_A as "Augsburg" { + + package DEV_PI_A_DEV as "DEV" { + + object 0A0000000005 { + id = + name = DEV_PI_A_DEV_001 + mac = 0A0000000005 + } + + object 0A0000000006 { + id = + name = DEV_PI_A_DEV_002 + mac = 0A0000000006 + } + + } + + package DEV_PI_A_QA as "QandA" { + + object 0A0000000007 { + id = + name = DEV_PI_A_QA_001 + mac = 0A0000000007 + } + + object 0A0000000008 { + id = + name = DEV_PI_A_QA_002 + mac = 0A0000000008 + } + + } + + } + + package DEV_PI_L as "Leipzig" { + + package DEV_PI_L_DEV as "DEV" { + + object 0A0000000009 { + id = + name = DEV_PI_L_DEV_001 + mac = 0A0000000009 + } + + object 0A0000000010 { + id = + name = DEV_PI_L_DEV_002 + mac = 0A0000000010 + } + + } + + package DEV_PI_L_DIS as "Distribution" { + + object 0A0000000011 { + id = + name = DEV_PI_L_DIS_001 + mac = 0A0000000011 + } + + object 0A0000000012 { + id = + name = DEV_PI_L_DIS_002 + mac = 0A0000000012 + } + + } + + } + } + +} + +frame Function as FUN { + + package FUN_Get as "Get" { + node [Get-UMSDevice] as FUN_Get_UD + node [Get-UMSDeviceDirectory] as FUN_Get_UDD + node [Get-UMSProfile] as FUN_Get_UP + node [Get-UMSProfileDirectory] as FUN_Get_UPD + } + + package FUN_New as "New" { + node [New-UMSDevice] as FUN_New_UD + node [New-UMSDeviceDirectory] as FUN_New_UDD + node [New-UMSProfileDirectory] as FUN_New_UPD + } + + package FUN_Move as "Move" { + node [Move-UMSDevice] as FUN_Move_UD + node [Move-UMSDeviceDirectory] as FUN_Move_UDD + node [Move-UMSProfile] as FUN_Move_UP + node [Move-UMSProfileDirectory] as FUN_Move_UPD + } + + package FUN_Update as "Update" { + node [Update-UMSDevice] as FUN_Update_UD + node [Update-UMSDeviceDirectory] as FUN_Update_UDD + node [Update-UMSProfile] as FUN_Update_UP + node [Update-UMSProfileDirectory] as FUN_Update_UPD + } + + package FUN_Remove as "Remove" { + node [Remove-UMSDevice] as FUN_Remove_UD + node [Remove-UMSDeviceDirectory] as FUN_Remove_UDD + node [Remove-UMSProfile] as FUN_Remove_UP + node [Remove-UMSProfileDirectory] as FUN_Remove_UPD + } + +} + +FUN_Get_UD -down. FUN_Get_UDD +FUN_Get_UDD -down. FUN_Get_UP +FUN_Get_UP -down. FUN_Get_UPD +FUN_Get_UPD -down. FUN_New_UD +FUN_New_UD -down. FUN_New_UDD +FUN_New_UDD -down. FUN_New_UPD +FUN_New_UPD -down. FUN_Move_UD +FUN_Move_UD -down. FUN_Move_UDD +FUN_Move_UDD -down. FUN_Move_UP +FUN_Move_UP -down. FUN_Move_UPD +FUN_Move_UPD -down. FUN_Update_UD +FUN_Update_UD -down. FUN_Update_UDD +FUN_Update_UDD -down. FUN_Update_UP +FUN_Update_UP -down. FUN_Update_UPD +FUN_Update_UPD -down. FUN_Remove_UD +FUN_Remove_UD -down. FUN_Remove_UDD +FUN_Remove_UDD -down. FUN_Remove_UP +FUN_Remove_UP -down. FUN_Remove_UPD + +FUN_Remove_UD -down-|> 0A0000000011 : 1. +FUN_Remove_UD -down-|> 0A0000000012 +FUN_Remove_UDD -down-|> DEV_PI_L_DIS + +FUN_Move_UD -down-|> 0A0000000009 +0A0000000009 -right-> DEV_PI_A_DEV + +FUN_Move_UDD -down-|> DEV_PI_L_DEV +DEV_PI_L_DEV -right-> DEV_PI_BR +/' + +FUN_Move_UDD -down-|> +FUN_Remove_UP -down-|> +FUN_Move_UPD -down-|> +FUN_Remove_UP -down-|> PRO_RDP_Session01 +FUN_Remove_UPD -down-|> PRO_PI_Session_RDP +'/ + +@enduml \ No newline at end of file diff --git a/Tests/PSIGEL.Tests.ps1 b/Tests/PSIGEL.Tests.ps1 index d773258..c486d3e 100644 --- a/Tests/PSIGEL.Tests.ps1 +++ b/Tests/PSIGEL.Tests.ps1 @@ -27,7 +27,7 @@ Describe "General project validation: $ModuleName" { } It "Module '$ModuleName' can import cleanly" { - {Import-Module ( '{0}/{1}.psm1' -f $ModuleRoot, $ModuleName) } | Should Not Throw + { Import-Module ( '{0}/{1}.psm1' -f $ModuleRoot, $ModuleName) } | Should Not Throw } } @@ -66,7 +66,7 @@ Describe "General project validation: $ModuleName" { Context 'Public Functions' { $PublicFunctionColl = (Get-ChildItem -Path ('{0}\Public' -f $ModuleRoot) -Filter *.ps1 | - Select-Object -ExpandProperty Name ) -replace '\.ps1$' + Select-Object -ExpandProperty Name ) -replace '\.ps1$' $TestCase = $PublicFunctionColl | Foreach-Object { @{ @@ -85,23 +85,23 @@ Describe "General project validation: $ModuleName" { It 'Proper Number of Functions Exported compared to Manifest' { $ExportedCount = Get-Command -Module $ModuleName -CommandType Function | - Measure-Object | Select-Object -ExpandProperty Count + Measure-Object | Select-Object -ExpandProperty Count $ManifestCount = $Manifest.ExportedFunctions.Count $ExportedCount | Should be $ManifestCount } It 'Proper Number of Functions Exported compared to Files' { $ExportedCount = Get-Command -Module $ModuleName -CommandType Function | - Measure-Object | Select-Object -ExpandProperty Count + Measure-Object | Select-Object -ExpandProperty Count $FileCount = Get-ChildItem -Path ('{0}\Public' -f $ModuleRoot) -Filter *.ps1 | - Measure-Object | Select-Object -ExpandProperty Count + Measure-Object | Select-Object -ExpandProperty Count $ExportedCount | Should be $FileCount } } Context 'Private Functions' { $PrivateFunctionColl = (Get-ChildItem -Path ('{0}\Private' -f $ModuleRoot) -Filter *.ps1 | - Select-Object -ExpandProperty Name ) -replace '\.ps1$' + Select-Object -ExpandProperty Name ) -replace '\.ps1$' $TestCase = $PrivateFunctionColl | Foreach-Object { @{ FunctionName = $_ @@ -119,7 +119,7 @@ Describe "General project validation: $ModuleName" { Context 'Exported Aliases' { It 'Proper Number of Aliases Exported compared to Manifest' { $ExportedCount = Get-Command -Module $ModuleName -CommandType Alias | - Measure-Object | Select-Object -ExpandProperty Count + Measure-Object | Select-Object -ExpandProperty Count $ManifestCount = $Manifest.ExportedAliases.Count $ExportedCount | Should be $ManifestCount @@ -127,10 +127,10 @@ Describe "General project validation: $ModuleName" { It 'Proper Number of Aliases Exported compared to Files' { $AliasCount = Get-ChildItem -Path "$ModuleRoot\Public" -Filter *.ps1 | - Select-String "New-Alias" | Measure-Object | Select-Object -ExpandProperty Count + Select-String "New-Alias" | Measure-Object | Select-Object -ExpandProperty Count $ManifestCount = $Manifest.ExportedAliases.Count - $AliasCount | Should be $ManifestCount + $AliasCount | Should be $ManifestCount } } } @@ -144,9 +144,9 @@ Describe "$ModuleName ScriptAnalyzer" -Tag 'Compliance' { $ScriptAnalyzerErrorColl += Invoke-ScriptAnalyzer -Path "$ModuleRoot\Public" @PSScriptAnalyzerSettingColl $ScriptAnalyzerErrorColl += Invoke-ScriptAnalyzer -Path "$ModuleRoot\Private" @PSScriptAnalyzerSettingColl $PrivateFunctionColl = Get-ChildItem -Path "$ModuleRoot\Private" -Filter *.ps1 | - Select-Object -ExpandProperty Name + Select-Object -ExpandProperty Name $PublicFunctionColl = Get-ChildItem -Path "$ModuleRoot\Public" -Filter *.ps1 | - Select-Object -ExpandProperty Name + Select-Object -ExpandProperty Name $AllFunctionColl = ($PrivateFunctionColl + $PublicFunctionColl) | Sort-Object $FunctionWithErrorColl = $ScriptAnalyzerErrorColl.ScriptName | Sort-Object -Unique if ($ScriptAnalyzerErrorColl) @@ -161,7 +161,7 @@ Describe "$ModuleName ScriptAnalyzer" -Tag 'Compliance' { } } $FunctionWithoutErrorColl = Compare-Object -ReferenceObject $AllFunctionColl -DifferenceObject $FunctionWithErrorColl | - Select-Object -ExpandProperty InputObject + Select-Object -ExpandProperty InputObject Context 'ScriptAnalyzer Testing' { It "Function should not use on line " -TestCases $TestCase { param( diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 438e9fb..31434cd 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -3,8 +3,8 @@ param [ValidateSet('All', 'UnitTests', 'IntegrationTests')] [String] #$Tags = 'All' - #$Tags = 'UnitTests' - $Tags = 'IntegrationTests' + $Tags = 'UnitTests' + #$Tags = 'IntegrationTests' ) $ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) @@ -13,12 +13,12 @@ $OutputPath = '{0}\Tests\Data' -f $ProjectRoot $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $ProjectRoot) | - ConvertFrom-Json +ConvertFrom-Json $PSDefaultParameterValues = @{ '*:Computername' = $UMS.Computername - 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMS.Credpath + #'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMS.Credpath '*-UMS*:TCPPort' = [Int]$UMS.TCPPort '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol '*-UMS*:Confirm' = $false From ac7215fcfa0a80bd13c661a9fa03e0b4b55d8202 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 7 Feb 2020 16:19:46 +0100 Subject: [PATCH 048/145] . --- Docs/IntTestAfter.wsd | 189 +++++++++++++++++++++++++++-------------- Docs/IntTestBefore.wsd | 63 ++++---------- 2 files changed, 139 insertions(+), 113 deletions(-) diff --git a/Docs/IntTestAfter.wsd b/Docs/IntTestAfter.wsd index e2349c6..5d90deb 100644 --- a/Docs/IntTestAfter.wsd +++ b/Docs/IntTestAfter.wsd @@ -5,65 +5,36 @@ skinparam sequence { ArrowColor DarkRed } -actor PSIGEL - frame Profiles as PRO #LightGrey { package PRO_PI as "PSIGEL" #SlateGrey { package PRO_PI_Session as "Sessions" #LightGrey { - - folder PRO_PI_Session_RDP as "RDP" #SlateGrey { - node [PRO_RDP_Session01] - } + node [PRO_RDP_Session01] } package PRO_PI_Accessories as "Accessories" #LightGrey { - - folder PRO_PI_Accessories_Terminal as "Terminal" #SlateGrey { - node [PRO_Terminal_LocalTerminal] - } + node [PRO_Terminal_LocalTerminal] } - package PRO_PI_UserInterface as "User Interface" #LightGrey { - - folder PRO_PI_UserInterface_Language as "Language" #SlateGrey { - node [PRO_LNG_DE] - - } - + package PRO_PI_UserInterface as "User Interface" #Yellow { + node [PRO_LNG_DE] #Yellow } package PRO_PI_Network as "Network" #LightGrey { - - folder PRO_PI_Network_LANInterfaces as "LAN Interfaces" #SlateGrey { - node [PRO_NW_LAN] - node [PRO_NW_WLAN] - } - + node [PRO_NW_LAN] + node [PRO_NW_WLAN] } - package PRO_PI_Devices as "Devices" #LightGrey { - - folder PRO_PI_Devices_StorageDevices as "Storage Devices" #SlateGrey { - node [PRO_USB_G] - } - + package PRO_PI_Devices as "Devices" #Green { } package PRO_PI_Security as "Security" #LightGrey { - - folder PRO_PI_Security_Password as "Password" #SlateGrey { - node [PRO_PW_Root] - } + node [PRO_PW_Root] } - package PRO_PI_System as "System" #LightGrey { - - folder PRO_PI_System_TimeAndDate as "Time and Date" #SlateGrey { - node [PRO_TZ_CET] - } - + package PRO_PI_System as "System" #Red { + node [PRO_TZ_CET] #Red } } @@ -72,9 +43,9 @@ frame Profiles as PRO #LightGrey { PRO_Terminal_LocalTerminal -down. PRO_LNG_DE PRO_LNG_DE -down. PRO_NW_LAN PRO_NW_LAN -down. PRO_NW_WLAN - PRO_NW_WLAN -down. PRO_USB_G - PRO_USB_G -down. PRO_PW_Root + PRO_NW_WLAN -down. PRO_PW_Root PRO_PW_Root -down. PRO_TZ_CET + PRO_PI_System -down. PRO_PI_Devices } @@ -205,46 +176,134 @@ frame Devices as DEV #LightGrey { } -PSIGEL -right. PRO -PSIGEL -right. DEV -PRO -right. DEV +frame Functions as FUN #LightGrey { + + package FUN_DEV as "Device" #SlateGrey { + + node [NewUMSDevice] + node [RemoveUMSDevice] + node [MoveUMSDevice] + node [UpdateUMSDevice] + node [GetUMSDevice] + + } + + package FUN_DEVDIR as "DeviceDir" #SlateGrey { + + node [NewUMSDeviceDirectory] + node [RemoveUMSDeviceDirectory] + node [MoveUMSDeviceDirectory] + node [UpdateUMSDeviceDirectory] + node [GetUMSDeviceDirectory] + + } + + package FUN_PRO as "Profile" #SlateGrey { + + node [RemoveUMSProfile] + node [MoveUMSProfile] + node [UpdateUMSProfile] + node [GetUMSProfile] + + } + + package FUN_PRODIR as "ProfileDir" #SlateGrey { + + node [NewUMSProfileDirectory] + node [RemoveUMSProfileDirectory] + node [MoveUMSProfileDirectory] + node [UpdateUMSProfileDirectory] + node [GetUMSProfileDirectory] + + } + + package FUN_PROASS as "ProfileAss" #SlateGrey { + + node [NewUMSProfileAssignment] + node [RemoveUMSProfileAssignment] + node [GetUMSUMSProfileAssignment] + node [GetUMSUMSDeviceAssignment] + node [GetUMSUMSDeviceDirectoryAssignment] + + } + + NewUMSDevice -down. RemoveUMSDevice + RemoveUMSDevice -down. MoveUMSDevice + MoveUMSDevice -down. UpdateUMSDevice + UpdateUMSDevice -down. GetUMSDevice + GetUMSDevice -down. NewUMSDeviceDirectory + NewUMSDeviceDirectory -down. RemoveUMSDeviceDirectory + RemoveUMSDeviceDirectory -down. MoveUMSDeviceDirectory + MoveUMSDeviceDirectory -down. UpdateUMSDeviceDirectory + UpdateUMSDeviceDirectory -down. GetUMSDeviceDirectory + GetUMSDeviceDirectory -down. RemoveUMSProfile + RemoveUMSProfile -down. MoveUMSProfile + MoveUMSProfile -down. UpdateUMSProfile + UpdateUMSProfile -down. GetUMSProfile + GetUMSProfile -down. NewUMSProfileDirectory + NewUMSProfileDirectory -down. RemoveUMSProfileDirectory + RemoveUMSProfileDirectory -down. MoveUMSProfileDirectory + MoveUMSProfileDirectory -down. UpdateUMSProfileDirectory + UpdateUMSProfileDirectory -down. GetUMSProfileDirectory + GetUMSProfileDirectory -down. NewUMSProfileAssignment + NewUMSProfileAssignment -down. RemoveUMSProfileAssignment + RemoveUMSProfileAssignment -down. GetUMSUMSProfileAssignment + GetUMSUMSProfileAssignment -down. GetUMSUMSDeviceAssignment + GetUMSUMSDeviceAssignment -down. GetUMSUMSDeviceDirectoryAssignment + +} PRO_RDP_Session01 -right-+ DEV_PI PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV PRO_Terminal_LocalTerminal -right-+ DEV_PI_BR_DEV PRO_LNG_DE -right-+ DEV_PI PRO_NW_LAN -right-+ DEV_PI_BR -PRO_NW_WLAN -right-+ DEV_PI_A PRO_NW_WLAN -right-+ DEV_PI_BR_DEV -PRO_USB_G -right-+ DEV_PI_A_DEV -'PRO_USB_G -right-+ 0A0000000011 -PRO_PI_Security_Password -right-+ DEV_PI -PRO_TZ_CET -right-+ DEV_PI +PRO_PW_Root -right-+ DEV_PI 'New -PSIGEL -right-> DEV_PI_A_QA : 01 - New-UMSDeviceDirectory -PSIGEL -right-> 0A0000000007 : 01 - New-UMSDevice -PSIGEL -right-> 0A0000000008 : 01 - New-UMSDevice +NewUMSDeviceDirectory -right-> DEV_PI_A_QA : 01 - New-UMSDeviceDirectory +NewUMSDevice -right-> 0A0000000007 : 02 - New-UMSDevice +NewUMSDevice -right-> 0A0000000008 : 03 - New-UMSDevice +NewUMSProfileDirectory -right-> PRO_PI_Devices : 04 - New-UMSProfileDirectory +PRO_NW_WLAN -right-> NewUMSProfileAssignment : 05 - NewUMSProfileAssignment tc +NewUMSProfileAssignment -right-+ 0A0000000003 : 05 - NewUMSProfileAssignment tc +PRO_NW_WLAN -right-> NewUMSProfileAssignment : 06 - NewUMSProfileAssignment tcdir +NewUMSProfileAssignment -right-+ DEV_PI_BR_HR : 06 - NewUMSProfileAssignment tcdir 'Remove -PSIGEL -right-> 0A0000000011 : 01 - Remove-UMSDevice -PSIGEL -right-> 0A0000000012 : 02 - Remove-UMSDevice -PSIGEL -right-> DEV_PI_L_DIS : 03 - Remove-UMSDeviceDirectory +RemoveUMSDevice -right-> 0A0000000011 : 07 - Remove-UMSDevice +RemoveUMSDevice -right-> 0A0000000012 : 08 - Remove-UMSDevice +RemoveUMSDeviceDirectory -right-> DEV_PI_L_DIS : 09 - Remove-UMSDeviceDirectory +RemoveUMSProfile -right-> PRO_TZ_CET : 10 - Remove-UMSProfile +RemoveUMSProfileDirectory -right-> PRO_PI_System : 11 - Remove-UMSProfileDirectory +DEV_PI -right-> RemoveUMSProfileAssignment : 12 - Remove-UMSProfileAssignment tcdir +RemoveUMSProfileAssignment -right-> PRO_TZ_CET : 12 - Remove-UMSProfileAssignment tcdir +0A0000000001 -right-> RemoveUMSProfileAssignment : 13 - Remove-UMSProfileAssignment tc +RemoveUMSProfileAssignment -right-> PRO_PW_Root : 13 - Remove-UMSProfileAssignment tc 'Move -PSIGEL -right-> 0A0000000009 : 04 - Move-UMSDevice +MoveUMSDevice -right-> 0A0000000009 : 14 - Move-UMSDevice +MoveUMSDeviceDirectory -right-> DEV_PI_BR_DEV: 15 - Move-UMSDeviceDirectory DEV_PI_L_DEV +MoveUMSProfile -right-> PRO_LNG_DE : 16 - Move-UMSProfile +MoveUMSProfileDirectory -right-> PRO_PI_UserInterface : 17 - Move-UMSProfileDirectory 'Update -PSIGEL -right-> DEV_PI_BR_DEV : 05 - Update-UMSDeviceDirectory -PSIGEL -right-> 0A0000000010 : 05 - Update-UMSDevice -PSIGEL -right-> 0A0000000009 : 05 - Update-UMSDevice +UpdateUMSDeviceDirectory -right-> DEV_PI_BR_DEV : 18 - Update-UMSDeviceDirectory +UpdateUMSDevice -right-> 0A0000000010 : 19 - Update-UMSDevice +UpdateUMSDevice -right-> 0A0000000009 : 20 - Update-UMSDevice +UpdateUMSProfile -right-> PRO_LNG_DE : 21 - Update- UMSProfile PRO_NW_LNG_DE +UpdateUMSProfileDirectory -right-> PRO_PI_UserInterface : 22 - PRO_PI_Network_UserInterface 'Get -PSIGEL -right-> DEV : 01 - Get-UMSDevice -PSIGEL -right-> 0A0000000001 : 02 - Get-UMSDevice -PSIGEL -right-> 0A0000000007 : 02 - Get-UMSDevice -PSIGEL -right-> DEV : 03 - Get-UMSDeviceDirectory -PSIGEL -right-> DEV_PI_BR_HR : 04 - Get-UMSDeviceDirectory -PSIGEL -right-> DEV_PI_A_QA : 04 - Get-UMSDeviceDirectory +GetUMSDevice -right-> DEV : 23 - Get-UMSDevice +GetUMSDevice -right-> 0A0000000001 : 24 - Get-UMSDevice +GetUMSDeviceDirectory -right-> DEV : 25 - Get-UMSDeviceDirectory +GetUMSProfile -right-> PRO : 26 - GetUMSProfile +GetUMSProfileDirectory -right-> PRO : 27 - Get-UMSProfileDirectory +GetUMSUMSProfileAssignment -right-> PRO_RDP_Session01 : 28 - Get-UMSUMSProfileAssignment Device +GetUMSUMSProfileAssignment -right-> PRO_RDP_Session01 : 29 - Get-UMSUMSProfileAssignment Directory +GetUMSUMSDeviceAssignment -right-> 0A0000000001 : 30 - Get-UMSUMSDeviceAssignment +GetUMSUMSDeviceDirectoryAssignment -right-> DEV_PI_BR : 31 - Get-UMSUMSDeviceDirectoryAssignment @enduml \ No newline at end of file diff --git a/Docs/IntTestBefore.wsd b/Docs/IntTestBefore.wsd index 59ca206..4a7a487 100644 --- a/Docs/IntTestBefore.wsd +++ b/Docs/IntTestBefore.wsd @@ -10,68 +10,37 @@ frame Profiles as PRO #LightGrey { package PRO_PI as "PSIGEL" #SlateGrey { package PRO_PI_Session as "Sessions" #LightGrey { - - folder PRO_PI_Session_RDP as "RDP" #SlateGrey { - node [PRO_RDP_Session01] - } + node [PRO_RDP_Session01] } package PRO_PI_Accessories as "Accessories" #LightGrey { - - folder PRO_PI_Accessories_Terminal as "Terminal" #SlateGrey { - node [PRO_Terminal_LocalTerminal] - } - } - - package PRO_PI_UserInterface as "User Interface" #LightGrey { - - folder PRO_PI_UserInterface_Language as "Language" #SlateGrey { - node [PRO_LNG_DE] - - } - + node [PRO_Terminal_LocalTerminal] } package PRO_PI_Network as "Network" #LightGrey { - - folder PRO_PI_Network_LANInterfaces as "LAN Interfaces" #SlateGrey { - node [PRO_NW_LAN] - node [PRO_NW_WLAN] + package PRO_PI_Network_UserInterface as "Network User Interface" #SlateGrey { } - - } - - package PRO_PI_Devices as "Devices" #LightGrey { - - folder PRO_PI_Devices_StorageDevices as "Storage Devices" #SlateGrey { - node [PRO_USB_G] - } - + node [PRO_NW_LNG_DE] + node [PRO_NW_LAN] + node [PRO_NW_WLAN] } package PRO_PI_Security as "Security" #LightGrey { - - folder PRO_PI_Security_Password as "Password" #SlateGrey { - node [PRO_PW_Root] - } + node [PRO_PW_Root] } package PRO_PI_System as "System" #LightGrey { - - folder PRO_PI_System_TimeAndDate as "Time and Date" #SlateGrey { - node [PRO_TZ_CET] - } - + node [PRO_TZ_CET] } } PRO_RDP_Session01 -down. PRO_Terminal_LocalTerminal - PRO_Terminal_LocalTerminal -down. PRO_LNG_DE - PRO_LNG_DE -down. PRO_NW_LAN + PRO_Terminal_LocalTerminal -down. PRO_PI_Network_UserInterface + PRO_PI_Network_UserInterface -down. PRO_NW_LNG_DE + PRO_NW_LNG_DE -down. PRO_NW_LAN PRO_NW_LAN -down. PRO_NW_WLAN - PRO_NW_WLAN -down. PRO_USB_G - PRO_USB_G -down. PRO_PW_Root + PRO_NW_WLAN -down. PRO_PW_Root PRO_PW_Root -down. PRO_TZ_CET } @@ -191,13 +160,11 @@ PRO -right. DEV PRO_RDP_Session01 -right-+ DEV_PI PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV PRO_Terminal_LocalTerminal -right-+ DEV_PI_L_DEV -PRO_LNG_DE -right-+ DEV_PI +PRO_NW_LNG_DE -right-+ DEV_PI PRO_NW_LAN -right-+ DEV_PI_BR -PRO_NW_WLAN -right-+ DEV_PI_A +PRO_NW_WLAN -right-+ 0A0000000001 PRO_NW_WLAN -right-+ DEV_PI_L_DEV -PRO_USB_G -right-+ DEV_PI_A_DEV -PRO_USB_G -right-+ 0A0000000011 -PRO_PI_Security_Password -right-+ DEV_PI +PRO_PW_Root -right-+ DEV_PI PRO_TZ_CET -right-+ DEV_PI From b950e9cbc7286e83599691825ba47c8f9263d25a Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 9 Feb 2020 14:11:52 +0100 Subject: [PATCH 049/145] . --- Docs/IntTestAfter.wsd | 68 +++++++++------- Docs/IntTestBefore.wsd | 78 ++++++++++-------- Tests/IntegrationTestsConfig.psd1 | 126 ++++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+), 59 deletions(-) create mode 100644 Tests/IntegrationTestsConfig.psd1 diff --git a/Docs/IntTestAfter.wsd b/Docs/IntTestAfter.wsd index 5d90deb..7e59aa4 100644 --- a/Docs/IntTestAfter.wsd +++ b/Docs/IntTestAfter.wsd @@ -10,31 +10,45 @@ frame Profiles as PRO #LightGrey { package PRO_PI as "PSIGEL" #SlateGrey { package PRO_PI_Session as "Sessions" #LightGrey { - node [PRO_RDP_Session01] + object PRO_RDP_Session01 { + id = 529 + } } package PRO_PI_Accessories as "Accessories" #LightGrey { - node [PRO_Terminal_LocalTerminal] + object PRO_Terminal_LocalTerminal { + id = 532 + } } package PRO_PI_UserInterface as "User Interface" #Yellow { - node [PRO_LNG_DE] #Yellow + object PRO_LNG_DE #Yellow { + id = 535 + } } package PRO_PI_Network as "Network" #LightGrey { - node [PRO_NW_LAN] - node [PRO_NW_WLAN] + object PRO_NW_LAN { + id = 537 + } + object PRO_NW_WLAN { + id = 538 + } } package PRO_PI_Devices as "Devices" #Green { } package PRO_PI_Security as "Security" #LightGrey { - node [PRO_PW_Root] + object PRO_PW_Root { + id = 540 + } } package PRO_PI_System as "System" #Red { - node [PRO_TZ_CET] #Red + object PRO_TZ_CET #Red { + id = 542 + } } } @@ -58,14 +72,14 @@ frame Devices as DEV #LightGrey { package DEV_PI_BR_HR as "HR" #SlateGrey { object 0A0000000001 { - id = - name = DEV_PI_B_HR_001 + id = 505 + name = BR-HR-001 mac = 0A0000000001 } object 0A0000000002 { - id = - name = DEV_PI_B_HR_002 + id = 507 + name = BR-HR-002 mac = 0A0000000002 } @@ -74,20 +88,20 @@ frame Devices as DEV #LightGrey { package DEV_PI_BR_MKT as "Marketing" #SlateGrey { object 0A0000000003 { - id = - name = DEV_PI_BR_MKT_001 + id = 509 + name = BR-MKT-003 mac = 0A0000000003 } object 0A0000000004 { - id = - name = DEV_PI_BR_MKT_002 + id = 510 + name = BR-MKT-004 mac = 0A0000000004 } } - package DEV_PI_BR_DEV as "DEV" #Yellow { + package DEV_PI_BR_DEV as "Development" #Yellow { object 0A0000000010 #Yellow { id = @@ -101,23 +115,23 @@ frame Devices as DEV #LightGrey { package DEV_PI_A as "Augsburg" #LightGrey { - package DEV_PI_A_DEV as "DEV" #SlateGrey { + package DEV_PI_A_DEV as "Development" #SlateGrey { object 0A0000000005 { - id = - name = DEV_PI_A_DEV_001 + id = 512 + name = A-DEV-005 mac = 0A0000000005 } object 0A0000000006 { - id = - name = DEV_PI_A_DEV_002 + id = 513 + name = A-DEV-006 mac = 0A0000000006 } object 0A0000000009 #Yellow { - id = - name = DEV_PI_L_DEV_001 + id = 518 + name = A-DEV-009 mac = 0A0000000009 } @@ -146,14 +160,14 @@ frame Devices as DEV #LightGrey { package DEV_PI_L_DIS as "Distribution" #Red { object 0A0000000011 #Red { - id = - name = DEV_PI_L_DIS_001 + id = 521 + name = L-DIS-011 mac = 0A0000000011 } object 0A0000000012 #Red { - id = - name = DEV_PI_L_DIS_002 + id = 522 + name = L-DIS-012 mac = 0A0000000012 } diff --git a/Docs/IntTestBefore.wsd b/Docs/IntTestBefore.wsd index 4a7a487..c51ea56 100644 --- a/Docs/IntTestBefore.wsd +++ b/Docs/IntTestBefore.wsd @@ -10,35 +10,49 @@ frame Profiles as PRO #LightGrey { package PRO_PI as "PSIGEL" #SlateGrey { package PRO_PI_Session as "Sessions" #LightGrey { - node [PRO_RDP_Session01] + object PRO_RDP_Session01 { + id = 529 + } } package PRO_PI_Accessories as "Accessories" #LightGrey { - node [PRO_Terminal_LocalTerminal] + object PRO_Terminal_LocalTerminal { + id = 532 + } } package PRO_PI_Network as "Network" #LightGrey { package PRO_PI_Network_UserInterface as "Network User Interface" #SlateGrey { } - node [PRO_NW_LNG_DE] - node [PRO_NW_LAN] - node [PRO_NW_WLAN] + object PRO_LNG_DE { + id = 535 + } + object PRO_NW_LAN { + id = 537 + } + object PRO_NW_WLAN { + id = 538 + } } package PRO_PI_Security as "Security" #LightGrey { - node [PRO_PW_Root] + object PRO_PW_Root { + id = 540 + } } package PRO_PI_System as "System" #LightGrey { - node [PRO_TZ_CET] + object PRO_TZ_CET { + id = 542 + } } } PRO_RDP_Session01 -down. PRO_Terminal_LocalTerminal PRO_Terminal_LocalTerminal -down. PRO_PI_Network_UserInterface - PRO_PI_Network_UserInterface -down. PRO_NW_LNG_DE - PRO_NW_LNG_DE -down. PRO_NW_LAN + PRO_PI_Network_UserInterface -down. PRO_LNG_DE + PRO_LNG_DE -down. PRO_NW_LAN PRO_NW_LAN -down. PRO_NW_WLAN PRO_NW_WLAN -down. PRO_PW_Root PRO_PW_Root -down. PRO_TZ_CET @@ -54,14 +68,14 @@ frame Devices as DEV #LightGrey { package DEV_PI_BR_HR as "HR" #SlateGrey { object 0A0000000001 { - id = - name = DEV_PI_B_HR_001 + id = 505 + name = BR-HR-001 mac = 0A0000000001 } object 0A0000000002 { - id = - name = DEV_PI_B_HR_002 + id = 507 + name = BR-HR-002 mac = 0A0000000002 } @@ -70,14 +84,14 @@ frame Devices as DEV #LightGrey { package DEV_PI_BR_MKT as "Marketing" #SlateGrey { object 0A0000000003 { - id = - name = DEV_PI_BR_MKT_001 + id = 509 + name = BR-MKT-003 mac = 0A0000000003 } object 0A0000000004 { - id = - name = DEV_PI_BR_MKT_002 + id = 510 + name = BR-MKT-004 mac = 0A0000000004 } @@ -87,17 +101,17 @@ frame Devices as DEV #LightGrey { package DEV_PI_A as "Augsburg" #LightGrey { - package DEV_PI_A_DEV as "DEV" #SlateGrey { + package DEV_PI_A_DEV as "Development" #SlateGrey { object 0A0000000005 { - id = - name = DEV_PI_A_DEV_001 + id = 512 + name = A-DEV-005 mac = 0A0000000005 } object 0A0000000006 { - id = - name = DEV_PI_A_DEV_002 + id = 513 + name = A-DEV-006 mac = 0A0000000006 } @@ -107,17 +121,17 @@ frame Devices as DEV #LightGrey { package DEV_PI_L as "Leipzig" #LightGrey { - package DEV_PI_L_DEV as "DEV" #SlateGrey { + package DEV_PI_L_DEV as "Development" #SlateGrey { object 0A0000000009 { - id = - name = DEV_PI_L_DEV_001 + id = 518 + name = L-DEV-009 mac = 0A0000000009 } object 0A0000000010 { - id = - name = DEV_PI_L_DEV_002 + id = 519 + name = L-DEV-010 mac = 0A0000000010 } @@ -126,14 +140,14 @@ frame Devices as DEV #LightGrey { package DEV_PI_L_DIS as "Distribution" #SlateGrey { object 0A0000000011 { - id = - name = DEV_PI_L_DIS_001 + id = 521 + name = L-DIS-011 mac = 0A0000000011 } object 0A0000000012 { - id = - name = DEV_PI_L_DIS_002 + id = 522 + name = L-DIS-012 mac = 0A0000000012 } @@ -160,7 +174,7 @@ PRO -right. DEV PRO_RDP_Session01 -right-+ DEV_PI PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV PRO_Terminal_LocalTerminal -right-+ DEV_PI_L_DEV -PRO_NW_LNG_DE -right-+ DEV_PI +PRO_LNG_DE -right-+ DEV_PI PRO_NW_LAN -right-+ DEV_PI_BR PRO_NW_WLAN -right-+ 0A0000000001 PRO_NW_WLAN -right-+ DEV_PI_L_DEV diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 new file mode 100644 index 0000000..78be51a --- /dev/null +++ b/Tests/IntegrationTestsConfig.psd1 @@ -0,0 +1,126 @@ +<# +Integration Tests Config +#> + +@{ + + Computername = 'localhost' + TCPPort = 9443 + CredPath = 'C:\Credentials\UMSRmdb.cred' + SecurityProtocol = 'Tls12' + ProfileRootDirId = 527 # Profiles->PSIGEL + DeviceRootDirId = 502 # Devices -> PSIGEL + Tests = [ordered]@{ + 'GetUMSFirmware' = @{ + 1 = @{ + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' + } + 2 = @{ + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' + } + } + 'GetUMSProfile' = @{ + 529 = @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_RDP_Session01' + ParentId = 528 + MovedToBin = 'False' + ObjectType = 'profile' + } + 532 = @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_Terminal_LocalTerminal' + ParentId = 531 + MovedToBin = 'False' + ObjectType = 'profile' + } + 535 = @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_LNG_DE' + ParentId = 533 + MovedToBin = 'False' + ObjectType = 'profile' + } + 537 = @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_NW_LAN' + ParentId = 533 + MovedToBin = 'False' + ObjectType = 'profile' + } + 538 = @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_NW_WLAN' + ParentId = 533 + MovedToBin = 'False' + ObjectType = 'profile' + } + 540 = @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_PW_Root' + ParentId = 539 + MovedToBin = 'False' + ObjectType = 'profile' + } + 542 = @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Name = 'PRO_TZ_CET' + ParentId = 541 + MovedToBin = 'False' + ObjectType = 'profile' + } + } + <# + 3 = 'Get-UMSProfileDirectory' + 4 = 'Get-UMSProfileAssignment' + 5 = 'Get-UMSStatus' + 6 = 'Get-UMSDevice' + 7 = 'Get-UMSDeviceAssignment' + 8 = 'Get-UMSDeviceDirectory' + 9 = 'Get-UMSDeviceDirectoryAssignment' + 10 = 'Get-UMSDirectoryRecursive' + 11 = 'Start-UMSDevice' + 12 = 'Send-UMSDeviceSetting' + 13 = 'Restart-UMSDevice' + 14 = 'Stop-UMSDevice' + 15 = 'Update-UMSProfile' + 16 = 'Update-UMSProfileDirectory' + 17 = 'Update-UMSDevice' + 18 = 'Update-UMSDeviceDirectory' + 19 = 'Move-UMSProfile' + 20 = 'Move-UMSProfileDirectory' + 21 = 'Move-UMSDevice' + 22 = 'Move-UMSDeviceDirectory' + 23 = 'New-UMSProfileAssignment' + 24 = 'New-UMSProfileDirectory' + 25 = 'New-UMSDevice' + 26 = 'New-UMSDeviceDirectory' + 27 = 'Remove-UMSProfileAssignment' + 28 = 'Remove-UMSProfile' + 29 = 'Remove-UMSProfileDirectory' + 30 = 'Remove-UMSDevice' + 31 = 'Remove-UMSDeviceDirectory' + 32 = 'Reset-UMSDevice' + #> + } + + +} \ No newline at end of file From 2dad922827654977747778e065805dbf54f46ce4 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 9 Feb 2020 14:15:43 +0100 Subject: [PATCH 050/145] . --- Tests/IntegrationTestsConfig.psd1 | 35 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 78be51a..9d5bbbc 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -11,83 +11,92 @@ Integration Tests Config ProfileRootDirId = 527 # Profiles->PSIGEL DeviceRootDirId = 502 # Devices -> PSIGEL Tests = [ordered]@{ - 'GetUMSFirmware' = @{ - 1 = @{ + 'GetUMSFirmware' = @( + @{ + Id = 1 Product = 'IGEL OS 11' Version = '11.3.100.1' FirmwareType = 'LX' } - 2 = @{ + @{ + Id = 2 Product = 'IGEL OS 11' Version = '11.3.110.1' FirmwareType = 'LX' } - } - 'GetUMSProfile' = @{ - 529 = @{ + ) + 'GetUMSProfile' = @( + @{ FirmwareId = 1 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 529 Name = 'PRO_RDP_Session01' ParentId = 528 MovedToBin = 'False' ObjectType = 'profile' } - 532 = @{ + @{ FirmwareId = 1 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 532 Name = 'PRO_Terminal_LocalTerminal' ParentId = 531 MovedToBin = 'False' ObjectType = 'profile' } - 535 = @{ + @{ FirmwareId = 2 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 535 Name = 'PRO_LNG_DE' ParentId = 533 MovedToBin = 'False' ObjectType = 'profile' } - 537 = @{ + @{ FirmwareId = 2 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 537 Name = 'PRO_NW_LAN' ParentId = 533 MovedToBin = 'False' ObjectType = 'profile' } - 538 = @{ + @{ FirmwareId = 2 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 538 Name = 'PRO_NW_WLAN' ParentId = 533 MovedToBin = 'False' ObjectType = 'profile' } - 540 = @{ + @{ FirmwareId = 1 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 540 Name = 'PRO_PW_Root' ParentId = 539 MovedToBin = 'False' ObjectType = 'profile' } - 542 = @{ + @{ FirmwareId = 1 IsMasterProfile = 'False' OverridesSessions = 'False' + Id = 542 Name = 'PRO_TZ_CET' ParentId = 541 MovedToBin = 'False' ObjectType = 'profile' } - } + ) <# 3 = 'Get-UMSProfileDirectory' 4 = 'Get-UMSProfileAssignment' From cc51df6c20b857f144e949e16ef69cd52ebe5149 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 11 Feb 2020 16:13:41 +0100 Subject: [PATCH 051/145] . --- Docs/IntTestAfter.wsd | 9 +- Scripts/Test.ps1 | 19 + Tests/IntegrationTestsConfig.psd1 | 735 ++++++++++++++++++++++++++++-- 3 files changed, 725 insertions(+), 38 deletions(-) create mode 100644 Scripts/Test.ps1 diff --git a/Docs/IntTestAfter.wsd b/Docs/IntTestAfter.wsd index 7e59aa4..9f7eda9 100644 --- a/Docs/IntTestAfter.wsd +++ b/Docs/IntTestAfter.wsd @@ -88,13 +88,13 @@ frame Devices as DEV #LightGrey { package DEV_PI_BR_MKT as "Marketing" #SlateGrey { object 0A0000000003 { - id = 509 + id = 577 name = BR-MKT-003 mac = 0A0000000003 } object 0A0000000004 { - id = 510 + id = 576 name = BR-MKT-004 mac = 0A0000000004 } @@ -141,13 +141,13 @@ frame Devices as DEV #LightGrey { object 0A0000000007 #Green { id = - name = DEV_PI_A_QA_001 + name = A-QA-007 mac = 0A0000000007 } object 0A0000000008 #Green { id = - name = DEV_PI_A_QA_002 + name = A-QA-008 mac = 0A0000000008 } @@ -298,6 +298,7 @@ RemoveUMSProfileAssignment -right-> PRO_PW_Root : 13 - Remove-UMSProfileAssignme 'Move MoveUMSDevice -right-> 0A0000000009 : 14 - Move-UMSDevice +MoveUMSDeviceDirectory -right-> DEV_PI_A_QA: 15 - Move-UMSDeviceDirectory DEV_PI_A_QA MoveUMSDeviceDirectory -right-> DEV_PI_BR_DEV: 15 - Move-UMSDeviceDirectory DEV_PI_L_DEV MoveUMSProfile -right-> PRO_LNG_DE : 16 - Move-UMSProfile MoveUMSProfileDirectory -right-> PRO_PI_UserInterface : 17 - Move-UMSProfileDirectory diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 new file mode 100644 index 0000000..1759e3e --- /dev/null +++ b/Scripts/Test.ps1 @@ -0,0 +1,19 @@ +$UMSCredPath = 'C:\Credentials\UmsRmdb.cred' + +$PSDefaultParameterValues = @{ + 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath + '*-UMS*:Computername' = '192.168.56.1' + '*-UMS*:TCPPort' = 9443 + #'*-UMS*:SecurityProtocol' = 'Tls' +} +$PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = (New-UMSAPICookie) +} + +$Result = '' +$Result = (Get-UMSDeviceDirectory -Id 503 -Filter children).DirectoryChildren +$Result + +<# +$Result = New-UMSDeviceDirectory -Name 'QandA' # 01 +#> \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 9d5bbbc..104930c 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -11,7 +11,7 @@ Integration Tests Config ProfileRootDirId = 527 # Profiles->PSIGEL DeviceRootDirId = 502 # Devices -> PSIGEL Tests = [ordered]@{ - 'GetUMSFirmware' = @( + 'GetUMSFirmware' = @( @{ Id = 1 Product = 'IGEL OS 11' @@ -25,7 +25,7 @@ Integration Tests Config FirmwareType = 'LX' } ) - 'GetUMSProfile' = @( + 'GetUMSProfile' = @( @{ FirmwareId = 1 IsMasterProfile = 'False' @@ -97,38 +97,705 @@ Integration Tests Config ObjectType = 'profile' } ) - <# - 3 = 'Get-UMSProfileDirectory' - 4 = 'Get-UMSProfileAssignment' - 5 = 'Get-UMSStatus' - 6 = 'Get-UMSDevice' - 7 = 'Get-UMSDeviceAssignment' - 8 = 'Get-UMSDeviceDirectory' - 9 = 'Get-UMSDeviceDirectoryAssignment' - 10 = 'Get-UMSDirectoryRecursive' - 11 = 'Start-UMSDevice' - 12 = 'Send-UMSDeviceSetting' - 13 = 'Restart-UMSDevice' - 14 = 'Stop-UMSDevice' - 15 = 'Update-UMSProfile' - 16 = 'Update-UMSProfileDirectory' - 17 = 'Update-UMSDevice' - 18 = 'Update-UMSDeviceDirectory' - 19 = 'Move-UMSProfile' - 20 = 'Move-UMSProfileDirectory' - 21 = 'Move-UMSDevice' - 22 = 'Move-UMSDeviceDirectory' - 23 = 'New-UMSProfileAssignment' - 24 = 'New-UMSProfileDirectory' - 25 = 'New-UMSDevice' - 26 = 'New-UMSDeviceDirectory' - 27 = 'Remove-UMSProfileAssignment' - 28 = 'Remove-UMSProfile' - 29 = 'Remove-UMSProfileDirectory' - 30 = 'Remove-UMSDevice' - 31 = 'Remove-UMSDeviceDirectory' - 32 = 'Reset-UMSDevice' - #> + 'GetUMSProfileDirectory' = @( + @{ + Id = 528 + Name = 'Sessions' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 531 + Name = 'Accessories' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 533 + Name = 'Network' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 534 + Name = 'Network User Interface' + ParentId = 533 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 539 + Name = 'Security' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 541 + Name = 'System' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 52 + Name = 'PSIGEL' + ParentId = -2 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + ) + 'GetUMSProfileGetUMSProfileAssignment' = @( + @{ + Id = 538 + Type = 'profile' + ReceiverId = 505 + ReceiverType = 'tc' + AssignmentPosition = 0 + } + ) + 'GetUMSProfileGetUMSProfileAssignmentDirectory' = @( + @{ + Id = 529 + Type = 'profile' + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 532 + Type = 'profile' + ReceiverId = 514 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 532 + Type = 'profile' + ReceiverId = 517 + ReceiverType = 'tcdirectory' + AssignmentPosition = 1 + } + @{ + Id = 535 + Type = 'profile' + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 537 + Type = 'profile' + ReceiverId = 503 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 538 + Type = 'profile' + ReceiverId = 517 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 540 + Type = 'profile' + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 542 + Type = 'profile' + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + ) + 'GetUMSStatus' = @( + @{ + RmGuiServerVersion = 6.3.130 + BuildNumber = 44584 + ActiveMqVersion = 5.7.0 + DerbyVersion = 10.12.1.1 + ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' + Server = 'igelrmserver:8443' + } + ) + 'GetUMSDeviceId505Filterdetails' = @( + @{ + Id = 505 + ObjectType = 'tc' + UnitId = '0A0000000001' + Mac = '0A0000000001' + Name = 'BR-HR-001' + ParentId = 504 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + NetworkName = '' + Site = '' + Comment = '' + Department = '' + CostCenter = '' + AssetID = '' + InServiceDate = '' + SerialNumber = '' + ProductId = '' + CpuSpeed = 0 + CpuType = '' + DeviceType = '' + DeviceSerialNumber = '' + OsType = '' + FlashSize = 0 + MemorySize = 0 + NetworkSpeed = 0 + GraphicsChipset0 = '' + GraphicsChipset1 = '' + MonitorVendor1 = '' + MonitorModel1 = '' + MonitorSerialnumber1 = '' + MonitorSize1 = 0 + MonitorNativeResolution1 = '' + Monitor1YearOfManufacture = 0 + Monitor1WeekOfManufacture = 0 + MonitorVendor2 = '' + MonitorModel2 = '' + MonitorSerialnumber2 = '' + MonitorSize2 = 0 + MonitorNativeResolution2 = '' + Monitor2YearOfManufacture = 0 + Monitor2WeekOfManufacture = 0 + BiosVendor = '' + BiosVersion = '' + TotalUsagetime = -1 + TotalUptime = -1 + BatteryLevel = -1 + LastBootTime = '' + BiosDate = '' + } + ) + 'GetUMSDeviceId505Filteronline' = @( + @{ + Id = 505 + ObjectType = 'tc' + UnitId = '0A0000000001' + Mac = '0A0000000001' + Name = 'BR-HR-001' + ParentId = 504 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + Online = 'False' + } + ) + 'GetUMSDeviceAssignmentId505' = @( + @{ + Id = 505 + ReceiverId = 505 + ReceiverType = 'tc' + AssigneeId = 538 + AssigneeType = 'profile' + AssignmentPosition = 0 + } + @{ + Id = 505 + ReceiverId = 503 + ReceiverType = 'tcdirectory' + AssigneeId = 537 + AssigneeType = 'profile' + AssignmentPosition = 1 + } + @{ + Id = 505 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 542 + AssigneeType = 'profile' + AssignmentPosition = 2 + } + @{ + Id = 505 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 540 + AssigneeType = 'profile' + AssignmentPosition = 3 + } + @{ + Id = 505 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 529 + AssigneeType = 'profile' + AssignmentPosition = 4 + } + @{ + Id = 505 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 535 + AssigneeType = 'profile' + AssignmentPosition = 5 + } + ) + 'GetUMSDeviceDirectory' = @( + @{ + Id = 514 + Name = 'Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 516 + Name = 'Leipzig' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 517 + Name = 'Development' + ParentId = 516 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 502 + Name = 'PSIGEL' + ParentId = -1 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 503 + Name = 'Bremen' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 504 + Name = 'HR' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 520 + Name = 'Distribution' + ParentId = 516 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 508 + Name = 'Marketing' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 511 + Name = 'Augsburg' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + 'Get-UMSDeviceDirectoryId514' = @( + @{ + Id = 514 + Name = 'Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + 'GetUMSDeviceDirectoryAssignmentId514' = @( + @{ + Id = 514 + ReceiverId = 514 + ReceiverType = 'tcdirectory' + AssigneeId = 532 + AssigneeType = 'profile' + AssignmentPosition = 0 + } + @{ + Id = 514 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 535 + AssigneeType = 'profile' + AssignmentPosition = 1 + } + @{ + Id = 514 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 529 + AssigneeType = 'profile' + AssignmentPosition = 2 + } + @{ + Id = 514 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 540 + AssigneeType = 'profile' + AssignmentPosition = 3 + } + @{ + Id = 514 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 542 + AssigneeType = 'profile' + AssignmentPosition = 4 + } + ) + 'GetUMSDirectoryRecursiveId511DirectoryCollGetUMSDeviceDirectory' = @( + @{ + Id = 511 + Name = 'Augsburg' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 514 + Name = 'Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + 'GetUMSDirectoryRecursiveId511DirectoryCollGetUMSDeviceDirectoryElementCollGetUMSDevice' = @( + @{ + Id = 512 + ObjectType = 'tc' + UnitId = '0A0000000005' + Mac = '0A0000000005' + Name = 'A-DEV-005' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 513 + ObjectType = 'tc' + UnitId = '0A0000000006' + Mac = '0A0000000006' + Name = 'A-DEV-006' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + ) + 'NewUMSDeviceDirectoryNameQandA' = @( + @{ + Message = 'Directory successfully inserted.' + Id = 613 + Name = 'QandA' + } + ) + 'NewUMSDeviceMac0A0000000007NameA-QA-007FirmwareId1ParentId-1' = @( + @{ + Mac = '0A0000000007' + Message = 'Device successfully inserted.' + Id = 617 #dynamisch + Name = 'A-QA-007' + ParentId = -1 + } + ) + 'NewUMSDeviceMac0A0000000007NameA-QA-008FirmwareId1ParentId-1' = @( + @{ + Mac = '0A0000000008' + Message = 'Device successfully inserted.' + Id = 621 #dynamisch + Name = 'A-QA-008' + ParentId = -1 + } + ) + 'NewUMSProfileDirectoryNameDevices' = @( + @{ + Message = 'Directory successfully inserted.' + Id = 623 + Name = 'Devices' + } + ) + 'NewUMSProfileAssignmentId538ReceiverId577ReceiverTypetc' = @( + @{ + Message = '1 asssignments successfully assigned to device <{1}>.' + Id = 538 + ReceiverId = 577 + ReceiverType = 'tc' + } + ) + 'New-UMSProfileAssignment -Id 538 -ReceiverId 504 -ReceiverType tcdirectory' = @( + @{ + Message = '1 asssignments successfully assigned to device directory <{1}>.' + Id = 538 + ReceiverId = 504 + ReceiverType = 'tcdirectory' + } + ) + 'Remove-UMSDevice -Id 572 -Confirm:$false' = @( + @{ + Message = 'Offline deletion successful.' + Id = 572 + } + ) + '522 | Remove-UMSDevice -Confirm:$false' = @( + @{ + Message = 'Offline deletion successful' + Id = 572 + } + ) + 'Remove-UMSDeviceDirectory -Id 520 -Confirm:$false' = @( + @{ + Message = 'Deletion successful.' + Id = 520 + } + ) + 'Remove-UMSProfile -Id 542 -Confirm:$false' = @( + @{ + Message = 'Deleted profile.' + Id = 542 + } + ) + 'Remove-UMSProfileDirectory -Id 541 -Confirm:$false' = @( + @{ + Message = 'Deletion successful.' + Id = 541 + } + ) + 'Remove-UMSProfileAssignment -Id 538 -ReceiverId 505 -ReceiverType tc -Confirm:$false' = @( + @{ + Message = 'deleted profile assignment.' + Id = 538 + ReceiverId = 505 + ReceiverType = 'tc' + } + ) + 'Remove-UMSProfileAssignment -Id 540 -ReceiverId 502 -ReceiverType tcdirectory -Confirm:$false' = @( + @{ + Message = 'deleted profile assignment.' + Id = 540 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + } + ) + 'Move-UMSDeviceDirectory -Id 613 -DestId 511' = @( + @{ + Id = 613 + Message = 'successful.' + } + ) + 'Move-UMSDevice -Id 518 -DestId 514' = @( + @{ + Id = 518 + Message = 'successful.' + } + ) + '617, 621 | Move-UMSDevice -DestId 613' = @( + @{ + Id = 617 #dynamisch + Message = 'successful.' + } + @{ + Id = 621 # dynamisch + Message = 'successful.' + } + ) + '517 | Move-UMSDeviceDirectory -DestId 503' = @( + @{ + Id = 517 + Message = 'successful.' + } + ) + 'Move-UMSProfile -Id 535 -DestId 534' = @( + @{ + Id = 535 + Message = 'successful' + } + ) + 'Move-UMSProfileDirectory -Id 534 -DestId 527' = @( + @{ + Id = 535 + Message = 'successful' + } + ) + 'Update-UMSDeviceDirectory -Id 517 -Name "Distribution"' = @( + @{ + Message = 'Updated directory successfully.' + Id = 517 + } + ) + ' Update-UMSDevice -Id 578 -Name "BR-DIS-010"' = @( + @{ + Message = 'Update successful.' + Id = 578 + } + ) + 'Update-UMSDevice -Id 518 -Name "A-DEV-009"' = @( + @{ + Message = 'Update successful.' + Id = 518 + } + ) + #Origin rename to "PRO_NW_LNG_DE" + 'Update-UMSProfile -Id 535 -Name "PRO_LNG_DE"' = @( + @{ + Message = 'Update successful.' + Id = 535 + } + ) + 'Update-UMSProfileDirectory -Id 534 -Name "User Interface"' = @( + @{ + Message = 'Updated directory successfully.' + Id = 534 + } + ) + 'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' = @( + @{ + Id = 505 + ObjectType = 'tc' + UnitId = '0A0000000001' + Mac = '0A0000000001' + Name = 'BR-HR-001' + ParentId = 504 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 507 + ObjectType = 'tc' + UnitId = '0A0000000002' + Mac = '0A0000000002' + Name = 'BR-HR-002' + ParentId = 504 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + ) + '518 | Get-UMSDevice -Filter details' = @( + @{ + Id = 518 + ObjectType = 'tc' + UnitId = '0A0000000009' + Mac = '0A0000000009' + Name = 'A-DEV-009' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + NetworkName = '' + Site = '' + Comment = '' + Department = '' + CostCenter = '' + AssetID = '' + InServiceDate = '' + SerialNumber = '' + ProductId = '' + CpuSpeed = 0 + CpuType = '' + DeviceType = '' + DeviceSerialNumber = '' + OsType = '' + FlashSize = 0 + MemorySize = 0 + NetworkSpeed = 0 + GraphicsChipset0 = '' + GraphicsChipset1 = '' + MonitorVendor1 = '' + MonitorModel1 = '' + MonitorSerialnumber1 = '' + MonitorSize1 = 0 + MonitorNativeResolution1 = '' + Monitor1YearOfManufacture = 0 + Monitor1WeekOfManufacture = 0 + MonitorVendor2 = '' + MonitorModel2 = '' + MonitorSerialnumber2 = '' + MonitorSize2 = 0 + MonitorNativeResolution2 = '' + Monitor2YearOfManufacture = 0 + Monitor2WeekOfManufacture = 0 + BiosVendor = '' + BiosVersion = '' + TotalUsagetime = -1 + TotalUptime = -1 + BatteryLevel = -1 + LastBootTime = '' + BiosDate = '' + } + ) + 'Get-UMSDevice -Id 578 -Filter online' = @( + @{ + Id = 578 + ObjectType = tc + UnitId = '0A0000000010' + Mac = '0A0000000010' + Name = 'BR-DIS-010' + ParentId = 517 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + Online = 'False' + } + ) + '(Get-UMSDevice).Count' = @( + 10 + ) + 'Get-UMSDeviceDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2' = @( + @{ + Id = 613 + Name = 'QandA' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 517 + Name = 'Distribution' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + '517 | Get-UMSDeviceDirectory' = @( + @{ + Id = 517 + Name = 'Distribution' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + '(Get-UMSDeviceDirectory -Id 503 -Filter children).DirectoryChildren' = @( + @{ + ObjectType = 'tcdirectory' + Id = 504 + } + @{ + ObjectType = 'tcdirectory' + Id = 508 + } + @{ + ObjectType = 'tcdirectory' + Id = 517 + } + ) } From f7f98b08484931b7d09a858e9066cfa782ed4170 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 16 Feb 2020 16:35:45 +0100 Subject: [PATCH 052/145] . --- Docs/IntTestAfter.wsd | 20 +- Scripts/Test.ps1 | 9 +- Tests/Get-UMSFirmware.Tests.ps1 | 44 +- Tests/IntegrationTestsConfig.psd1 | 807 +++++++++++------------------- 4 files changed, 341 insertions(+), 539 deletions(-) diff --git a/Docs/IntTestAfter.wsd b/Docs/IntTestAfter.wsd index 9f7eda9..5cb6e31 100644 --- a/Docs/IntTestAfter.wsd +++ b/Docs/IntTestAfter.wsd @@ -235,9 +235,9 @@ frame Functions as FUN #LightGrey { node [NewUMSProfileAssignment] node [RemoveUMSProfileAssignment] - node [GetUMSUMSProfileAssignment] - node [GetUMSUMSDeviceAssignment] - node [GetUMSUMSDeviceDirectoryAssignment] + node [GetUMSProfileAssignment] + node [GetUMSDeviceAssignment] + node [GetUMSDeviceDirectoryAssignment] } @@ -261,9 +261,9 @@ frame Functions as FUN #LightGrey { UpdateUMSProfileDirectory -down. GetUMSProfileDirectory GetUMSProfileDirectory -down. NewUMSProfileAssignment NewUMSProfileAssignment -down. RemoveUMSProfileAssignment - RemoveUMSProfileAssignment -down. GetUMSUMSProfileAssignment - GetUMSUMSProfileAssignment -down. GetUMSUMSDeviceAssignment - GetUMSUMSDeviceAssignment -down. GetUMSUMSDeviceDirectoryAssignment + RemoveUMSProfileAssignment -down. GetUMSProfileAssignment + GetUMSProfileAssignment -down. GetUMSDeviceAssignment + GetUMSDeviceAssignment -down. GetUMSDeviceDirectoryAssignment } @@ -316,9 +316,9 @@ GetUMSDevice -right-> 0A0000000001 : 24 - Get-UMSDevice GetUMSDeviceDirectory -right-> DEV : 25 - Get-UMSDeviceDirectory GetUMSProfile -right-> PRO : 26 - GetUMSProfile GetUMSProfileDirectory -right-> PRO : 27 - Get-UMSProfileDirectory -GetUMSUMSProfileAssignment -right-> PRO_RDP_Session01 : 28 - Get-UMSUMSProfileAssignment Device -GetUMSUMSProfileAssignment -right-> PRO_RDP_Session01 : 29 - Get-UMSUMSProfileAssignment Directory -GetUMSUMSDeviceAssignment -right-> 0A0000000001 : 30 - Get-UMSUMSDeviceAssignment -GetUMSUMSDeviceDirectoryAssignment -right-> DEV_PI_BR : 31 - Get-UMSUMSDeviceDirectoryAssignment +GetUMSProfileAssignment -right-> PRO_RDP_Session01 : 28 - Get-UMSProfileAssignment Device +GetUMSProfileAssignment -right-> PRO_RDP_Session01 : 29 - Get-UMSProfileAssignment Directory +GetUMSDeviceAssignment -right-> 0A0000000001 : 30 - Get-UMSDeviceAssignment +GetUMSDeviceDirectoryAssignment -right-> DEV_PI_BR : 31 - Get-UMSDeviceDirectoryAssignment @enduml \ No newline at end of file diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 1759e3e..739be0d 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -11,9 +11,16 @@ $PSDefaultParameterValues += @{ } $Result = '' -$Result = (Get-UMSDeviceDirectory -Id 503 -Filter children).DirectoryChildren +#$Result = (Get-UMSProfile).Count +#$Result = Get-UMSProfileDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2 +#$Result = (Get-UMSProfileDirectory -Id 533 -Filter children).DirectoryChildren +#$Result = (Get-UMSDeviceAssignment -Id 577).Count +$Result = Get-UMSDevice +$Result1 = Get-UMSDevice | Select-Object -First 9 $Result +Assert-Equivalent -Actual $Result -Expected $Result1 + <# $Result = New-UMSDeviceDirectory -Name 'QandA' # 01 #> \ No newline at end of file diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index a63169e..5df3eb7 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSFirmware Should not throw' { { Get-UMSFirmware } | Should -Not -Throw @@ -129,10 +129,10 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSFirmware } | should throw 'Error' + It 'should throw Error' { + { Get-UMSFirmware } | Should throw 'Error' } It 'Result should be null or empty' { @@ -143,16 +143,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSFirmware[0].id + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie -Credential $Credential @@ -163,27 +161,35 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = Get-UMSFirmware } | Should Not Throw + { $Script:Result = Get-UMSFirmware | Sort-Object -Property Id } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[1].Id should have type [Int]' { + $Result[1].Id | Should -HaveType [Int] } - It "Result.Id should be exactly $($UMS.UMSFirmware[0].id)" { - $Result.Id | Should -BeExactly $UMS.UMSFirmware[0].id + It "Result[1].Id should be exactly $($Cfg.Tests.'Get-UMSFirmware'[1].Id)" { + $Result[1].Id | Should -BeExactly $($Cfg.Tests.'Get-UMSFirmware'[1].Id) } It 'Result.Version should have type [Version]' { $Result.Version | Should -HaveType [Version] } - It "Result.Version should be exactly $($UMS.UMSFirmware[0].Version)" { - $Result.Version | Should -BeExactly $UMS.UMSFirmware[0].Version + It "Result[0].Version should be exactly $($Cfg.Tests.'Get-UMSFirmware'[0].Version)" { + $Result[0].Version | Should -BeExactly $($Cfg.Tests.'Get-UMSFirmware'[0].Version) + } + + It "Result should be Equivalent of Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSFirmware')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } } } \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 104930c..b68c74d 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -4,508 +4,64 @@ Integration Tests Config @{ - Computername = 'localhost' + Computername = 'igelrmserver' TCPPort = 9443 CredPath = 'C:\Credentials\UMSRmdb.cred' SecurityProtocol = 'Tls12' ProfileRootDirId = 527 # Profiles->PSIGEL DeviceRootDirId = 502 # Devices -> PSIGEL - Tests = [ordered]@{ - 'GetUMSFirmware' = @( - @{ - Id = 1 - Product = 'IGEL OS 11' - Version = '11.3.100.1' - FirmwareType = 'LX' - } - @{ - Id = 2 - Product = 'IGEL OS 11' - Version = '11.3.110.1' - FirmwareType = 'LX' - } - ) - 'GetUMSProfile' = @( - @{ - FirmwareId = 1 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 529 - Name = 'PRO_RDP_Session01' - ParentId = 528 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 1 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 532 - Name = 'PRO_Terminal_LocalTerminal' - ParentId = 531 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 2 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 535 - Name = 'PRO_LNG_DE' - ParentId = 533 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 2 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 537 - Name = 'PRO_NW_LAN' - ParentId = 533 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 2 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 538 - Name = 'PRO_NW_WLAN' - ParentId = 533 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 1 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 540 - Name = 'PRO_PW_Root' - ParentId = 539 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 1 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 542 - Name = 'PRO_TZ_CET' - ParentId = 541 - MovedToBin = 'False' - ObjectType = 'profile' - } - ) - 'GetUMSProfileDirectory' = @( - @{ - Id = 528 - Name = 'Sessions' - ParentId = 527 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 531 - Name = 'Accessories' - ParentId = 527 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 533 - Name = 'Network' - ParentId = 527 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 534 - Name = 'Network User Interface' - ParentId = 533 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 539 - Name = 'Security' - ParentId = 527 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 541 - Name = 'System' - ParentId = 527 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 52 - Name = 'PSIGEL' - ParentId = -2 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - ) - 'GetUMSProfileGetUMSProfileAssignment' = @( - @{ - Id = 538 - Type = 'profile' - ReceiverId = 505 - ReceiverType = 'tc' - AssignmentPosition = 0 - } - ) - 'GetUMSProfileGetUMSProfileAssignmentDirectory' = @( - @{ - Id = 529 - Type = 'profile' - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 532 - Type = 'profile' - ReceiverId = 514 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 532 - Type = 'profile' - ReceiverId = 517 - ReceiverType = 'tcdirectory' - AssignmentPosition = 1 - } - @{ - Id = 535 - Type = 'profile' - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 537 - Type = 'profile' - ReceiverId = 503 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 538 - Type = 'profile' - ReceiverId = 517 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 540 - Type = 'profile' - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 542 - Type = 'profile' - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - ) - 'GetUMSStatus' = @( - @{ - RmGuiServerVersion = 6.3.130 - BuildNumber = 44584 - ActiveMqVersion = 5.7.0 - DerbyVersion = 10.12.1.1 - ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' - Server = 'igelrmserver:8443' - } - ) - 'GetUMSDeviceId505Filterdetails' = @( - @{ - Id = 505 - ObjectType = 'tc' - UnitId = '0A0000000001' - Mac = '0A0000000001' - Name = 'BR-HR-001' - ParentId = 504 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - NetworkName = '' - Site = '' - Comment = '' - Department = '' - CostCenter = '' - AssetID = '' - InServiceDate = '' - SerialNumber = '' - ProductId = '' - CpuSpeed = 0 - CpuType = '' - DeviceType = '' - DeviceSerialNumber = '' - OsType = '' - FlashSize = 0 - MemorySize = 0 - NetworkSpeed = 0 - GraphicsChipset0 = '' - GraphicsChipset1 = '' - MonitorVendor1 = '' - MonitorModel1 = '' - MonitorSerialnumber1 = '' - MonitorSize1 = 0 - MonitorNativeResolution1 = '' - Monitor1YearOfManufacture = 0 - Monitor1WeekOfManufacture = 0 - MonitorVendor2 = '' - MonitorModel2 = '' - MonitorSerialnumber2 = '' - MonitorSize2 = 0 - MonitorNativeResolution2 = '' - Monitor2YearOfManufacture = 0 - Monitor2WeekOfManufacture = 0 - BiosVendor = '' - BiosVersion = '' - TotalUsagetime = -1 - TotalUptime = -1 - BatteryLevel = -1 - LastBootTime = '' - BiosDate = '' - } - ) - 'GetUMSDeviceId505Filteronline' = @( - @{ - Id = 505 - ObjectType = 'tc' - UnitId = '0A0000000001' - Mac = '0A0000000001' - Name = 'BR-HR-001' - ParentId = 504 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - Online = 'False' - } - ) - 'GetUMSDeviceAssignmentId505' = @( - @{ - Id = 505 - ReceiverId = 505 - ReceiverType = 'tc' - AssigneeId = 538 - AssigneeType = 'profile' - AssignmentPosition = 0 - } - @{ - Id = 505 - ReceiverId = 503 - ReceiverType = 'tcdirectory' - AssigneeId = 537 - AssigneeType = 'profile' - AssignmentPosition = 1 - } - @{ - Id = 505 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 542 - AssigneeType = 'profile' - AssignmentPosition = 2 - } - @{ - Id = 505 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 540 - AssigneeType = 'profile' - AssignmentPosition = 3 - } - @{ - Id = 505 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 529 - AssigneeType = 'profile' - AssignmentPosition = 4 - } - @{ - Id = 505 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 535 - AssigneeType = 'profile' - AssignmentPosition = 5 - } - ) - 'GetUMSDeviceDirectory' = @( - @{ - Id = 514 - Name = 'Development' - ParentId = 511 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 516 - Name = 'Leipzig' - ParentId = 502 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 517 - Name = 'Development' - ParentId = 516 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 502 - Name = 'PSIGEL' - ParentId = -1 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 503 - Name = 'Bremen' - ParentId = 502 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 504 - Name = 'HR' - ParentId = 503 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 520 - Name = 'Distribution' - ParentId = 516 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 508 - Name = 'Marketing' - ParentId = 503 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 511 - Name = 'Augsburg' - ParentId = 502 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - ) - 'Get-UMSDeviceDirectoryId514' = @( - @{ - Id = 514 - Name = 'Development' - ParentId = 511 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - ) - 'GetUMSDeviceDirectoryAssignmentId514' = @( - @{ - Id = 514 - ReceiverId = 514 - ReceiverType = 'tcdirectory' - AssigneeId = 532 - AssigneeType = 'profile' - AssignmentPosition = 0 - } - @{ - Id = 514 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 535 - AssigneeType = 'profile' - AssignmentPosition = 1 - } - @{ - Id = 514 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 529 - AssigneeType = 'profile' - AssignmentPosition = 2 - } + + Tests = @{ + 'Get-UMSFirmware' = @( @{ - Id = 514 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 540 - AssigneeType = 'profile' - AssignmentPosition = 3 + Id = 1 + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' } @{ - Id = 514 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 542 - AssigneeType = 'profile' - AssignmentPosition = 4 + Id = 2 + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' } ) - 'GetUMSDirectoryRecursiveId511DirectoryCollGetUMSDeviceDirectory' = @( + } + + <# + Tests = [ordered]@{ + 'Get-UMSFirmware' = @( @{ - Id = 511 - Name = 'Augsburg' - ParentId = 502 - MovedToBin = 'False' - ObjectType = 'tcdirectory' + Id = 1 + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' } @{ - Id = 514 - Name = 'Development' - ParentId = 511 - MovedToBin = 'False' - ObjectType = 'tcdirectory' + Id = 2 + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' } ) - 'GetUMSDirectoryRecursiveId511DirectoryCollGetUMSDeviceDirectoryElementCollGetUMSDevice' = @( - @{ - Id = 512 - ObjectType = 'tc' - UnitId = '0A0000000005' - Mac = '0A0000000005' - Name = 'A-DEV-005' - ParentId = 514 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - } + 'Get-UMSStatus' = @( @{ - Id = 513 - ObjectType = 'tc' - UnitId = '0A0000000006' - Mac = '0A0000000006' - Name = 'A-DEV-006' - ParentId = 514 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' + RmGuiServerVersion = 6.3.130 + BuildNumber = 44584 + ActiveMqVersion = 5.7.0 + DerbyVersion = 10.12.1.1 + ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' + Server = 'igelrmserver:8443' } ) - 'NewUMSDeviceDirectoryNameQandA' = @( + 'NewUMSDeviceDirectoryNameQandA' = @( @{ Message = 'Directory successfully inserted.' Id = 613 Name = 'QandA' } ) - 'NewUMSDeviceMac0A0000000007NameA-QA-007FirmwareId1ParentId-1' = @( + 'NewUMSDeviceMac0A0000000007NameA-QA-007FirmwareId1ParentId-1' = @( @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' @@ -514,7 +70,7 @@ Integration Tests Config ParentId = -1 } ) - 'NewUMSDeviceMac0A0000000007NameA-QA-008FirmwareId1ParentId-1' = @( + 'NewUMSDeviceMac0A0000000007NameA-QA-008FirmwareId1ParentId-1' = @( @{ Mac = '0A0000000008' Message = 'Device successfully inserted.' @@ -523,14 +79,14 @@ Integration Tests Config ParentId = -1 } ) - 'NewUMSProfileDirectoryNameDevices' = @( + 'NewUMSProfileDirectoryNameDevices' = @( @{ Message = 'Directory successfully inserted.' Id = 623 Name = 'Devices' } ) - 'NewUMSProfileAssignmentId538ReceiverId577ReceiverTypetc' = @( + 'NewUMSProfileAssignmentId538ReceiverId577ReceiverTypetc' = @( @{ Message = '1 asssignments successfully assigned to device <{1}>.' Id = 538 @@ -538,7 +94,7 @@ Integration Tests Config ReceiverType = 'tc' } ) - 'New-UMSProfileAssignment -Id 538 -ReceiverId 504 -ReceiverType tcdirectory' = @( + 'New-UMSProfileAssignment -Id 538 -ReceiverId 504 -ReceiverType tcdirectory' = @( @{ Message = '1 asssignments successfully assigned to device directory <{1}>.' Id = 538 @@ -546,37 +102,37 @@ Integration Tests Config ReceiverType = 'tcdirectory' } ) - 'Remove-UMSDevice -Id 572 -Confirm:$false' = @( + 'Remove-UMSDevice -Id 572 -Confirm:$false' = @( @{ Message = 'Offline deletion successful.' Id = 572 } ) - '522 | Remove-UMSDevice -Confirm:$false' = @( + '522 | Remove-UMSDevice -Confirm:$false' = @( @{ Message = 'Offline deletion successful' Id = 572 } ) - 'Remove-UMSDeviceDirectory -Id 520 -Confirm:$false' = @( + 'Remove-UMSDeviceDirectory -Id 520 -Confirm:$false' = @( @{ Message = 'Deletion successful.' Id = 520 } ) - 'Remove-UMSProfile -Id 542 -Confirm:$false' = @( + 'Remove-UMSProfile -Id 542 -Confirm:$false' = @( @{ Message = 'Deleted profile.' Id = 542 } ) - 'Remove-UMSProfileDirectory -Id 541 -Confirm:$false' = @( + 'Remove-UMSProfileDirectory -Id 541 -Confirm:$false' = @( @{ Message = 'Deletion successful.' Id = 541 } ) - 'Remove-UMSProfileAssignment -Id 538 -ReceiverId 505 -ReceiverType tc -Confirm:$false' = @( + 'Remove-UMSProfileAssignment -Id 538 -ReceiverId 505 -ReceiverType tc -Confirm:$false' = @( @{ Message = 'deleted profile assignment.' Id = 538 @@ -584,7 +140,7 @@ Integration Tests Config ReceiverType = 'tc' } ) - 'Remove-UMSProfileAssignment -Id 540 -ReceiverId 502 -ReceiverType tcdirectory -Confirm:$false' = @( + 'Remove-UMSProfileAssignment -Id 540 -ReceiverId 502 -ReceiverType tcdirectory -Confirm:$false' = @( @{ Message = 'deleted profile assignment.' Id = 540 @@ -592,19 +148,19 @@ Integration Tests Config ReceiverType = 'tcdirectory' } ) - 'Move-UMSDeviceDirectory -Id 613 -DestId 511' = @( + 'Move-UMSDeviceDirectory -Id 613 -DestId 511' = @( @{ Id = 613 Message = 'successful.' } ) - 'Move-UMSDevice -Id 518 -DestId 514' = @( + 'Move-UMSDevice -Id 518 -DestId 514' = @( @{ Id = 518 Message = 'successful.' } ) - '617, 621 | Move-UMSDevice -DestId 613' = @( + '617, 621 | Move-UMSDevice -DestId 613' = @( @{ Id = 617 #dynamisch Message = 'successful.' @@ -614,56 +170,56 @@ Integration Tests Config Message = 'successful.' } ) - '517 | Move-UMSDeviceDirectory -DestId 503' = @( + '517 | Move-UMSDeviceDirectory -DestId 503' = @( @{ Id = 517 Message = 'successful.' } ) - 'Move-UMSProfile -Id 535 -DestId 534' = @( + 'Move-UMSProfile -Id 535 -DestId 534' = @( @{ Id = 535 Message = 'successful' } ) - 'Move-UMSProfileDirectory -Id 534 -DestId 527' = @( + 'Move-UMSProfileDirectory -Id 534 -DestId 527' = @( @{ Id = 535 Message = 'successful' } ) - 'Update-UMSDeviceDirectory -Id 517 -Name "Distribution"' = @( + 'Update-UMSDeviceDirectory -Id 517 -Name "Distribution"' = @( @{ Message = 'Updated directory successfully.' Id = 517 } ) - ' Update-UMSDevice -Id 578 -Name "BR-DIS-010"' = @( + ' Update-UMSDevice -Id 578 -Name "BR-DIS-010"' = @( @{ Message = 'Update successful.' Id = 578 } ) - 'Update-UMSDevice -Id 518 -Name "A-DEV-009"' = @( + 'Update-UMSDevice -Id 518 -Name "A-DEV-009"' = @( @{ Message = 'Update successful.' Id = 518 } ) #Origin rename to "PRO_NW_LNG_DE" - 'Update-UMSProfile -Id 535 -Name "PRO_LNG_DE"' = @( + 'Update-UMSProfile -Id 535 -Name "PRO_LNG_DE"' = @( @{ Message = 'Update successful.' Id = 535 } ) - 'Update-UMSProfileDirectory -Id 534 -Name "User Interface"' = @( + 'Update-UMSProfileDirectory -Id 534 -Name "User Interface"' = @( @{ Message = 'Updated directory successfully.' Id = 534 } ) - 'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' = @( + 'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' = @( @{ Id = 505 ObjectType = 'tc' @@ -687,7 +243,7 @@ Integration Tests Config MovedToBin = 'False' } ) - '518 | Get-UMSDevice -Filter details' = @( + '518 | Get-UMSDevice -Filter details' = @( @{ Id = 518 ObjectType = 'tc' @@ -740,7 +296,7 @@ Integration Tests Config BiosDate = '' } ) - 'Get-UMSDevice -Id 578 -Filter online' = @( + 'Get-UMSDevice -Id 578 -Filter online' = @( @{ Id = 578 ObjectType = tc @@ -754,10 +310,10 @@ Integration Tests Config Online = 'False' } ) - '(Get-UMSDevice).Count' = @( + '(Get-UMSDevice).Count' = @( 10 ) - 'Get-UMSDeviceDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2' = @( + 'Get-UMSDeviceDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2' = @( @{ Id = 613 Name = 'QandA' @@ -773,7 +329,7 @@ Integration Tests Config ObjectType = 'tcdirectory' } ) - '517 | Get-UMSDeviceDirectory' = @( + '517 | Get-UMSDeviceDirectory' = @( @{ Id = 517 Name = 'Distribution' @@ -782,7 +338,7 @@ Integration Tests Config ObjectType = 'tcdirectory' } ) - '(Get-UMSDeviceDirectory -Id 503 -Filter children).DirectoryChildren' = @( + '(Get-UMSDeviceDirectory -Id 503 -Filter children).DirectoryChildren' = @( @{ ObjectType = 'tcdirectory' Id = 504 @@ -796,7 +352,240 @@ Integration Tests Config Id = 517 } ) + 'Get-UMSProfile | Sort-Object -Property Id | Select-Object -First 2' = @( + @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 529 + Name = 'PRO_RDP_Session01' + ParentId = 528 + MovedToBin = 'False' + ObjectType = 'profile' + } + @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 532 + Name = 'PRO_Terminal_LocalTerminal' + ParentId = 531 + MovedToBin = 'False' + ObjectType = 'profile' + } + ) + '535 | Get-UMSProfile' = @( + @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 535 + Name = 'PRO_LNG_DE' + ParentId = 534 + MovedToBin = 'False' + ObjectType = 'profile' + } + ) + '(Get-UMSProfile).Count' = @( + 6 + ) + 'Get-UMSProfileDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2' = @( + @{ + Id = 623 + Name = 'Devices' + ParentId = '-2' + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 539 + Name = 'Security' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + ) + '(Get-UMSProfileDirectory -Id 533 -Filter children).DirectoryChildren' = @( + @{ + ObjectType = 'profile' + id = 537 + } + @{ + ObjectType = 'profile' + id = 538 + } + ) + 'Get-UMSProfileAssignment -Id 538' = @( + @{ + Id = 538 + Get = 'profile' + ReceiverId = 577 + ReceiverType = 'tc' + AssignmentPosition = 0 + } + ) + '538 | Get-UMSProfileAssignment -Directory' = @( + @{ + Id = 538 + Type = 'profile' + ReceiverId = 504 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 538 + Type = 'profile' + ReceiverId = 517 + ReceiverType = 'tcdirectory' + AssignmentPosition = 1 + } + ) + '(Get-UMSDeviceAssignment -Id 577).Count' = @( + 4 + ) + '577 | Get-UMSDeviceAssignment' = @( + @{ + Id = 577 + ReceiverId = 577 + ReceiverType = 'tc' + AssigneeId = 538 + AssigneeType = 'profile' + AssignmentPosition = 0 + } + @{ + Id = 577 + ReceiverId = 503 + ReceiverType = 'tcdirectory' + AssigneeId = 537 + AssigneeType = 'profile' + AssignmentPosition = 1 + } + @{ + Id = 577 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 529 + AssigneeType = 'profile' + AssignmentPosition = 2 + } + @{ + Id = 577 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 535 + AssigneeType = 'profile' + AssignmentPosition = 3 + } + ) + '(Get-UMSDeviceDirectoryAssignment -Id 514).Count' = @( + 3 + ) + '514 | Get-UMSDeviceDirectoryAssignment' = @( + @{ + Id = 514 + ReceiverId = 514 + ReceiverType = 'tcdirectory' + AssigneeId = 532 + AssigneeType = 'profile' + AssignmentPosition = 0 + } + @{ + Id = 514 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 535 + AssigneeType = 'profile' + AssignmentPosition = 1 + } + @{ + Id = 514 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 529 + AssigneeType = 'profile' + AssignmentPosition = 2 + } + ) + 'Get-UMSDirectoryRecursive -Id 511 -DirectoryColl (Get-UMSDeviceDirectory)' = @( + @{ + Id = 511 + Name = 'Augsburg' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 514 + Name = 'Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 613 + Name = 'QandA' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + 'Get-UMSDirectoryRecursive -Id 511 -DirectoryColl (Get-UMSDeviceDirectory) -ElementColl (Get-UMSDevice)' = @( + @{ + Id = 512 + ObjectType = 'tc' + UnitId = '0A0000000005' + Mac = '0A0000000005' + Name = 'A-DEV-005' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 513 + ObjectType = 'tc' + UnitId = '0A0000000006' + Mac = '0A0000000006' + Name = 'A-DEV-006' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 518 + ObjectType = 'tc' + UnitId = '0A0000000009' + Mac = '0A0000000009' + Name = 'A-DEV-009' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 617 + ObjectType = 'tc' + UnitId = '0A0000000007' + Mac = '0A0000000007' + Name = 'A-QA-007' + ParentId = 613 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 621 + ObjectType = 'tc' + UnitId = '0A0000000008' + Mac = '0A0000000008' + Name = 'A-QA-008' + ParentId = 613 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + ) } - - +#> } \ No newline at end of file From b352b722700e02add8d70a0fc458804f9dcb61e0 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 22 Feb 2020 11:25:23 +0100 Subject: [PATCH 053/145] . --- Tests/Get-UMSFirmware.Tests.ps1 | 18 +++++------ Tests/Get-UMSStatus.Tests.ps1 | 54 +++++++++++++++++++------------ Tests/IntegrationTestsConfig.psd1 | 22 ++++++------- 3 files changed, 54 insertions(+), 40 deletions(-) diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index 5df3eb7..ee133cb 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -168,23 +168,23 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result | Should not BeNullOrEmpty } - It 'Result[1].Id should have type [Int]' { - $Result[1].Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result[1].Id should be exactly $($Cfg.Tests.'Get-UMSFirmware'[1].Id)" { - $Result[1].Id | Should -BeExactly $($Cfg.Tests.'Get-UMSFirmware'[1].Id) + It 'Result[0].Product should have type [String]' { + $Result[0].Product | Should -HaveType [String] } - It 'Result.Version should have type [Version]' { - $Result.Version | Should -HaveType [Version] + It 'Result[0].Version should have type [Version]' { + $Result[0].Version | Should -HaveType [Version] } - It "Result[0].Version should be exactly $($Cfg.Tests.'Get-UMSFirmware'[0].Version)" { - $Result[0].Version | Should -BeExactly $($Cfg.Tests.'Get-UMSFirmware'[0].Version) + It 'Result[0].FirmwareType should have type [String]' { + $Result[0].FirmwareType | Should -HaveType [String] } - It "Result should be Equivalent of Expected" { + It "Result should be Equivalent to Expected" { $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSFirmware')) { New-Object psobject -Property $item diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index 6f5565d..faa0020 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSStatus Should not throw' { { Get-UMSStatus } | Should -Not -Throw @@ -87,10 +87,10 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSStatus } | should throw 'Error' + It 'should throw Error' { + { Get-UMSStatus } | Should throw 'Error' } It 'Result should be null or empty' { @@ -101,16 +101,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $RmGuiServerVersion = $UMS.UMSStatus.RmGuiServerVersion - $BuildNumber = $UMS.UMSStatus.BuildNumber + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie -Credential $Credential @@ -128,20 +126,36 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result | Should not BeNullOrEmpty } - It 'Result.RmGuiServerVersion should have type [Version]' { - $Result.RmGuiServerVersion | Should -HaveType [Version] + It 'Result.RmGuiServerVersion[0] should have type [Version]' { + $Result.RmGuiServerVersion[0] | Should -HaveType [Version] } - It "Result.RmGuiServerVersion should be exactly $RmGuiServerVersion" { - $Result.RmGuiServerVersion | Should -BeExactly $RmGuiServerVersion + It 'Result.BuildNumber[0] should have type [Int]' { + $Result.BuildNumber[0] | Should -HaveType [Int] } - It 'Result.BuildNumber should have type [Int]' { - $Result.BuildNumber | Should -HaveType [Int] + It 'Result.activeMQVersion[0] should have type [Version]' { + $Result.activeMQVersion[0] | Should -HaveType [Version] } - It "Result.BuildNumber should be exactly $BuildNumber" { - $Result.BuildNumber | Should -BeExactly $BuildNumber + It 'Result.derbyVersion[0] should have type [Version]' { + $Result.derbyVersion[0] | Should -HaveType [Version] + } + + It 'Result.serverUUID[0] should have type [Char]' { + $Result.serverUUID[0] | Should -HaveType [Char] + } + + It 'Result.server[0] should have type [Char]' { + $Result.server[0] | Should -HaveType [Char] + } + + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSStatus')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } } } \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index b68c74d..e9f9005 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,6 +12,16 @@ Integration Tests Config DeviceRootDirId = 502 # Devices -> PSIGEL Tests = @{ + 'Get-UMSStatus' = @( + @{ + RmGuiServerVersion = '6.3.130' + BuildNumber = 44584 + ActiveMqVersion = '5.7.0' + DerbyVersion = '10.12.1.1' + ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' + Server = 'igelrmserver:8443' + } + ) 'Get-UMSFirmware' = @( @{ Id = 1 @@ -27,7 +37,7 @@ Integration Tests Config } ) } - + <# Tests = [ordered]@{ 'Get-UMSFirmware' = @( @@ -44,16 +54,6 @@ Integration Tests Config FirmwareType = 'LX' } ) - 'Get-UMSStatus' = @( - @{ - RmGuiServerVersion = 6.3.130 - BuildNumber = 44584 - ActiveMqVersion = 5.7.0 - DerbyVersion = 10.12.1.1 - ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' - Server = 'igelrmserver:8443' - } - ) 'NewUMSDeviceDirectoryNameQandA' = @( @{ Message = 'Directory successfully inserted.' From 7cc718a0dd32af8b28e82734b2a791872a43d0fd Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 23 Feb 2020 13:56:35 +0100 Subject: [PATCH 054/145] . --- Tests/IntegrationTestsConfig.psd1 | 64 ++++++++++---------------- Tests/New-UMSDevice.Tests.ps1 | 55 ++++++++++++---------- Tests/New-UMSDeviceDirectory.Tests.ps1 | 38 ++++++++------- 3 files changed, 77 insertions(+), 80 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index e9f9005..141a4f1 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,7 +12,7 @@ Integration Tests Config DeviceRootDirId = 502 # Devices -> PSIGEL Tests = @{ - 'Get-UMSStatus' = @( + 'Get-UMSStatus' = @( @{ RmGuiServerVersion = '6.3.130' BuildNumber = 44584 @@ -22,63 +22,47 @@ Integration Tests Config Server = 'igelrmserver:8443' } ) - 'Get-UMSFirmware' = @( - @{ - Id = 1 - Product = 'IGEL OS 11' - Version = '11.3.100.1' - FirmwareType = 'LX' - } - @{ - Id = 2 - Product = 'IGEL OS 11' - Version = '11.3.110.1' - FirmwareType = 'LX' - } - ) - } - - <# - Tests = [ordered]@{ - 'Get-UMSFirmware' = @( - @{ - Id = 1 - Product = 'IGEL OS 11' - Version = '11.3.100.1' - FirmwareType = 'LX' - } - @{ - Id = 2 - Product = 'IGEL OS 11' - Version = '11.3.110.1' - FirmwareType = 'LX' - } - ) - 'NewUMSDeviceDirectoryNameQandA' = @( + 'New-UMSDeviceDirectory' = @( @{ Message = 'Directory successfully inserted.' - Id = 613 + Id = 592 Name = 'QandA' } ) - 'NewUMSDeviceMac0A0000000007NameA-QA-007FirmwareId1ParentId-1' = @( + 'New-UMSDevice' = @( @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' - Id = 617 #dynamisch + Id = 593 Name = 'A-QA-007' ParentId = -1 } - ) - 'NewUMSDeviceMac0A0000000007NameA-QA-008FirmwareId1ParentId-1' = @( @{ Mac = '0A0000000008' Message = 'Device successfully inserted.' - Id = 621 #dynamisch + Id = 594 Name = 'A-QA-008' ParentId = -1 } ) + 'Get-UMSFirmware' = @( + @{ + Id = 1 + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' + } + @{ + Id = 2 + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' + } + ) + } + + <# + Tests = [ordered]@{ 'NewUMSProfileDirectoryNameDevices' = @( @{ Message = 'Directory successfully inserted.' diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index 13a1320..b808b5e 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -22,7 +22,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -36,7 +36,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' Should not throw" { { New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' } | Should -Not -Throw @@ -86,7 +86,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' -WhatIf @@ -105,7 +105,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' -ApiVersion 10 -ErrorAction Stop Should throw" { { New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -119,22 +119,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Name = $UMS.UMSDevice[3].NameNew - $Mac = $UMS.UMSDevice[3].MacNew - $FirmwareId = $UMS.UMSDevice[3].FirmwareIdNew - $ParentId = $UMS.UMSDevice[3].ParentId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Name' = $Name - '*-UMS*:Mac' = $Mac - '*-UMS*:FirmwareId' = $FirmwareId - '*-UMS*:ParentId' = $ParentId + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie @@ -145,7 +137,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = New-UMSDevice } | Should Not Throw + { $Script:Result = @( + New-UMSDevice -Mac 0A0000000007 -Name "A-QA-007" -FirmwareId 1 -ParentId -1 + New-UMSDevice -Mac 0A0000000008 -Name "A-QA-008" -FirmwareId 1 -ParentId -1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -156,16 +151,28 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Name should be exactly $Name" { - $Result[0].Name | Should -BeExactly $Name + It 'Result[0].Mac should have type [String]' { + $Result[0].Mac | Should -HaveType [String] } - It "Result[0].Mac should be exactly $Mac" { - $Result[0].Mac | Should -BeExactly $Mac + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].ParentId should be exactly $ParentId" { - $Result[0].ParentId | Should -BeExactly $ParentId + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + It 'Result[0].ParentId should have type [Int]' { + $Result[0].ParentId | Should -HaveType [Int] + } + + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDevice')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } } } \ No newline at end of file diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index 6040bf0..7f20b5a 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "New-UMSDeviceDirectory -Name 'NameNew' Should not throw" { { New-UMSDeviceDirectory -Name 'NameNew' } | Should -Not -Throw @@ -84,7 +84,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = New-UMSDeviceDirectory -Name 'NameNew' -WhatIf @@ -103,7 +103,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "New-UMSDeviceDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop Should throw" { { New-UMSDeviceDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -117,16 +117,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Name = $UMS.UMSDeviceDirectory[3].NameNew + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Name' = $Name + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie @@ -137,7 +135,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = New-UMSDeviceDirectory } | Should Not Throw + { $Script:Result = New-UMSDeviceDirectory -Name "QandA" } | Should Not Throw } It 'Result should not be null or empty' { @@ -148,12 +146,20 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Name should be exactly $Name" { - $Result[0].Name | Should -BeExactly $Name + It "Result[0].Name should have type [String]" { + $Result[0].Name | Should -HaveType [String] } - It "Result[0].Message should be exactly 'Directory successfully inserted.'" { - $Result[0].Message | Should -BeExactly 'Directory successfully inserted.' + It "Result[0].Message should have type [String]" { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDeviceDirectory')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } } } \ No newline at end of file From 2a3b8b96c9f794a3c79efa509c4f610bd4ebe3ec Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 23 Feb 2020 14:06:01 +0100 Subject: [PATCH 055/145] edit Intergrationtest --- Tests/IntegrationTestsConfig.psd1 | 22 +++++++------- Tests/New-UMSProfileDirectory.Tests.ps1 | 39 ++++++++++++++++--------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 141a4f1..7e1ede4 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,7 +12,7 @@ Integration Tests Config DeviceRootDirId = 502 # Devices -> PSIGEL Tests = @{ - 'Get-UMSStatus' = @( + 'Get-UMSStatus' = @( @{ RmGuiServerVersion = '6.3.130' BuildNumber = 44584 @@ -22,14 +22,14 @@ Integration Tests Config Server = 'igelrmserver:8443' } ) - 'New-UMSDeviceDirectory' = @( + 'New-UMSDeviceDirectory' = @( @{ Message = 'Directory successfully inserted.' Id = 592 Name = 'QandA' } ) - 'New-UMSDevice' = @( + 'New-UMSDevice' = @( @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' @@ -45,7 +45,14 @@ Integration Tests Config ParentId = -1 } ) - 'Get-UMSFirmware' = @( + 'New-UMSProfileDirectory' = @( + @{ + Message = 'Directory successfully inserted.' + Id = 595 + Name = 'Devices' + } + ) + 'Get-UMSFirmware' = @( @{ Id = 1 Product = 'IGEL OS 11' @@ -63,13 +70,6 @@ Integration Tests Config <# Tests = [ordered]@{ - 'NewUMSProfileDirectoryNameDevices' = @( - @{ - Message = 'Directory successfully inserted.' - Id = 623 - Name = 'Devices' - } - ) 'NewUMSProfileAssignmentId538ReceiverId577ReceiverTypetc' = @( @{ Message = '1 asssignments successfully assigned to device <{1}>.' diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index 94744f0..1fdf307 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "New-UMSProfileDirectory -Name 'NameNew' Should not throw" { { New-UMSProfileDirectory -Name 'NameNew' } | Should -Not -Throw @@ -83,7 +83,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = New-UMSProfileDirectory -Name 'NameNew' -WhatIf @@ -102,7 +102,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "New-UMSProfileDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop Should throw" { { New-UMSProfileDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -116,16 +116,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Name = $UMS.UMSProfileDirectory[2].NameNew + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Name' = $Name + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie @@ -136,7 +134,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = New-UMSProfileDirectory } | Should Not Throw + { $Script:Result = New-UMSProfileDirectory -Name "Devices" } | Should Not Throw } It 'Result should not be null or empty' { @@ -147,8 +145,21 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Name should be exactly $Name" { - $Result[0].Name | Should -BeExactly $Name + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileDirectory')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } } } \ No newline at end of file From b904838e318a76e37f4bd694ef042afc1910eec6 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 29 Feb 2020 15:06:00 +0100 Subject: [PATCH 056/145] . --- Tests/IntegrationTestsConfig.psd1 | 36 +++++++--------- Tests/New-UMSProfileAssignment.Tests.ps1 | 54 ++++++++++++++---------- Tests/New-UMSProfileDirectory.Tests.ps1 | 2 +- Tests/Remove-UMSDevice.Tests.ps1 | 40 ++++++++++-------- 4 files changed, 72 insertions(+), 60 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 7e1ede4..5b604ca 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,7 +12,7 @@ Integration Tests Config DeviceRootDirId = 502 # Devices -> PSIGEL Tests = @{ - 'Get-UMSStatus' = @( + 'Get-UMSStatus' = @( @{ RmGuiServerVersion = '6.3.130' BuildNumber = 44584 @@ -22,14 +22,14 @@ Integration Tests Config Server = 'igelrmserver:8443' } ) - 'New-UMSDeviceDirectory' = @( + 'New-UMSDeviceDirectory' = @( @{ Message = 'Directory successfully inserted.' Id = 592 Name = 'QandA' } ) - 'New-UMSDevice' = @( + 'New-UMSDevice' = @( @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' @@ -45,14 +45,14 @@ Integration Tests Config ParentId = -1 } ) - 'New-UMSProfileDirectory' = @( + 'New-UMSProfileDirectory' = @( @{ Message = 'Directory successfully inserted.' Id = 595 Name = 'Devices' } ) - 'Get-UMSFirmware' = @( + 'Get-UMSFirmware' = @( @{ Id = 1 Product = 'IGEL OS 11' @@ -66,38 +66,34 @@ Integration Tests Config FirmwareType = 'LX' } ) - } - - <# - Tests = [ordered]@{ - 'NewUMSProfileAssignmentId538ReceiverId577ReceiverTypetc' = @( + 'New-UMSProfileAssignment' = @( @{ - Message = '1 asssignments successfully assigned to device <{1}>.' Id = 538 + Message = '1 asssignments successfully assigned to device <{1}>.' ReceiverId = 577 ReceiverType = 'tc' } - ) - 'New-UMSProfileAssignment -Id 538 -ReceiverId 504 -ReceiverType tcdirectory' = @( @{ - Message = '1 asssignments successfully assigned to device directory <{1}>.' Id = 538 + Message = '1 asssignments successfully assigned to device directory <{1}>.' ReceiverId = 504 ReceiverType = 'tcdirectory' } ) - 'Remove-UMSDevice -Id 572 -Confirm:$false' = @( + 'Remove-UMSDevice' = @( @{ - Message = 'Offline deletion successful.' Id = 572 + Message = 'Offline deletion successful.' } - ) - '522 | Remove-UMSDevice -Confirm:$false' = @( @{ - Message = 'Offline deletion successful' - Id = 572 + Id = 522 + Message = 'Offline deletion successful.' } ) + } + + <# + Tests = [ordered]@{ 'Remove-UMSDeviceDirectory -Id 520 -Confirm:$false' = @( @{ Message = 'Deletion successful.' diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 9c09c44..2bc1cd6 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc'" { { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should -Not -Throw @@ -140,7 +140,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' -WhatIf @@ -159,10 +159,10 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | should throw 'Error' + It 'should throw Error' { + { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should throw 'Error' } It 'Result should be null or empty' { @@ -173,20 +173,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileAssignment[0].Id - $ReceiverId = $UMS.UMSProfileAssignment[0].ReceiverIdNew - $ReceiverType = $UMS.UMSProfileAssignment[0].ReceiverTypeNew + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:ReceiverId' = $ReceiverId - '*-UMS*:ReceiverType' = $ReceiverType + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie @@ -197,7 +191,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = New-UMSProfileAssignment } | Should Not Throw + { $Script:Result = @( + New-UMSProfileAssignment -Id 538 -ReceiverId 504 -ReceiverType tcdirectory + 538 | New-UMSProfileAssignment -ReceiverId 577 -ReceiverType tc + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -208,12 +205,25 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].ReceiverId should be exactly $ReceiverId" { - $Result[0].ReceiverId | Should -BeExactly $ReceiverId + It 'Result[0].ReceiverId should have type [Int]' { + $Result[0].ReceiverId | Should -HaveType [Int] } + + It 'Result[0].ReceiverType should have type [String]' { + $Result[0].ReceiverType | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileAssignment')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected + } + } } \ No newline at end of file diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index 1fdf307..4de444d 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -153,7 +153,6 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Name | Should -HaveType [String] } - It "Result should be Equivalent to Expected" { $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileDirectory')) { @@ -161,5 +160,6 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } Assert-Equivalent -Actual $Result -Expected $Expected } + } } \ No newline at end of file diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index 82b9325..953e166 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Remove-UMSDevice -Id 2 Should not throw" { { Remove-UMSDevice -Id 2 } | Should -Not -Throw @@ -136,7 +136,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Remove-UMSDevice -Id 2 -WhatIf @@ -155,7 +155,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Remove-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -169,17 +169,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[0].Id + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -190,7 +188,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = Remove-UMSDevice } | Should Not Throw + { $Script:Result = @( + Remove-UMSDevice -Id 572 + 522 | Remove-UMSDevice + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -201,12 +202,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'Offline deletion successful.'" { - $Result[0].Message | Should -BeExactly 'Offline deletion successful.' + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDevice')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } + } } \ No newline at end of file From 18664ce93bae416c50bf32020d123c40d3683407 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 29 Feb 2020 16:40:49 +0100 Subject: [PATCH 057/145] . --- PSIGEL/Public/Remove-UMSProfileAssignment.ps1 | 4 +- Tests/IntegrationTestsConfig.psd1 | 36 ++++++------- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 39 ++++++++------ Tests/Remove-UMSProfile.Tests.ps1 | 39 ++++++++------ Tests/Remove-UMSProfileAssignment.Tests.ps1 | 52 +++++++++++-------- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 37 +++++++------ 6 files changed, 114 insertions(+), 93 deletions(-) diff --git a/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 b/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 index 2b5574f..28977d7 100644 --- a/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 +++ b/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 @@ -22,7 +22,7 @@ [Parameter(Mandatory)] $WebSession, - [Parameter(Mandatory, ValueFromPipelineByPropertyName)] + [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)] [Int] $Id, @@ -59,7 +59,7 @@ Uri = $Uri Method = 'Delete' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } $SPArray = @($Id, $ReceiverId, $ReceiverType) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 5b604ca..1f0f8df 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,7 +12,7 @@ Integration Tests Config DeviceRootDirId = 502 # Devices -> PSIGEL Tests = @{ - 'Get-UMSStatus' = @( + 'Get-UMSStatus' = @( @{ RmGuiServerVersion = '6.3.130' BuildNumber = 44584 @@ -22,14 +22,14 @@ Integration Tests Config Server = 'igelrmserver:8443' } ) - 'New-UMSDeviceDirectory' = @( + 'New-UMSDeviceDirectory' = @( @{ Message = 'Directory successfully inserted.' Id = 592 Name = 'QandA' } ) - 'New-UMSDevice' = @( + 'New-UMSDevice' = @( @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' @@ -45,14 +45,14 @@ Integration Tests Config ParentId = -1 } ) - 'New-UMSProfileDirectory' = @( + 'New-UMSProfileDirectory' = @( @{ Message = 'Directory successfully inserted.' Id = 595 Name = 'Devices' } ) - 'Get-UMSFirmware' = @( + 'Get-UMSFirmware' = @( @{ Id = 1 Product = 'IGEL OS 11' @@ -66,7 +66,7 @@ Integration Tests Config FirmwareType = 'LX' } ) - 'New-UMSProfileAssignment' = @( + 'New-UMSProfileAssignment' = @( @{ Id = 538 Message = '1 asssignments successfully assigned to device <{1}>.' @@ -80,7 +80,7 @@ Integration Tests Config ReceiverType = 'tcdirectory' } ) - 'Remove-UMSDevice' = @( + 'Remove-UMSDevice' = @( @{ Id = 572 Message = 'Offline deletion successful.' @@ -90,37 +90,31 @@ Integration Tests Config Message = 'Offline deletion successful.' } ) - } - - <# - Tests = [ordered]@{ - 'Remove-UMSDeviceDirectory -Id 520 -Confirm:$false' = @( + 'Remove-UMSDeviceDirectory' = @( @{ - Message = 'Deletion successful.' Id = 520 + Message = 'Deletion successful.' } ) - 'Remove-UMSProfile -Id 542 -Confirm:$false' = @( + 'Remove-UMSProfile' = @( @{ Message = 'Deleted profile.' Id = 542 } ) - 'Remove-UMSProfileDirectory -Id 541 -Confirm:$false' = @( + 'Remove-UMSProfileDirectory' = @( @{ Message = 'Deletion successful.' Id = 541 } ) - 'Remove-UMSProfileAssignment -Id 538 -ReceiverId 505 -ReceiverType tc -Confirm:$false' = @( + 'Remove-UMSProfileAssignment' = @( @{ Message = 'deleted profile assignment.' Id = 538 - ReceiverId = 505 + ReceiverId = 577 ReceiverType = 'tc' } - ) - 'Remove-UMSProfileAssignment -Id 540 -ReceiverId 502 -ReceiverType tcdirectory -Confirm:$false' = @( @{ Message = 'deleted profile assignment.' Id = 540 @@ -128,6 +122,10 @@ Integration Tests Config ReceiverType = 'tcdirectory' } ) + } + + <# + Tests = [ordered]@{ 'Move-UMSDeviceDirectory -Id 613 -DestId 511' = @( @{ Id = 613 diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index dc347c5..ba414ea 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Remove-UMSDeviceDirectory -Id 2 Should not throw" { { Remove-UMSDeviceDirectory -Id 2 } | Should -Not -Throw @@ -86,7 +86,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Remove-UMSDeviceDirectory -Id 2 -WhatIf @@ -105,7 +105,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Remove-UMSDeviceDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSDeviceDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -119,17 +119,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDeviceDirectory[2].Id + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -140,7 +138,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = Remove-UMSDeviceDirectory } | Should Not Throw + { $Script:Result = @( + 520 | Remove-UMSDeviceDirectory + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -151,12 +151,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'Deletion successful.'" { - $Result[0].Message | Should -BeExactly 'Deletion successful.' + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDeviceDirectory')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } + } } \ No newline at end of file diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index 7be1b9a..d867607 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Remove-UMSProfile -Id 2 Should not throw" { { Remove-UMSProfile -Id 2 } | Should -Not -Throw @@ -86,7 +86,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Remove-UMSProfile -Id 2 -WhatIf @@ -105,7 +105,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Remove-UMSProfile -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSProfile -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -119,17 +119,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfile[1].Id + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -140,7 +138,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = Remove-UMSProfile } | Should Not Throw + { $Script:Result = @( + 542 | Remove-UMSProfile + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -151,12 +151,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'Deleted profile.'" { - $Result[0].Message | Should -BeExactly 'Deleted profile.' + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSProfile')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } + } } \ No newline at end of file diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index ae3b608..604d0db 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' Should not throw" { { Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should -Not -Throw @@ -136,7 +136,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tcdirectory' -WhatIf @@ -155,7 +155,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -169,21 +169,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileAssignment[1].Id - $ReceiverId = $UMS.UMSProfileAssignment[1].ReceiverId - $ReceiverType = $UMS.UMSProfileAssignment[1].ReceiverType + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:ReceiverId' = $ReceiverId - '*-UMS*:ReceiverType' = $ReceiverType - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -194,7 +188,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = Remove-UMSProfileAssignment } | Should Not Throw + { $Script:Result = @( + Remove-UMSProfileAssignment -Id 538 -ReceiverId 577 -ReceiverType tc + 540 | Remove-UMSProfileAssignment -ReceiverId 502 -ReceiverType tcdirectory + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -205,12 +202,25 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'deleted profile assignment.'" { - $Result[0].Message | Should -BeExactly 'deleted profile assignment.' + It 'Result[0].ReceiverId should have type [Int]' { + $Result[0].ReceiverId | Should -HaveType [Int] } + + It 'Result[0].ReceiverType should have type [String]' { + $Result[0].ReceiverType | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSProfileAssignment')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected + } + } } \ No newline at end of file diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 0d22b13..9f0e821 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Remove-UMSProfileDirectory -Id 2 Should not throw" { { Remove-UMSProfileDirectory -Id 2 } | Should -Not -Throw @@ -86,7 +86,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Remove-UMSProfileDirectory -Id 2 -WhatIf @@ -105,7 +105,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Remove-UMSProfileDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSProfileDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -119,17 +119,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileDirectory[3].Id + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -140,7 +138,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = Remove-UMSProfileDirectory } | Should Not Throw + { $Script:Result = 541 | Remove-UMSProfileDirectory } | Should Not Throw } It 'Result should not be null or empty' { @@ -151,12 +149,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'Deletion successful.'" { - $Result[0].Message | Should -BeExactly 'Deletion successful.' + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSProfileDirectory')) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } + } } \ No newline at end of file From fde124f71a07626fe8cee4ff275c3e06833b5961 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 29 Feb 2020 16:47:07 +0100 Subject: [PATCH 058/145] added -Force to Import-Module --- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index 604d0db..fd0563b 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { From c6ffcf3148b7e6335b1748c3330ec04d59b023eb Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 1 Mar 2020 11:26:39 +0100 Subject: [PATCH 059/145] restructured test config --- Tests/Get-UMSStatus.Tests.ps1 | 4 +- Tests/IntegrationTestsConfig.psd1 | 75 ++++++++++++++++--------- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 40 +++++++------ Tests/New-UMSDevice.Tests.ps1 | 15 +++-- Tests/New-UMSDeviceDirectory.Tests.ps1 | 12 ++-- 5 files changed, 89 insertions(+), 57 deletions(-) diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index faa0020..44e6dca 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -151,7 +151,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSStatus')) + $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSStatus'.Expected)) { New-Object psobject -Property $item } diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 1f0f8df..3e3b4f0 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,8 +12,8 @@ Integration Tests Config DeviceRootDirId = 502 # Devices -> PSIGEL Tests = @{ - 'Get-UMSStatus' = @( - @{ + 'Get-UMSStatus' = @{ + Expected = @{ RmGuiServerVersion = '6.3.130' BuildNumber = 44584 ActiveMqVersion = '5.7.0' @@ -21,30 +21,47 @@ Integration Tests Config ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' Server = 'igelrmserver:8443' } - ) - 'New-UMSDeviceDirectory' = @( - @{ + } + 'New-UMSDeviceDirectory' = @{ + Params1 = @{ + Name = 'QandA' + } + Expected = @{ Message = 'Directory successfully inserted.' - Id = 592 + #Id = 592 Name = 'QandA' } - ) - 'New-UMSDevice' = @( - @{ - Mac = '0A0000000007' - Message = 'Device successfully inserted.' - Id = 593 - Name = 'A-QA-007' - ParentId = -1 - } - @{ - Mac = '0A0000000008' - Message = 'Device successfully inserted.' - Id = 594 - Name = 'A-QA-008' - ParentId = -1 + } + 'New-UMSDevice' = @{ + Params1 = @{ + Mac = '0A0000000007' + Name = 'A-QA-007' + FirmwareId = 1 + ParentId = -1 } - ) + Params2 = @{ + Mac = '0A0000000008' + Name = 'A-QA-008' + FirmwareId = 1 + ParentId = -1 + } + Expected = @( + @{ + Mac = '0A0000000007' + Message = 'Device successfully inserted.' + #Id = 593 + Name = 'A-QA-007' + ParentId = -1 + } + @{ + Mac = '0A0000000008' + Message = 'Device successfully inserted.' + #Id = 594 + Name = 'A-QA-008' + ParentId = - 1 + } + ) + } 'New-UMSProfileDirectory' = @( @{ Message = 'Directory successfully inserted.' @@ -122,16 +139,18 @@ Integration Tests Config ReceiverType = 'tcdirectory' } ) + 'Move-UMSDeviceDirectory' = @{ + Id = 613 + DestId = 511 + Expected = @{ + Id = 613 + Message = 'successful.' + } + } } <# Tests = [ordered]@{ - 'Move-UMSDeviceDirectory -Id 613 -DestId 511' = @( - @{ - Id = 613 - Message = 'successful.' - } - ) 'Move-UMSDevice -Id 518 -DestId 514' = @( @{ Id = 518 diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index dee6c2c..68776c6 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Move-UMSDeviceDirectory -Id 2 -DestId 2 Should not throw' { { Move-UMSDeviceDirectory -Id 2 -DestId 2 } | Should -Not -Throw @@ -84,7 +84,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Move-UMSDeviceDirectory -Id 2 -DestId 2 -WhatIf @@ -103,7 +103,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It 'Move-UMSDeviceDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSDeviceDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -117,18 +117,17 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDeviceDirectory[0].Id - $DestId = $UMS.UMSDeviceDirectory[0].DestId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:DestId' = $DestId + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Id' = $Cfg.Tests.'Move-UMSDeviceDirectory'.Id + '*-UMS*:DestId' = $Cfg.Tests.'Move-UMSDeviceDirectory'.DestId + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -150,12 +149,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'successful.'" { - $Result[0].Message | Should -BeExactly 'successful.' + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $($Cfg.Tests.'Move-UMSDeviceDirectory'.Expected)) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected } + } } \ No newline at end of file diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index b808b5e..199e2f1 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -137,9 +137,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { + $Params1 = $Cfg.Tests.'New-UMSDevice'.Params1 + $Params2 = $Cfg.Tests.'New-UMSDevice'.Params2 { $Script:Result = @( - New-UMSDevice -Mac 0A0000000007 -Name "A-QA-007" -FirmwareId 1 -ParentId -1 - New-UMSDevice -Mac 0A0000000008 -Name "A-QA-008" -FirmwareId 1 -ParentId -1 + New-UMSDevice @Params1 + New-UMSDevice @Params2 ) } | Should Not Throw } @@ -168,11 +170,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDevice')) + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDevice'.Expected)) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = 'Id' + ExcludePathsNotOnExpected = $true + } } } } \ No newline at end of file diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index 7f20b5a..54e1192 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -135,7 +135,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = New-UMSDeviceDirectory -Name "QandA" } | Should Not Throw + $Params1 = $Cfg.Tests.'New-UMSDeviceDirectory'.Params1 + { $Script:Result = New-UMSDeviceDirectory @Params1 } | Should Not Throw } It 'Result should not be null or empty' { @@ -155,11 +156,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDeviceDirectory')) + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDeviceDirectory'.Expected)) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = 'Id' + ExcludePathsNotOnExpected = $true + } } } } \ No newline at end of file From 75beb0e4da658b2b5bc9253fd53516f6313a060c Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 1 Mar 2020 14:46:55 +0100 Subject: [PATCH 060/145] edited Tests --- Tests/Get-UMSFirmware.Tests.ps1 | 9 +- Tests/IntegrationTestsConfig.psd1 | 142 +++++++++++++++------- Tests/New-UMSDevice.Tests.ps1 | 4 +- Tests/New-UMSDeviceDirectory.Tests.ps1 | 4 +- Tests/New-UMSProfileAssignment.Tests.ps1 | 10 +- Tests/New-UMSProfileDirectory.Tests.ps1 | 12 +- Tests/Remove-UMSDevice.Tests.ps1 | 10 +- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 12 +- 8 files changed, 134 insertions(+), 69 deletions(-) diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index ee133cb..58aea21 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -185,11 +185,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSFirmware')) + $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSFirmware'.Expected)) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $($Cfg.Tests.'Get-UMSFirmware'.Options.ExcludedPaths) + ExcludePathsNotOnExpected = $($Cfg.Tests.'Get-UMSFirmware'.Options.ExcludePathsNotOnExpected) + } } } } \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 3e3b4f0..15c9f20 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -8,8 +8,8 @@ Integration Tests Config TCPPort = 9443 CredPath = 'C:\Credentials\UMSRmdb.cred' SecurityProtocol = 'Tls12' - ProfileRootDirId = 527 # Profiles->PSIGEL - DeviceRootDirId = 502 # Devices -> PSIGEL + ProfileRootDirId = 527 # Profiles/PSIGEL + DeviceRootDirId = 502 # Devices/PSIGEL Tests = @{ 'Get-UMSStatus' = @{ @@ -24,12 +24,16 @@ Integration Tests Config } 'New-UMSDeviceDirectory' = @{ Params1 = @{ - Name = 'QandA' + Name = 'A_QA' } Expected = @{ Message = 'Directory successfully inserted.' - #Id = 592 - Name = 'QandA' + Id = 592 + Name = 'A_QA' + } + Options = @{ + ExcludedPaths = 'Id' + ExcludePathsNotOnExpected = $true } } 'New-UMSDevice' = @{ @@ -49,70 +53,116 @@ Integration Tests Config @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' - #Id = 593 + Id = 593 Name = 'A-QA-007' ParentId = -1 } @{ Mac = '0A0000000008' Message = 'Device successfully inserted.' - #Id = 594 + Id = 594 Name = 'A-QA-008' ParentId = - 1 } ) + Options = @{ + ExcludedPaths = 'Id' + ExcludePathsNotOnExpected = $true + } } - 'New-UMSProfileDirectory' = @( - @{ + 'New-UMSProfileDirectory' = @{ + Params1 = @{ + Name = 'Devices' + } + Expected = @{ Message = 'Directory successfully inserted.' Id = 595 Name = 'Devices' } - ) - 'Get-UMSFirmware' = @( - @{ - Id = 1 - Product = 'IGEL OS 11' - Version = '11.3.100.1' - FirmwareType = 'LX' + Options = @{ + ExcludedPaths = 'Id' + ExcludePathsNotOnExpected = $true } - @{ - Id = 2 - Product = 'IGEL OS 11' - Version = '11.3.110.1' - FirmwareType = 'LX' + } + 'Get-UMSFirmware' = @{ + Expected = @( + @{ + Id = 1 + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' + } + @{ + Id = 2 + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' + } + ) + Options = @{ + ExcludedPaths = 'Id' + ExcludePathsNotOnExpected = $true } - ) - 'New-UMSProfileAssignment' = @( - @{ - Id = 538 - Message = '1 asssignments successfully assigned to device <{1}>.' - ReceiverId = 577 + } + 'New-UMSProfileAssignment' = @{ + Params1 = @{ + Id = 538 # NW_WLAN + ReceiverId = 504 # BR_HR + ReceiverType = 'tcdirectory' + } + Params2 = @{ + Id = 538 # NW_WLAN + ReceiverId = 577 # BR-MKT-003 ReceiverType = 'tc' } - @{ - Id = 538 - Message = '1 asssignments successfully assigned to device directory <{1}>.' - ReceiverId = 504 - ReceiverType = 'tcdirectory' + Expected = @( + @{ + Id = 538 + Message = '1 asssignments successfully assigned to device directory <{1}>.' + ReceiverId = 504 + ReceiverType = 'tcdirectory' + } + @{ + Id = 538 + Message = '1 asssignments successfully assigned to device <{1}>.' + ReceiverId = 577 + ReceiverType = 'tc' + } + ) + } + 'Remove-UMSDevice' = @{ + Params1 = @{ + Id = 572 # L-DIS-011 } - ) - 'Remove-UMSDevice' = @( - @{ - Id = 572 - Message = 'Offline deletion successful.' + Params2 = @{ + Id = 522 # L-DIS-012 } - @{ - Id = 522 - Message = 'Offline deletion successful.' + Expected = @( + @{ + Id = 572 + Message = 'Offline deletion successful.' + } + @{ + Id = 522 + Message = 'Offline deletion successful.' + } + ) + } + 'Remove-UMSDeviceDirectory' = @{ + Params1 = @{ + Id = 520 # L_Distribution } - ) - 'Remove-UMSDeviceDirectory' = @( - @{ - Id = 520 - Message = 'Deletion successful.' + Expected = @( + @{ + Id = 520 + Message = 'Deletion successful.' + } + ) + Options = @{ + ExcludedPaths = 'Id', 'Message' + ExcludePathsNotOnExpected = $true } - ) + } 'Remove-UMSProfile' = @( @{ Message = 'Deleted profile.' diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index 199e2f1..a6c81de 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -175,8 +175,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = 'Id' - ExcludePathsNotOnExpected = $true + ExcludedPaths = $($Cfg.Tests.'New-UMSDevice'.Options.ExcludedPaths) + ExcludePathsNotOnExpected = $($Cfg.Tests.'New-UMSDevice'.Options.ExcludePathsNotOnExpected) } } } diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index 54e1192..bfd73ce 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -161,8 +161,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = 'Id' - ExcludePathsNotOnExpected = $true + ExcludedPaths = $($Cfg.Tests.'New-UMSDeviceDirectory'.Options.ExcludedPaths) + ExcludePathsNotOnExpected = $($Cfg.Tests.'New-UMSDeviceDirectory'.Options.ExcludePathsNotOnExpected) } } } diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 2bc1cd6..4ae106f 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -191,9 +191,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { + $Params1 = $Cfg.Tests.'New-UMSProfileAssignment'.Params1 + $Params2 = $Cfg.Tests.'New-UMSProfileAssignment'.Params2 { $Script:Result = @( - New-UMSProfileAssignment -Id 538 -ReceiverId 504 -ReceiverType tcdirectory - 538 | New-UMSProfileAssignment -ReceiverId 577 -ReceiverType tc + New-UMSProfileAssignment @Params1 + New-UMSProfileAssignment @Params2 ) } | Should Not Throw } @@ -218,7 +220,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileAssignment')) + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileAssignment'.Expected)) { New-Object psobject -Property $item } diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index 4de444d..82d14d7 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -134,7 +134,8 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { - { $Script:Result = New-UMSProfileDirectory -Name "Devices" } | Should Not Throw + $Params1 = $Cfg.Tests.'New-UMSProfileDirectory'.Params1 + { $Script:Result = New-UMSProfileDirectory @Params1 } | Should Not Throw } It 'Result should not be null or empty' { @@ -154,11 +155,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileDirectory')) + $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileDirectory'.Expected)) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $($Cfg.Tests.'New-UMSProfileDirectory'.Options.ExcludedPaths) + ExcludePathsNotOnExpected = $($Cfg.Tests.'New-UMSProfileDirectory'.Options.ExcludePathsNotOnExpected) + } } } diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index 953e166..d1479b7 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -188,9 +188,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { + $Params1 = $Cfg.Tests.'Remove-UMSDevice'.Params1 + $Params2 = $Cfg.Tests.'Remove-UMSDevice'.Params2 { $Script:Result = @( - Remove-UMSDevice -Id 572 - 522 | Remove-UMSDevice + Remove-UMSDevice @Params1 + Remove-UMSDevice @Params2 ) } | Should Not Throw } @@ -207,7 +209,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDevice')) + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDevice'.Expected)) { New-Object psobject -Property $item } diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index ba414ea..aad9c3d 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -138,8 +138,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { It "doesn't throw" { + $Params1 = $Cfg.Tests.'Remove-UMSDeviceDirectory'.Params1 { $Script:Result = @( - 520 | Remove-UMSDeviceDirectory + Remove-UMSDeviceDirectory @Params1 ) } | Should Not Throw } @@ -156,11 +157,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDeviceDirectory')) + $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Expected)) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected @($Expected) -Options @{ + ExcludedPaths = $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Options.ExcludedPaths) + ExcludePathsNotOnExpected = $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Options.ExcludePathsNotOnExpected) + } } } From 1917325f22a9824acb4768094c08d01539312cff Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 1 Mar 2020 15:10:18 +0100 Subject: [PATCH 061/145] edited Tests --- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index aad9c3d..8f178b5 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -157,11 +157,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Expected)) + [array]$Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Expected)) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected @($Expected) -Options @{ + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ ExcludedPaths = $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Options.ExcludedPaths) ExcludePathsNotOnExpected = $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Options.ExcludePathsNotOnExpected) } From 1ab04bf0e25bcc9f061431002e98c19b993290b8 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 1 Mar 2020 21:53:32 +0100 Subject: [PATCH 062/145] edited Tests --- Tests/Get-UMSFirmware.Tests.ps1 | 10 +- Tests/Get-UMSStatus.Tests.ps1 | 12 +- Tests/IntegrationTestsConfig.psd1 | 146 +++++++++++++------- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 13 +- Tests/New-UMSDevice.Tests.ps1 | 12 +- Tests/New-UMSDeviceDirectory.Tests.ps1 | 13 +- Tests/New-UMSProfileAssignment.Tests.ps1 | 12 +- Tests/New-UMSProfileDirectory.Tests.ps1 | 9 +- Tests/Pester.ps1 | 33 +++-- Tests/Remove-UMSDevice.Tests.ps1 | 12 +- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 9 +- Tests/Remove-UMSProfile.Tests.ps1 | 13 +- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 14 +- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 13 +- 14 files changed, 208 insertions(+), 113 deletions(-) diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index 58aea21..c823f8a 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -160,8 +160,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - { $Script:Result = Get-UMSFirmware | Sort-Object -Property Id } | Should Not Throw + { $Script:Result = Get-UMSFirmware } | Should Not Throw } It 'Result should not be null or empty' { @@ -185,14 +187,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSFirmware'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = $($Cfg.Tests.'Get-UMSFirmware'.Options.ExcludedPaths) - ExcludePathsNotOnExpected = $($Cfg.Tests.'Get-UMSFirmware'.Options.ExcludePathsNotOnExpected) + ExcludedPaths = $TestCfg.Options.ExcludedPaths } } + } } \ No newline at end of file diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index 44e6dca..e105075 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -111,13 +111,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } - $WebSession = New-UMSAPICookie -Credential $Credential $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession + '*-UMS*:WebSession' = New-UMSAPICookie } Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { { $Script:Result = Get-UMSStatus } | Should Not Throw } @@ -151,11 +152,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Get-UMSStatus'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } + } } \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 15c9f20..001896e 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -11,8 +11,9 @@ Integration Tests Config ProfileRootDirId = 527 # Profiles/PSIGEL DeviceRootDirId = 502 # Devices/PSIGEL - Tests = @{ - 'Get-UMSStatus' = @{ + Tests = @( + @{ + Function = 'Get-UMSStatus' Expected = @{ RmGuiServerVersion = '6.3.130' BuildNumber = 44584 @@ -21,22 +22,26 @@ Integration Tests Config ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' Server = 'igelrmserver:8443' } + Options = @{ + ExcludedPaths = '' + } } - 'New-UMSDeviceDirectory' = @{ + @{ + Function = 'New-UMSDeviceDirectory' Params1 = @{ - Name = 'A_QA' + Name = 'QA' } Expected = @{ Message = 'Directory successfully inserted.' - Id = 592 - Name = 'A_QA' + Id = 593 + Name = 'QA' } Options = @{ - ExcludedPaths = 'Id' - ExcludePathsNotOnExpected = $true + #ExcludedPaths = 'Id' } } - 'New-UMSDevice' = @{ + @{ + Function = 'New-UMSDevice' Params1 = @{ Mac = '0A0000000007' Name = 'A-QA-007' @@ -53,38 +58,38 @@ Integration Tests Config @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' - Id = 593 + Id = 594 Name = 'A-QA-007' ParentId = -1 } @{ Mac = '0A0000000008' Message = 'Device successfully inserted.' - Id = 594 + Id = 595 Name = 'A-QA-008' ParentId = - 1 } ) Options = @{ - ExcludedPaths = 'Id' - ExcludePathsNotOnExpected = $true + #ExcludedPaths = 'Id' } } - 'New-UMSProfileDirectory' = @{ + @{ + Function = 'New-UMSProfileDirectory' Params1 = @{ Name = 'Devices' } Expected = @{ Message = 'Directory successfully inserted.' - Id = 595 + Id = 596 Name = 'Devices' } Options = @{ - ExcludedPaths = 'Id' - ExcludePathsNotOnExpected = $true + #ExcludedPaths = 'Id' } } - 'Get-UMSFirmware' = @{ + @{ + Function = 'Get-UMSFirmware' Expected = @( @{ Id = 1 @@ -100,11 +105,11 @@ Integration Tests Config } ) Options = @{ - ExcludedPaths = 'Id' - ExcludePathsNotOnExpected = $true + #ExcludedPaths = 'Id' } } - 'New-UMSProfileAssignment' = @{ + @{ + Function = 'New-UMSProfileAssignment' Params1 = @{ Id = 538 # NW_WLAN ReceiverId = 504 # BR_HR @@ -129,8 +134,12 @@ Integration Tests Config ReceiverType = 'tc' } ) + Options = @{ + ExcludedPaths = '' + } } - 'Remove-UMSDevice' = @{ + @{ + Function = 'Remove-UMSDevice' Params1 = @{ Id = 572 # L-DIS-011 } @@ -147,8 +156,12 @@ Integration Tests Config Message = 'Offline deletion successful.' } ) + Options = @{ + ExcludedPaths = '' + } } - 'Remove-UMSDeviceDirectory' = @{ + @{ + Function = 'Remove-UMSDeviceDirectory' Params1 = @{ Id = 520 # L_Distribution } @@ -159,45 +172,82 @@ Integration Tests Config } ) Options = @{ - ExcludedPaths = 'Id', 'Message' - ExcludePathsNotOnExpected = $true + ExcludedPaths = '' } } - 'Remove-UMSProfile' = @( - @{ + @{ + Function = 'Remove-UMSProfile' + Params1 = @{ + Id = 542 # SYS_TZ_CET + } + Expected = @{ Message = 'Deleted profile.' Id = 542 } - ) - 'Remove-UMSProfileDirectory' = @( - @{ + Options = @{ + ExcludedPaths = '' + } + } + @{ + Function = 'Remove-UMSProfileDirectory' + Params1 = @{ + Id = 541 # System + } + Expected = @{ Message = 'Deletion successful.' Id = 541 } - ) - 'Remove-UMSProfileAssignment' = @( - @{ - Message = 'deleted profile assignment.' - Id = 538 - ReceiverId = 577 + Options = @{ + ExcludedPaths = '' + } + } + @{ + Function = 'Remove-UMSProfileAssignment' + Params1 = @{ + Id = 538 # NW_WLAN + ReceiverId = 505 # BR-HR-01 ReceiverType = 'tc' } - @{ - Message = 'deleted profile assignment.' - Id = 540 - ReceiverId = 502 + Params2 = @{ + Id = 540 # SEC_PW_Root + ReceiverId = 502 # PSIGEL ReceiverType = 'tcdirectory' } - ) - 'Move-UMSDeviceDirectory' = @{ - Id = 613 - DestId = 511 - Expected = @{ - Id = 613 - Message = 'successful.' + Expected = @( + @{ + Message = 'deleted profile assignment.' + Id = 538 + ReceiverId = 505 + ReceiverType = 'tc' + } + @{ + Message = 'deleted profile assignment.' + Id = 540 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + } + ) + Options = @{ + ExcludedPaths = '' } } - } + @{ + Function = 'Move-UMSDeviceDirectory' + Params1 = @{ + Id = 593 # QA + DestId = 511 # Augsburg + } + Expected = @( + @{ + Id = 593 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ) <# Tests = [ordered]@{ diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index 68776c6..26039dc 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -125,8 +125,6 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:Computername' = $Cfg.Computername '*-UMS*:TCPPort' = $Cfg.TCPPort '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol - '*-UMS*:Id' = $Cfg.Tests.'Move-UMSDeviceDirectory'.Id - '*-UMS*:DestId' = $Cfg.Tests.'Move-UMSDeviceDirectory'.DestId '*-UMS*:Confirm' = $False } @@ -137,8 +135,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - { $Script:Result = Move-UMSDeviceDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = Move-UMSDeviceDirectory @Params1 } | Should Not Throw } It 'Result should not be null or empty' { @@ -154,11 +155,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Move-UMSDeviceDirectory'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index a6c81de..bf1fffa 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -136,9 +136,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - $Params1 = $Cfg.Tests.'New-UMSDevice'.Params1 - $Params2 = $Cfg.Tests.'New-UMSDevice'.Params2 + $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 { $Script:Result = @( New-UMSDevice @Params1 New-UMSDevice @Params2 @@ -170,14 +172,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDevice'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = $($Cfg.Tests.'New-UMSDevice'.Options.ExcludedPaths) - ExcludePathsNotOnExpected = $($Cfg.Tests.'New-UMSDevice'.Options.ExcludePathsNotOnExpected) + ExcludedPaths = $TestCfg.Options.ExcludedPaths } } + } } \ No newline at end of file diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index bfd73ce..861dc1e 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -127,15 +127,16 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } - $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession + '*-UMS*:WebSession' = New-UMSAPICookie } Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - $Params1 = $Cfg.Tests.'New-UMSDeviceDirectory'.Params1 + $Params1 = $TestCfg.Params1 { $Script:Result = New-UMSDeviceDirectory @Params1 } | Should Not Throw } @@ -156,14 +157,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSDeviceDirectory'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = $($Cfg.Tests.'New-UMSDeviceDirectory'.Options.ExcludedPaths) - ExcludePathsNotOnExpected = $($Cfg.Tests.'New-UMSDeviceDirectory'.Options.ExcludePathsNotOnExpected) + ExcludedPaths = $TestCfg.Options.ExcludedPaths } } + } } \ No newline at end of file diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 4ae106f..37276ba 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -190,9 +190,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - $Params1 = $Cfg.Tests.'New-UMSProfileAssignment'.Params1 - $Params2 = $Cfg.Tests.'New-UMSProfileAssignment'.Params2 + $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 { $Script:Result = @( New-UMSProfileAssignment @Params1 New-UMSProfileAssignment @Params2 @@ -220,11 +222,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileAssignment'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index 82d14d7..efc3b40 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -133,8 +133,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - $Params1 = $Cfg.Tests.'New-UMSProfileDirectory'.Params1 + $Params1 = $TestCfg.Params1 { $Script:Result = New-UMSProfileDirectory @Params1 } | Should Not Throw } @@ -155,13 +157,12 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'New-UMSProfileDirectory'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = $($Cfg.Tests.'New-UMSProfileDirectory'.Options.ExcludedPaths) - ExcludePathsNotOnExpected = $($Cfg.Tests.'New-UMSProfileDirectory'.Options.ExcludePathsNotOnExpected) + ExcludedPaths = $TestCfg.Options.ExcludedPaths } } diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 31434cd..83cc1b0 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -3,8 +3,8 @@ param [ValidateSet('All', 'UnitTests', 'IntegrationTests')] [String] #$Tags = 'All' - $Tags = 'UnitTests' - #$Tags = 'IntegrationTests' + #$Tags = 'UnitTests' + $Tags = 'IntegrationTests' ) $ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) @@ -12,16 +12,20 @@ $ModuleName = Split-Path $ModuleRoot -Leaf $OutputPath = '{0}\Tests\Data' -f $ProjectRoot +<# $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $ProjectRoot) | ConvertFrom-Json - +#> +$Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +$Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ - '*:Computername' = $UMS.Computername + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername #'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMS.Credpath - '*-UMS*:TCPPort' = [Int]$UMS.TCPPort - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Confirm' = $false + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $false #'Invoke-Pester:Show' = 'Failed' } @@ -58,24 +62,26 @@ $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = (New-UMSAPICookie) } -Invoke-Pester -Script ('{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $ModuleName) -OutputFile ('{0}\{1}.Tests.xml' -f $OutputPath, $ModuleName) +#Invoke-Pester -Script ('{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $ModuleName) -OutputFile ('{0}\{1}.Tests.xml' -f $OutputPath, $ModuleName) -foreach ($Function in $UMS.TestOrder.Public) +foreach ($Test in $Cfg.Tests) { + #$Test.Function + #<# $IVPParams = @{ - Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Function - OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Function + Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.Function + OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.Function } switch ($Tags) { 'All' { - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Function + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function } 'UnitTests' { $IVPParams.Tag = 'UnitTests' - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Function + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function } 'IntegrationTests' { @@ -83,4 +89,5 @@ foreach ($Function in $UMS.TestOrder.Public) } } Invoke-Pester @IVPParams + #> } diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index d1479b7..cf61302 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -187,9 +187,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - $Params1 = $Cfg.Tests.'Remove-UMSDevice'.Params1 - $Params2 = $Cfg.Tests.'Remove-UMSDevice'.Params2 + $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 { $Script:Result = @( Remove-UMSDevice @Params1 Remove-UMSDevice @Params2 @@ -209,11 +211,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDevice'.Expected)) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 8f178b5..75ba2c2 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -137,8 +137,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - $Params1 = $Cfg.Tests.'Remove-UMSDeviceDirectory'.Params1 + $Params1 = $TestCfg.Params1 { $Script:Result = @( Remove-UMSDeviceDirectory @Params1 ) } | Should Not Throw @@ -157,13 +159,12 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - [array]$Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Expected)) + [array]$Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Options.ExcludedPaths) - ExcludePathsNotOnExpected = $($Cfg.Tests.'Remove-UMSDeviceDirectory'.Options.ExcludePathsNotOnExpected) + ExcludedPaths = $TestCfg.Options.ExcludedPaths } } diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index d867607..a35f8f7 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -137,9 +137,12 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { + $Params1 = $TestCfg.Params1 { $Script:Result = @( - 542 | Remove-UMSProfile + Remove-UMSProfile @Params1 ) } | Should Not Throw } @@ -156,11 +159,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSProfile')) + [array]$Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index fd0563b..8161948 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -187,10 +187,14 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { + $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 { $Script:Result = @( - Remove-UMSProfileAssignment -Id 538 -ReceiverId 577 -ReceiverType tc - 540 | Remove-UMSProfileAssignment -ReceiverId 502 -ReceiverType tcdirectory + Remove-UMSProfileAssignment @Params1 + Remove-UMSProfileAssignment @Params2 ) } | Should Not Throw } @@ -215,11 +219,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSProfileAssignment')) + [array]$Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 9f0e821..788370f 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -137,8 +137,11 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName All" { + $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + It "doesn't throw" { - { $Script:Result = 541 | Remove-UMSProfileDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = Remove-UMSProfileDirectory @Params1 } | Should Not Throw } It 'Result should not be null or empty' { @@ -154,11 +157,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $($Cfg.Tests.'Remove-UMSProfileDirectory')) + $Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } - Assert-Equivalent -Actual $Result -Expected $Expected + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } From 97080ac77c8a1def95ad5ff30cd2ba6cb2ba1b54 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 2 Mar 2020 15:58:23 +0100 Subject: [PATCH 063/145] Update IntegrationTestsConfig.psd1 --- Tests/IntegrationTestsConfig.psd1 | 355 +++++++++++++++++++++++++----- 1 file changed, 297 insertions(+), 58 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 001896e..e399586 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -247,75 +247,314 @@ Integration Tests Config ExcludedPaths = '' } } - ) - - <# - Tests = [ordered]@{ - 'Move-UMSDevice -Id 518 -DestId 514' = @( - @{ - Id = 518 - Message = 'successful.' + ##hier + @{ + Function = 'Move-UMSDevice' + Params1 = @{ + Id = 518 # ??? + DestId = 514 # ??? } - ) - '617, 621 | Move-UMSDevice -DestId 613' = @( - @{ - Id = 617 #dynamisch - Message = 'successful.' + Expected = @( + @{ + Id = 518 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' } - @{ - Id = 621 # dynamisch - Message = 'successful.' + } + @{ + Function = 'Move-UMSDevice' + Params1 = @{ + Id = 617 # ??? + DestId = 613 # ??? } - ) - '517 | Move-UMSDeviceDirectory -DestId 503' = @( - @{ - Id = 517 - Message = 'successful.' + Params2 = @{ + Id = 621 # ??? + DestId = 613 # ??? } - ) - 'Move-UMSProfile -Id 535 -DestId 534' = @( - @{ - Id = 535 - Message = 'successful' + Expected = @( + @{ + Id = 617 + Message = 'successful.' + } + @{ + Id = 621 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' } - ) - 'Move-UMSProfileDirectory -Id 534 -DestId 527' = @( - @{ - Id = 535 - Message = 'successful' + } + @{ + Function = 'Move-UMSDeviceDirectory' + Params1 = @{ + Id = 517 # ??? + DestId = 503 # ??? } - ) - 'Update-UMSDeviceDirectory -Id 517 -Name "Distribution"' = @( - @{ - Message = 'Updated directory successfully.' - Id = 517 + Expected = @( + @{ + Id = 517 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' } - ) - ' Update-UMSDevice -Id 578 -Name "BR-DIS-010"' = @( - @{ - Message = 'Update successful.' - Id = 578 + } + @{ + Function = 'Move-UMSProfile' + Params1 = @{ + Id = 535 # ??? + DestId = 534 # ??? } - ) - 'Update-UMSDevice -Id 518 -Name "A-DEV-009"' = @( - @{ - Message = 'Update successful.' - Id = 518 + Expected = @( + @{ + Id = 535 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' } - ) - #Origin rename to "PRO_NW_LNG_DE" - 'Update-UMSProfile -Id 535 -Name "PRO_LNG_DE"' = @( - @{ - Message = 'Update successful.' - Id = 535 + } + @{ + Function = 'Move-UMSProfileDirectory' + Params1 = @{ + Id = 534 # ??? + DestId = 527 # ??? } - ) - 'Update-UMSProfileDirectory -Id 534 -Name "User Interface"' = @( - @{ - Message = 'Updated directory successfully.' - Id = 534 + Expected = @( + @{ + Id = 534 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' } - ) + } + @{ + Function = 'Update-UMSDeviceDirectory' + Params1 = @{ + Id = 517 # ??? + Name = 'Distribution' # ??? + } + Expected = @( + @{ + Id = 517 + Message = 'Updated directory successfully.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + @{ + Function = 'Update-UMSDevice' + Params1 = @{ + Id = 578 # ??? + Name = 'BR-DIS-010' # ??? + } + Expected = @( + @{ + Id = 578 + Message = 'Update successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + @{ + Function = 'Update-UMSDevice' + Params1 = @{ + Id = 578 # ??? + Name = 'BR-DIS-010' # ??? + } + Params2 = @{ + Id = 518 # ??? + Name = 'A-DEV-009' # ??? + } + Expected = @( + @{ + Id = 578 + Message = 'Update successful.' + } + @{ + Id = 518 + Message = 'Update successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + @{ + Function = 'Update-UMSProfile' + Params1 = @{ + Id = 535 # ??? #Origin rename to "NW_LNG_DE" + Name = 'LNG_DE' # ??? + } + Expected = @( + @{ + Id = 535 + Message = 'Update successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + @{ + Function = 'Update-UMSProfileDirectory' + Params1 = @{ + Id = 534 # ??? + Name = 'User Interface' # ??? + } + Expected = @( + @{ + Id = 534 + Message = 'Updated directory successfully.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + <# + # with Parametersets + @{ + Function = 'Get-UMSDevice' + ParameterSets = @( + @{ + #'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' + ParameterSet = 'Default' + Params1 = @{ + } + Expected = @( + @{ + Id = 505 + ObjectType = 'tc' + UnitId = '0A0000000001' + Mac = '0A0000000001' + Name = 'BR-HR-001' + ParentId = 504 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 507 + ObjectType = 'tc' + UnitId = '0A0000000002' + Mac = '0A0000000002' + Name = 'BR-HR-002' + ParentId = 504 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + @{ + ParameterSet = 'Details' + Params1 = @{ + Id = 518 # ??? + Filter = 'details' + } + Expected = @( + @{ + Id = 518 + ObjectType = 'tc' + UnitId = '0A0000000009' + Mac = '0A0000000009' + Name = 'A-DEV-009' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + NetworkName = '' + Site = '' + Comment = '' + Department = '' + CostCenter = '' + AssetID = '' + InServiceDate = '' + SerialNumber = '' + ProductId = '' + CpuSpeed = 0 + CpuType = '' + DeviceType = '' + DeviceSerialNumber = '' + OsType = '' + FlashSize = 0 + MemorySize = 0 + NetworkSpeed = 0 + GraphicsChipset0 = '' + GraphicsChipset1 = '' + MonitorVendor1 = '' + MonitorModel1 = '' + MonitorSerialnumber1 = '' + MonitorSize1 = 0 + MonitorNativeResolution1 = '' + Monitor1YearOfManufacture = 0 + Monitor1WeekOfManufacture = 0 + MonitorVendor2 = '' + MonitorModel2 = '' + MonitorSerialnumber2 = '' + MonitorSize2 = 0 + MonitorNativeResolution2 = '' + Monitor2YearOfManufacture = 0 + Monitor2WeekOfManufacture = 0 + BiosVendor = '' + BiosVersion = '' + TotalUsagetime = -1 + TotalUptime = -1 + BatteryLevel = -1 + LastBootTime = '' + BiosDate = '' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + @{ + ParameterSet = 'Online' + Params1 = @{ + Id = 578 # ??? + Filter = 'online' + } + Expected = @( + @{ + Id = 578 + ObjectType = tc + UnitId = '0A0000000010' + Mac = '0A0000000010' + Name = 'BR-DIS-010' + ParentId = 517 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + Online = 'False' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ) + } + #> + ) + <# + Tests = [ordered]@{ 'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' = @( @{ Id = 505 From b4bf5816875c9ce2a3d2d52056a796ea485406d5 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 2 Mar 2020 16:11:53 +0100 Subject: [PATCH 064/145] Update IntegrationTestsConfig.psd1 --- Tests/IntegrationTestsConfig.psd1 | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index e399586..f9cec2c 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -428,13 +428,12 @@ Integration Tests Config # with Parametersets @{ Function = 'Get-UMSDevice' - ParameterSets = @( - @{ + ParameterSets = @{ + Default = @{ #'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' - ParameterSet = 'Default' - Params1 = @{ + Params1 = @{ } - Expected = @( + Expected = @( @{ Id = 505 ObjectType = 'tc' @@ -458,17 +457,16 @@ Integration Tests Config MovedToBin = 'False' } ) - Options = @{ + Options = @{ ExcludedPaths = '' } } - @{ - ParameterSet = 'Details' - Params1 = @{ + Details = @{ + Params1 = @{ Id = 518 # ??? Filter = 'details' } - Expected = @( + Expected = @( @{ Id = 518 ObjectType = 'tc' @@ -521,17 +519,16 @@ Integration Tests Config BiosDate = '' } ) - Options = @{ + Options = @{ ExcludedPaths = '' } } - @{ - ParameterSet = 'Online' - Params1 = @{ + Online = @{ + Params1 = @{ Id = 578 # ??? Filter = 'online' } - Expected = @( + Expected = @( @{ Id = 578 ObjectType = tc @@ -545,11 +542,11 @@ Integration Tests Config Online = 'False' } ) - Options = @{ + Options = @{ ExcludedPaths = '' } } - ) + } } #> ) From 64c8d070da3f85da424a2505d621b62ac0b8438a Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 7 Mar 2020 11:24:45 +0100 Subject: [PATCH 065/145] working on Tests --- Tests/Get-UMSFirmware.Tests.ps1 | 4 +- Tests/Get-UMSStatus.Tests.ps1 | 4 +- Tests/IntegrationTestsConfig.psd1 | 561 +++++++++++--------- Tests/Move-UMSDevice.Tests.ps1 | 52 +- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 12 +- Tests/Move-UMSProfile.Tests.ps1 | 45 +- Tests/New-UMSDevice.Tests.ps1 | 4 +- Tests/New-UMSDeviceDirectory.Tests.ps1 | 4 +- Tests/New-UMSProfileAssignment.Tests.ps1 | 4 +- Tests/New-UMSProfileDirectory.Tests.ps1 | 4 +- Tests/Remove-UMSDevice.Tests.ps1 | 4 +- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 4 +- Tests/Remove-UMSProfile.Tests.ps1 | 4 +- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 4 +- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 4 +- 15 files changed, 395 insertions(+), 319 deletions(-) diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index c823f8a..64499d0 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -158,9 +158,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = Get-UMSFirmware } | Should Not Throw diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index e105075..15b3e58 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -115,9 +115,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = New-UMSAPICookie } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = Get-UMSStatus } | Should Not Throw diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index f9cec2c..b45ef61 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -13,313 +13,362 @@ Integration Tests Config Tests = @( @{ - Function = 'Get-UMSStatus' - Expected = @{ - RmGuiServerVersion = '6.3.130' - BuildNumber = 44584 - ActiveMqVersion = '5.7.0' - DerbyVersion = '10.12.1.1' - ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' - Server = 'igelrmserver:8443' - } - Options = @{ - ExcludedPaths = '' - } - } - @{ - Function = 'New-UMSDeviceDirectory' - Params1 = @{ - Name = 'QA' - } - Expected = @{ - Message = 'Directory successfully inserted.' - Id = 593 - Name = 'QA' - } - Options = @{ - #ExcludedPaths = 'Id' - } - } - @{ - Function = 'New-UMSDevice' - Params1 = @{ - Mac = '0A0000000007' - Name = 'A-QA-007' - FirmwareId = 1 - ParentId = -1 - } - Params2 = @{ - Mac = '0A0000000008' - Name = 'A-QA-008' - FirmwareId = 1 - ParentId = -1 - } - Expected = @( - @{ - Mac = '0A0000000007' - Message = 'Device successfully inserted.' - Id = 594 - Name = 'A-QA-007' - ParentId = -1 - } - @{ - Mac = '0A0000000008' - Message = 'Device successfully inserted.' - Id = 595 - Name = 'A-QA-008' - ParentId = - 1 + Function = 'Get-UMSStatus' + ParameterSets = @{ + Default = @{ + Expected = @{ + RmGuiServerVersion = '6.3.130' + BuildNumber = 44584 + ActiveMqVersion = '5.7.0' + DerbyVersion = '10.12.1.1' + ServerUuid = 'f30fb3a2-37d4-4cbb-b884-4f4060d3160e' + Server = 'igelrmserver:8443' + } + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - #ExcludedPaths = 'Id' } } @{ - Function = 'New-UMSProfileDirectory' - Params1 = @{ - Name = 'Devices' - } - Expected = @{ - Message = 'Directory successfully inserted.' - Id = 596 - Name = 'Devices' - } - Options = @{ - #ExcludedPaths = 'Id' + Function = 'New-UMSDeviceDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Name = 'QA' + } + Expected = @{ + Message = 'Directory successfully inserted.' + Id = 593 + Name = 'QA' + } + Options = @{ + #ExcludedPaths = 'Id' + } + } } } @{ - Function = 'Get-UMSFirmware' - Expected = @( - @{ - Id = 1 - Product = 'IGEL OS 11' - Version = '11.3.100.1' - FirmwareType = 'LX' - } - @{ - Id = 2 - Product = 'IGEL OS 11' - Version = '11.3.110.1' - FirmwareType = 'LX' + Function = 'New-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Mac = '0A0000000007' + Name = '007' + FirmwareId = 1 + ParentId = -1 + } + Params2 = @{ + Mac = '0A0000000008' + Name = '008' + FirmwareId = 1 + ParentId = -1 + } + Expected = @( + @{ + Mac = '0A0000000007' + Message = 'Device successfully inserted.' + Id = 594 + Name = '007' + ParentId = -1 + } + @{ + Mac = '0A0000000008' + Message = 'Device successfully inserted.' + Id = 595 + Name = '008' + ParentId = - 1 + } + ) + Options = @{ + #ExcludedPaths = 'Id' + } } - ) - Options = @{ - #ExcludedPaths = 'Id' } } @{ - Function = 'New-UMSProfileAssignment' - Params1 = @{ - Id = 538 # NW_WLAN - ReceiverId = 504 # BR_HR - ReceiverType = 'tcdirectory' - } - Params2 = @{ - Id = 538 # NW_WLAN - ReceiverId = 577 # BR-MKT-003 - ReceiverType = 'tc' - } - Expected = @( - @{ - Id = 538 - Message = '1 asssignments successfully assigned to device directory <{1}>.' - ReceiverId = 504 - ReceiverType = 'tcdirectory' - } - @{ - Id = 538 - Message = '1 asssignments successfully assigned to device <{1}>.' - ReceiverId = 577 - ReceiverType = 'tc' + Function = 'New-UMSProfileDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Name = 'Devices' + } + Expected = @{ + Message = 'Directory successfully inserted.' + Id = 596 + Name = 'Devices' + } + Options = @{ + #ExcludedPaths = 'Id' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Remove-UMSDevice' - Params1 = @{ - Id = 572 # L-DIS-011 - } - Params2 = @{ - Id = 522 # L-DIS-012 - } - Expected = @( - @{ - Id = 572 - Message = 'Offline deletion successful.' - } - @{ - Id = 522 - Message = 'Offline deletion successful.' + Function = 'Get-UMSFirmware' + ParameterSets = @{ + Default = @{ + Expected = @( + @{ + Id = 1 + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' + } + @{ + Id = 2 + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' + } + ) + Options = @{ + #ExcludedPaths = 'Id' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Remove-UMSDeviceDirectory' - Params1 = @{ - Id = 520 # L_Distribution - } - Expected = @( - @{ - Id = 520 - Message = 'Deletion successful.' + Function = 'New-UMSProfileAssignment' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 538 # NW_WLAN + ReceiverId = 504 # BR_HR + ReceiverType = 'tcdirectory' + } + Params2 = @{ + Id = 538 # NW_WLAN + ReceiverId = 577 # BR-MKT-003 + ReceiverType = 'tc' + } + Expected = @( + @{ + Id = 538 + Message = '1 asssignments successfully assigned to device directory <{1}>.' + ReceiverId = 504 + ReceiverType = 'tcdirectory' + } + @{ + Id = 538 + Message = '1 asssignments successfully assigned to device <{1}>.' + ReceiverId = 577 + ReceiverType = 'tc' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Remove-UMSProfile' - Params1 = @{ - Id = 542 # SYS_TZ_CET - } - Expected = @{ - Message = 'Deleted profile.' - Id = 542 - } - Options = @{ - ExcludedPaths = '' + Function = 'Remove-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 572 # L-DIS-011 + } + Params2 = @{ + Id = 522 # L-DIS-012 + } + Expected = @( + @{ + Id = 572 + Message = 'Offline deletion successful.' + } + @{ + Id = 522 + Message = 'Offline deletion successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } } } @{ - Function = 'Remove-UMSProfileDirectory' - Params1 = @{ - Id = 541 # System - } - Expected = @{ - Message = 'Deletion successful.' - Id = 541 - } - Options = @{ - ExcludedPaths = '' + Function = 'Remove-UMSDeviceDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 520 # L_Distribution + } + Expected = @( + @{ + Id = 520 + Message = 'Deletion successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } + } } } @{ - Function = 'Remove-UMSProfileAssignment' - Params1 = @{ - Id = 538 # NW_WLAN - ReceiverId = 505 # BR-HR-01 - ReceiverType = 'tc' - } - Params2 = @{ - Id = 540 # SEC_PW_Root - ReceiverId = 502 # PSIGEL - ReceiverType = 'tcdirectory' - } - Expected = @( - @{ - Message = 'deleted profile assignment.' - Id = 538 - ReceiverId = 505 - ReceiverType = 'tc' - } - @{ - Message = 'deleted profile assignment.' - Id = 540 - ReceiverId = 502 - ReceiverType = 'tcdirectory' + Function = 'Remove-UMSProfile' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 542 # SYS_TZ_CET + } + Expected = @{ + Message = 'Deleted profile.' + Id = 542 + } + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Move-UMSDeviceDirectory' - Params1 = @{ - Id = 593 # QA - DestId = 511 # Augsburg - } - Expected = @( - @{ - Id = 593 - Message = 'successful.' + Function = 'Remove-UMSProfileDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 541 # System + } + Expected = @{ + Message = 'Deletion successful.' + Id = 541 + } + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } - ##hier @{ - Function = 'Move-UMSDevice' - Params1 = @{ - Id = 518 # ??? - DestId = 514 # ??? - } - Expected = @( - @{ - Id = 518 - Message = 'successful.' + Function = 'Remove-UMSProfileAssignment' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 538 # NW_WLAN + ReceiverId = 505 # BR-HR-01 + ReceiverType = 'tc' + } + Params2 = @{ + Id = 540 # SEC_PW_Root + ReceiverId = 502 # PSIGEL + ReceiverType = 'tcdirectory' + } + Expected = @( + @{ + Message = 'deleted profile assignment.' + Id = 538 + ReceiverId = 505 + ReceiverType = 'tc' + } + @{ + Message = 'deleted profile assignment.' + Id = 540 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Move-UMSDevice' - Params1 = @{ - Id = 617 # ??? - DestId = 613 # ??? - } - Params2 = @{ - Id = 621 # ??? - DestId = 613 # ??? - } - Expected = @( - @{ - Id = 617 - Message = 'successful.' - } - @{ - Id = 621 - Message = 'successful.' + Function = 'Move-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 518 # L-DEV-009 + DestId = 514 # A_Development + } + Params2 = @{ + Id = 578 # L-DEV-010 + DestId = 514 # A_Development + } + Params3 = @{ + Id = 594 # 007 + DestId = 593 # QA + } + Params4 = @{ + Id = 595 # 008 + DestId = 593 # QA + } + Expected = @( + @{ + Id = 518 + Message = 'successful.' + } + @{ + Id = 578 + Message = 'successful.' + } + @{ + Id = 594 + Message = 'successful.' + } + @{ + Id = 595 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Move-UMSDeviceDirectory' - Params1 = @{ - Id = 517 # ??? - DestId = 503 # ??? - } - Expected = @( - @{ - Id = 517 - Message = 'successful.' + Function = 'Move-UMSDeviceDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 593 # QA + DestId = 511 # Augsburg + } + Params2 = @{ + Id = 517 # L_Development + DestId = 503 # Bremen + } + Expected = @( + @{ + Id = 593 + Message = 'successful.' + } + @{ + Id = 517 + Message = 'successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Move-UMSProfile' - Params1 = @{ - Id = 535 # ??? - DestId = 534 # ??? - } - Expected = @( - @{ - Id = 535 - Message = 'successful.' + Function = 'Move-UMSProfile' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 535 # UI_LNG_DE + DestId = 534 # User Interface + } + Expected = @( + @{ + Id = 535 + Message = 'successful' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } + ##hier + <# @{ Function = 'Move-UMSProfileDirectory' Params1 = @{ @@ -424,6 +473,8 @@ Integration Tests Config ExcludedPaths = '' } } + #> + ### neu: <# # with Parametersets @{ diff --git a/Tests/Move-UMSDevice.Tests.ps1 b/Tests/Move-UMSDevice.Tests.ps1 index 02e4cea..171eaf9 100644 --- a/Tests/Move-UMSDevice.Tests.ps1 +++ b/Tests/Move-UMSDevice.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Move-UMSDevice -Id 2 -DestId 2 Should not throw' { { Move-UMSDevice -Id 2 -DestId 2 } | Should -Not -Throw @@ -84,7 +84,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Move-UMSDevice -Id 2 -DestId 2 -WhatIf @@ -103,7 +103,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It 'Move-UMSDevice -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSDevice -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -117,18 +117,14 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[0].Id - $DestId = $UMS.UMSDevice[0].DestId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:DestId' = $DestId + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } $WebSession = New-UMSAPICookie @@ -136,10 +132,21 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Move-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 + $Params3 = $TestCfg.Params3 + $Params4 = $TestCfg.Params4 + { $Script:Result = @( + Move-UMSDevice @Params1 + Move-UMSDevice @Params2 + Move-UMSDevice @Params3 + Move-UMSDevice @Params4 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -150,12 +157,19 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'successful.'" { - $Result[0].Message | Should -BeExactly 'successful.' + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } + } } \ No newline at end of file diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index 26039dc..69c2391 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -133,13 +133,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 - { $Script:Result = Move-UMSDeviceDirectory @Params1 } | Should Not Throw + $Params2 = $TestCfg.Params2 + { $Script:Result = @( + Move-UMSDeviceDirectory @Params1 + Move-UMSDeviceDirectory @Params2 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -155,7 +159,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { } It "Result should be Equivalent to Expected" { - $Expected = foreach ($item In $TestCfg.Expected) + [array]$Expected = foreach ($item In $TestCfg.Expected) { New-Object psobject -Property $item } diff --git a/Tests/Move-UMSProfile.Tests.ps1 b/Tests/Move-UMSProfile.Tests.ps1 index 62b4740..1a8f464 100644 --- a/Tests/Move-UMSProfile.Tests.ps1 +++ b/Tests/Move-UMSProfile.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Move-UMSProfile -Id 2 -DestId 2 Should not throw' { { Move-UMSProfile -Id 2 -DestId 2 } | Should -Not -Throw @@ -83,7 +83,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Move-UMSProfile -Id 2 -DestId 2 -WhatIf @@ -102,7 +102,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It 'Move-UMSProfile -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSProfile -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -116,18 +116,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfile[0].Id - $DestId = $UMS.UMSProfile[0].DestId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:DestId' = $DestId + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -135,10 +132,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Move-UMSProfile } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = Move-UMSProfile @Params1 } | Should Not Throw } It 'Result should not be null or empty' { @@ -149,12 +149,19 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'successful.'" { - $Result[0].Message | Should -BeExactly 'successful' + It "Result should be Equivalent to Expected" { + $Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } + } } \ No newline at end of file diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index bf1fffa..b01a2ef 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -134,9 +134,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index 861dc1e..8a3f27b 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -131,9 +131,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = New-UMSAPICookie } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 37276ba..8e7e672 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -188,9 +188,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index efc3b40..b9926ba 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -131,9 +131,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index cf61302..9500c1d 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -185,9 +185,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 75ba2c2..846c7a3 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -135,9 +135,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index a35f8f7..7a2f294 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -135,9 +135,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index 8161948..df772f8 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -185,9 +185,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 788370f..04d32cf 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -135,9 +135,9 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { - $TestCfg = ($Cfg.Tests).where{ $_.Function -eq $FunctionName } + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 From 8bc8fdd2dacd62317ccdbca839dbd040d5e6b590 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 7 Mar 2020 16:15:57 +0100 Subject: [PATCH 066/145] working on Tests --- Scripts/Test.ps1 | 13 +- Tests/Get-UMSDevice.Tests.ps1 | 145 ++- Tests/Get-UMSDeviceDirectory.Tests.ps1 | 96 +- Tests/Get-UMSProfile.Tests.ps1 | 54 +- Tests/Get-UMSProfileAssignment.Tests.ps1 | 90 +- Tests/Get-UMSProfileDirectory.Tests.ps1 | 99 +- Tests/IntegrationTestsConfig.psd1 | 1004 ++++++++++---------- Tests/Move-UMSProfileDirectory.Tests.ps1 | 47 +- Tests/Update-UMSDevice.Tests.ps1 | 50 +- Tests/Update-UMSDeviceDirectory.Tests.ps1 | 47 +- Tests/Update-UMSProfile.Tests.ps1 | 48 +- Tests/Update-UMSProfileDirectory.Tests.ps1 | 48 +- 12 files changed, 1037 insertions(+), 704 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 739be0d..2ca508d 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -1,13 +1,16 @@ +Import-Module C:\GitHub\PSIGEL\PSIGEL\PSIGEL.psd1 -Force $UMSCredPath = 'C:\Credentials\UmsRmdb.cred' $PSDefaultParameterValues = @{ 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath - '*-UMS*:Computername' = '192.168.56.1' + '*-UMS*:Computername' = 'igelrmserver' '*-UMS*:TCPPort' = 9443 #'*-UMS*:SecurityProtocol' = 'Tls' } + +$WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = (New-UMSAPICookie) + '*-UMS*:WebSession' = $WebSession } $Result = '' @@ -15,12 +18,12 @@ $Result = '' #$Result = Get-UMSProfileDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2 #$Result = (Get-UMSProfileDirectory -Id 533 -Filter children).DirectoryChildren #$Result = (Get-UMSDeviceAssignment -Id 577).Count -$Result = Get-UMSDevice -$Result1 = Get-UMSDevice | Select-Object -First 9 +$Result = Get-UMSProfileAssignment -Id 538 #-Directory $Result +#($Result[0].MovedToBin).Gettype() -Assert-Equivalent -Actual $Result -Expected $Result1 <# +Assert-Equivalent -Actual $Result -Expected $Result1 $Result = New-UMSDeviceDirectory -Name 'QandA' # 01 #> \ No newline at end of file diff --git a/Tests/Get-UMSDevice.Tests.ps1 b/Tests/Get-UMSDevice.Tests.ps1 index 1a71f78..f43d704 100644 --- a/Tests/Get-UMSDevice.Tests.ps1 +++ b/Tests/Get-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSDevice Should not throw' { { Get-UMSDevice } | Should -Not -Throw @@ -63,7 +63,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDevice @@ -117,7 +117,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { links = '{}' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDevice -Id 2 @@ -171,7 +171,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { objectType = 'tc' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDevice -Id 2 -Filter online @@ -228,7 +228,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { objectType = 'tc' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDevice -Id 2 -Filter shadow @@ -309,7 +309,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { objectType = 'tc' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDevice -Id 2 -Filter details @@ -394,7 +394,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { objectType = 'tc' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDevice -Id 2 -Filter details @@ -434,7 +434,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSDevice } | should throw 'Error' @@ -448,48 +448,135 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[0].Id - $Mac = $UMS.UMSDevice[0].Mac + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + + It "doesn't throw" { + { $Script:Result = @( + Get-UMSDevice + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + + Context "ParameterSetName Details" { + + $Script:Result = '' + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Details + + It "doesn't throw" { + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSDevice @Params1 + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + + Context "ParameterSetName Online" { + + $Script:Result = '' + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Online It "doesn't throw" { - { $Script:Result = Get-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSDevice @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.Id should be exactly $Id" { - $Result.Id | Should -BeExactly $Id + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] } - It 'Result.Mac should have type [String]' { - $Result.Mac | Should -HaveType [String] + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] } - It "Result.Mac should be exactly $Mac" { - $Result.Mac | Should -BeExactly $Mac + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/Get-UMSDeviceDirectory.Tests.ps1 b/Tests/Get-UMSDeviceDirectory.Tests.ps1 index d4f22c4..f53c851 100644 --- a/Tests/Get-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSDeviceDirectory Should not throw' { { Get-UMSDeviceDirectory } | Should -Not -Throw @@ -149,7 +149,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { objectType = 'tcdirectory' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSDeviceDirectory -Id 2 -Filter children @@ -189,7 +189,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSDeviceDirectory } | should throw 'Error' @@ -203,48 +203,96 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDeviceDirectory[0].Id - $Name = $UMS.UMSDeviceDirectory[0].Name + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + + It "doesn't throw" { + { $Script:Result = @( + Get-UMSDeviceDirectory + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + + Context "ParameterSetName Children" { + + $Script:Result = '' + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Children It "doesn't throw" { - { $Script:Result = Get-UMSDeviceDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSDeviceDirectory @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.Id should be exactly $Id" { - $Result.Id | Should -BeExactly $Id + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] } - It 'Result.Name should have type [String]' { - $Result.Name | Should -HaveType [String] + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] } - It "Result.Name should be exactly $Name" { - $Result.Name | Should -BeExactly $Name + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/Get-UMSProfile.Tests.ps1 b/Tests/Get-UMSProfile.Tests.ps1 index 2a51029..cbefe0a 100644 --- a/Tests/Get-UMSProfile.Tests.ps1 +++ b/Tests/Get-UMSProfile.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSProfile Should not throw' { { Get-UMSProfile } | Should -Not -Throw @@ -143,7 +143,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSProfile } | should throw 'Error' @@ -157,47 +157,57 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfile[0].id + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Get-UMSProfile } | Should Not Throw + { $Script:Result = @( + Get-UMSProfile + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.Id should be exactly $($UMS.UMSProfile[0].id)" { - $Result.Id | Should -BeExactly $UMS.UMSProfile[0].id + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] } - It 'Result.Name should have type [String]' { - $Result.Name | Should -HaveType [String] + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] } - It "Result.Name should be exactly $($UMS.UMSProfile[0].Name)" { - $Result.Name | Should -BeExactly $UMS.UMSProfile[0].Name + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/Get-UMSProfileAssignment.Tests.ps1 b/Tests/Get-UMSProfileAssignment.Tests.ps1 index 8d38d29..84622f4 100644 --- a/Tests/Get-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Get-UMSProfileAssignment.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSProfileAssignment Should not throw' { { Get-UMSProfileAssignment } | Should -Not -Throw @@ -144,7 +144,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSProfileAssignment } | should throw 'Error' @@ -158,49 +158,89 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileAssignment[0].id - $ReceiverID = $UMS.UMSProfileAssignment[0].ReceiverID + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - 'Get-UMSProfileAssignment:Directory' = $true + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Get-UMSProfileAssignment } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSProfileAssignment @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].ReceiverType should have type [String]' { + $Result[0].ReceiverType | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + + Context "ParameterSetName Directory" { + + $Script:Result = '' + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Directory + + It "doesn't throw" { + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSProfileAssignment @Params1 + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty } - It "Result.Id should be exactly $Id)" { - $Result.Id | Should -BeExactly $Id + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It 'Result.ReceiverID should have type [Int]' { - $Result.ReceiverID | Should -HaveType [Int] + It 'Result[0].ReceiverType should have type [String]' { + $Result[0].ReceiverType | Should -HaveType [String] } - It "Result.ReceiverID should be exactly $ReceiverID" { - $Result.ReceiverID | Should -BeExactly $ReceiverID + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/Get-UMSProfileDirectory.Tests.ps1 b/Tests/Get-UMSProfileDirectory.Tests.ps1 index 387ed5a..181ccd3 100644 --- a/Tests/Get-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Get-UMSProfileDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSProfileDirectory Should not throw' { { Get-UMSProfileDirectory } | Should -Not -Throw @@ -149,7 +149,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { objectType = 'profiledirectory' } } - Mock 'New-UMSFilterString' {} + Mock 'New-UMSFilterString' { } $Result = Get-UMSProfileDirectory -Id 2 -Filter children @@ -189,7 +189,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSProfileDirectory } | should throw 'Error' @@ -203,49 +203,96 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileDirectory[0].id - $ObjectType = $UMS.UMSProfileDirectory[0].DirectoryChildren.ObjectType + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - 'Get-UMSProfileDirectory:Filter' = 'children' + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + + It "doesn't throw" { + { $Script:Result = @( + Get-UMSProfileDirectory + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + + Context "ParameterSetName Children" { + + $Script:Result = '' + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Children It "doesn't throw" { - { $Script:Result = Get-UMSProfileDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSProfileDirectory @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.Id should be exactly $Id)" { - $Result.Id | Should -BeExactly $Id + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] } - It 'Result.DirectoryChildren.ObjectType should have type [String]' { - $Result.DirectoryChildren.ObjectType | Should -HaveType [String] + It 'Result[0].MovedToBin should have type [Bool]' { + $Result[0].MovedToBin | Should -HaveType [Bool] } - It "Result.DirectoryChildren.ObjectType should be exactly $ObjectType" { - $Result.DirectoryChildren.ObjectType | Should -BeExactly $ObjectType + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index b45ef61..0fd4395 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -39,7 +39,7 @@ Integration Tests Config } Expected = @{ Message = 'Directory successfully inserted.' - Id = 593 + Id = 594 Name = 'QA' } Options = @{ @@ -68,14 +68,14 @@ Integration Tests Config @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' - Id = 594 + Id = 595 Name = '007' ParentId = -1 } @{ Mac = '0A0000000008' Message = 'Device successfully inserted.' - Id = 595 + Id = 596 Name = '008' ParentId = - 1 } @@ -95,7 +95,7 @@ Integration Tests Config } Expected = @{ Message = 'Directory successfully inserted.' - Id = 596 + Id = 597 Name = 'Devices' } Options = @{ @@ -288,12 +288,12 @@ Integration Tests Config DestId = 514 # A_Development } Params3 = @{ - Id = 594 # 007 - DestId = 593 # QA + Id = 595 # 007 + DestId = 594 # QA } Params4 = @{ - Id = 595 # 008 - DestId = 593 # QA + Id = 596 # 008 + DestId = 594 # QA } Expected = @( @{ @@ -305,11 +305,11 @@ Integration Tests Config Message = 'successful.' } @{ - Id = 594 + Id = 595 Message = 'successful.' } @{ - Id = 595 + Id = 596 Message = 'successful.' } ) @@ -324,7 +324,7 @@ Integration Tests Config ParameterSets = @{ Default = @{ Params1 = @{ - Id = 593 # QA + Id = 594 # QA DestId = 511 # Augsburg } Params2 = @{ @@ -333,7 +333,7 @@ Integration Tests Config } Expected = @( @{ - Id = 593 + Id = 594 Message = 'successful.' } @{ @@ -348,17 +348,17 @@ Integration Tests Config } } @{ - Function = 'Move-UMSProfile' + Function = 'Move-UMSProfileDirectory' ParameterSets = @{ Default = @{ Params1 = @{ - Id = 535 # UI_LNG_DE - DestId = 534 # User Interface + Id = 534 # Network User Interface + DestId = 527 # PSIGEL } Expected = @( @{ - Id = 535 - Message = 'successful' + Id = 534 + Message = 'successful.' } ) Options = @{ @@ -367,121 +367,118 @@ Integration Tests Config } } } - ##hier - <# @{ - Function = 'Move-UMSProfileDirectory' - Params1 = @{ - Id = 534 # ??? - DestId = 527 # ??? - } - Expected = @( - @{ - Id = 534 - Message = 'successful.' - } - ) - Options = @{ - ExcludedPaths = '' - } - } - @{ - Function = 'Update-UMSDeviceDirectory' - Params1 = @{ - Id = 517 # ??? - Name = 'Distribution' # ??? - } - Expected = @( - @{ - Id = 517 - Message = 'Updated directory successfully.' + Function = 'Move-UMSProfile' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 535 # NW_LNG_DE + DestId = 534 # Interface + } + Expected = @( + @{ + Id = 535 + Message = 'successful' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Update-UMSDevice' - Params1 = @{ - Id = 578 # ??? - Name = 'BR-DIS-010' # ??? - } - Expected = @( - @{ - Id = 578 - Message = 'Update successful.' + Function = 'Update-UMSDeviceDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 517 # L_Develpoment + Name = 'BR_Development' + } + Expected = @( + @{ + Id = 517 + Message = 'Updated directory successfully.' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Update-UMSDevice' - Params1 = @{ - Id = 578 # ??? - Name = 'BR-DIS-010' # ??? - } - Params2 = @{ - Id = 518 # ??? - Name = 'A-DEV-009' # ??? - } - Expected = @( - @{ - Id = 578 - Message = 'Update successful.' - } - @{ - Id = 518 - Message = 'Update successful.' + Function = 'Update-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 518 # L-DEV-009 + Name = 'A-DEV-009' + } + Params2 = @{ + Id = 578 # L-DEV-010 + Name = 'A-DEV-010' # ??? + } + Expected = @( + @{ + Id = 518 + Message = 'Update successful.' + } + @{ + Id = 578 + Message = 'Update successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Update-UMSProfile' - Params1 = @{ - Id = 535 # ??? #Origin rename to "NW_LNG_DE" - Name = 'LNG_DE' # ??? - } - Expected = @( - @{ - Id = 535 - Message = 'Update successful.' + Function = 'Update-UMSProfileDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 534 # Network user Interface + Name = 'User Interface' + } + Expected = @( + @{ + Id = 534 + Message = 'Updated directory successfully.' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } @{ - Function = 'Update-UMSProfileDirectory' - Params1 = @{ - Id = 534 # ??? - Name = 'User Interface' # ??? - } - Expected = @( - @{ - Id = 534 - Message = 'Updated directory successfully.' + Function = 'Update-UMSProfile' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 535 # NW_LNG_DE + Name = 'UI_LNG_DE' # + } + Expected = @( + @{ + Id = 535 + Message = 'Update successful.' + } + ) + Options = @{ + ExcludedPaths = '' + } } - ) - Options = @{ - ExcludedPaths = '' } } - #> - ### neu: - <# - # with Parametersets @{ Function = 'Get-UMSDevice' ParameterSets = @{ Default = @{ - #'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' Params1 = @{ } Expected = @( @@ -507,6 +504,94 @@ Integration Tests Config LastIp = '' MovedToBin = 'False' } + @{ + Id = 512 + ObjectType = 'tc' + UnitId = '0A0000000005' + Mac = '0A0000000005' + Name = 'A-DEV-005' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 513 + ObjectType = 'tc' + UnitId = '0A0000000006' + Mac = '0A0000000006' + Name = 'A-DEV-006' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 518 + ObjectType = 'tc' + UnitId = '0A0000000009' + Mac = '0A0000000009' + Name = 'A-DEV-009' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 576 + ObjectType = 'tc' + UnitId = '0A0000000004' + Mac = '0A0000000004' + Name = 'BR-MKT-004' + ParentId = 508 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 577 + ObjectType = 'tc' + UnitId = '0A0000000003' + Mac = '0A0000000003' + Name = 'BR-MKT-003' + ParentId = 508 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 578 + ObjectType = 'tc' + UnitId = '0A0000000010' + Mac = '0A0000000010' + Name = 'A-DEV-010' + ParentId = 514 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 595 + ObjectType = 'tc' + UnitId = '0A0000000007' + Mac = '0A0000000007' + Name = '007' + ParentId = 594 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 596 + ObjectType = 'tc' + UnitId = '0A0000000008' + Mac = '0A0000000008' + Name = '008' + ParentId = 594 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } ) Options = @{ ExcludedPaths = '' @@ -514,7 +599,7 @@ Integration Tests Config } Details = @{ Params1 = @{ - Id = 518 # ??? + Id = 518 # A-DEV-009 Filter = 'details' } Expected = @( @@ -576,17 +661,17 @@ Integration Tests Config } Online = @{ Params1 = @{ - Id = 578 # ??? + Id = 578 # A-DEV-010 Filter = 'online' } Expected = @( @{ Id = 578 - ObjectType = tc + ObjectType = 'tc' UnitId = '0A0000000010' Mac = '0A0000000010' - Name = 'BR-DIS-010' - ParentId = 517 + Name = 'A-DEV-010' + ParentId = 514 FirmwareId = 2 LastIp = '' MovedToBin = 'False' @@ -599,377 +684,330 @@ Integration Tests Config } } } - #> - ) - <# - Tests = [ordered]@{ - 'Get-UMSDevice | Sort-Object -Property Id | Select-Object -First 2' = @( - @{ - Id = 505 - ObjectType = 'tc' - UnitId = '0A0000000001' - Mac = '0A0000000001' - Name = 'BR-HR-001' - ParentId = 504 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - } - @{ - Id = 507 - ObjectType = 'tc' - UnitId = '0A0000000002' - Mac = '0A0000000002' - Name = 'BR-HR-002' - ParentId = 504 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - } - ) - '518 | Get-UMSDevice -Filter details' = @( - @{ - Id = 518 - ObjectType = 'tc' - UnitId = '0A0000000009' - Mac = '0A0000000009' - Name = 'A-DEV-009' - ParentId = 514 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - NetworkName = '' - Site = '' - Comment = '' - Department = '' - CostCenter = '' - AssetID = '' - InServiceDate = '' - SerialNumber = '' - ProductId = '' - CpuSpeed = 0 - CpuType = '' - DeviceType = '' - DeviceSerialNumber = '' - OsType = '' - FlashSize = 0 - MemorySize = 0 - NetworkSpeed = 0 - GraphicsChipset0 = '' - GraphicsChipset1 = '' - MonitorVendor1 = '' - MonitorModel1 = '' - MonitorSerialnumber1 = '' - MonitorSize1 = 0 - MonitorNativeResolution1 = '' - Monitor1YearOfManufacture = 0 - Monitor1WeekOfManufacture = 0 - MonitorVendor2 = '' - MonitorModel2 = '' - MonitorSerialnumber2 = '' - MonitorSize2 = 0 - MonitorNativeResolution2 = '' - Monitor2YearOfManufacture = 0 - Monitor2WeekOfManufacture = 0 - BiosVendor = '' - BiosVersion = '' - TotalUsagetime = -1 - TotalUptime = -1 - BatteryLevel = -1 - LastBootTime = '' - BiosDate = '' - } - ) - 'Get-UMSDevice -Id 578 -Filter online' = @( - @{ - Id = 578 - ObjectType = tc - UnitId = '0A0000000010' - Mac = '0A0000000010' - Name = 'BR-DIS-010' - ParentId = 517 - FirmwareId = 2 - LastIp = '' - MovedToBin = 'False' - Online = 'False' - } - ) - '(Get-UMSDevice).Count' = @( - 10 - ) - 'Get-UMSDeviceDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2' = @( - @{ - Id = 613 - Name = 'QandA' - ParentId = 511 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 517 - Name = 'Distribution' - ParentId = 503 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - ) - '517 | Get-UMSDeviceDirectory' = @( - @{ - Id = 517 - Name = 'Distribution' - ParentId = 503 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - ) - '(Get-UMSDeviceDirectory -Id 503 -Filter children).DirectoryChildren' = @( - @{ - ObjectType = 'tcdirectory' - Id = 504 - } - @{ - ObjectType = 'tcdirectory' - Id = 508 - } - @{ - ObjectType = 'tcdirectory' - Id = 517 - } - ) - 'Get-UMSProfile | Sort-Object -Property Id | Select-Object -First 2' = @( - @{ - FirmwareId = 1 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 529 - Name = 'PRO_RDP_Session01' - ParentId = 528 - MovedToBin = 'False' - ObjectType = 'profile' - } - @{ - FirmwareId = 1 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 532 - Name = 'PRO_Terminal_LocalTerminal' - ParentId = 531 - MovedToBin = 'False' - ObjectType = 'profile' - } - ) - '535 | Get-UMSProfile' = @( - @{ - FirmwareId = 2 - IsMasterProfile = 'False' - OverridesSessions = 'False' - Id = 535 - Name = 'PRO_LNG_DE' - ParentId = 534 - MovedToBin = 'False' - ObjectType = 'profile' - } - ) - '(Get-UMSProfile).Count' = @( - 6 - ) - 'Get-UMSProfileDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2' = @( - @{ - Id = 623 - Name = 'Devices' - ParentId = '-2' - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - @{ - Id = 539 - Name = 'Security' - ParentId = 527 - MovedToBin = 'False' - ObjectType = 'profiledirectory' - } - ) - '(Get-UMSProfileDirectory -Id 533 -Filter children).DirectoryChildren' = @( - @{ - ObjectType = 'profile' - id = 537 - } - @{ - ObjectType = 'profile' - id = 538 - } - ) - 'Get-UMSProfileAssignment -Id 538' = @( - @{ - Id = 538 - Get = 'profile' - ReceiverId = 577 - ReceiverType = 'tc' - AssignmentPosition = 0 - } - ) - '538 | Get-UMSProfileAssignment -Directory' = @( - @{ - Id = 538 - Type = 'profile' - ReceiverId = 504 - ReceiverType = 'tcdirectory' - AssignmentPosition = 0 - } - @{ - Id = 538 - Type = 'profile' - ReceiverId = 517 - ReceiverType = 'tcdirectory' - AssignmentPosition = 1 - } - ) - '(Get-UMSDeviceAssignment -Id 577).Count' = @( - 4 - ) - '577 | Get-UMSDeviceAssignment' = @( - @{ - Id = 577 - ReceiverId = 577 - ReceiverType = 'tc' - AssigneeId = 538 - AssigneeType = 'profile' - AssignmentPosition = 0 - } - @{ - Id = 577 - ReceiverId = 503 - ReceiverType = 'tcdirectory' - AssigneeId = 537 - AssigneeType = 'profile' - AssignmentPosition = 1 - } - @{ - Id = 577 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 529 - AssigneeType = 'profile' - AssignmentPosition = 2 - } - @{ - Id = 577 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 535 - AssigneeType = 'profile' - AssignmentPosition = 3 - } - ) - '(Get-UMSDeviceDirectoryAssignment -Id 514).Count' = @( - 3 - ) - '514 | Get-UMSDeviceDirectoryAssignment' = @( - @{ - Id = 514 - ReceiverId = 514 - ReceiverType = 'tcdirectory' - AssigneeId = 532 - AssigneeType = 'profile' - AssignmentPosition = 0 - } - @{ - Id = 514 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 535 - AssigneeType = 'profile' - AssignmentPosition = 1 - } - @{ - Id = 514 - ReceiverId = 502 - ReceiverType = 'tcdirectory' - AssigneeId = 529 - AssigneeType = 'profile' - AssignmentPosition = 2 - } - ) - 'Get-UMSDirectoryRecursive -Id 511 -DirectoryColl (Get-UMSDeviceDirectory)' = @( - @{ - Id = 511 - Name = 'Augsburg' - ParentId = 502 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 514 - Name = 'Development' - ParentId = 511 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - @{ - Id = 613 - Name = 'QandA' - ParentId = 511 - MovedToBin = 'False' - ObjectType = 'tcdirectory' - } - ) - 'Get-UMSDirectoryRecursive -Id 511 -DirectoryColl (Get-UMSDeviceDirectory) -ElementColl (Get-UMSDevice)' = @( - @{ - Id = 512 - ObjectType = 'tc' - UnitId = '0A0000000005' - Mac = '0A0000000005' - Name = 'A-DEV-005' - ParentId = 514 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' - } - @{ - Id = 513 - ObjectType = 'tc' - UnitId = '0A0000000006' - Mac = '0A0000000006' - Name = 'A-DEV-006' - ParentId = 514 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' + @{ + Function = 'Get-UMSDeviceDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + } + Expected = @( + @{ + Id = 514 + Name = 'A_Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 594 + Name = 'QA' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 516 + Name = 'Leipzig' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 517 + Name = 'BR_Development' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 502 + Name = 'PSIGEL' + ParentId = -1 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 503 + Name = 'Bremen' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 504 + Name = 'BR_HR' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 508 + Name = 'BR_Marketing' + ParentId = 503 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 511 + Name = 'Augsburg' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + Children = @{ + Params1 = @{ + Id = 514 # A-DEV-009 + Filter = 'children' + } + Expected = @( + @{ + Id = 514 + Name = 'A_Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + DirectoryChildren = { + @{ + ObjectType = 'tc' + Id = 512 + } + @{ + ObjectType = 'tc' + Id = 578 + } + @{ + ObjectType = 'tc' + Id = 513 + } + @{ + ObjectType = 'tc' + Id = 518 + } + } + } + ) + Options = @{ + ExcludedPaths = 'DirectoryChildren' + } + } } - @{ - Id = 518 - ObjectType = 'tc' - UnitId = '0A0000000009' - Mac = '0A0000000009' - Name = 'A-DEV-009' - ParentId = 514 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' + } + @{ + Function = 'Get-UMSProfile' + ParameterSets = @{ + Default = @{ + Params1 = @{ + } + Expected = @( + @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 529 + Name = 'SES_RDP_Session01' + ParentId = 528 + MovedToBin = 'False' + ObjectType = 'profile' + } + @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 532 + Name = 'ACC_Terminal_LocalTerminal' + ParentId = 531 + MovedToBin = 'False' + ObjectType = 'profile' + } + @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 535 + Name = 'UI_LNG_DE' + ParentId = 534 + MovedToBin = 'False' + ObjectType = 'profile' + } + @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 537 + Name = 'NW_LAN' + ParentId = 533 + MovedToBin = 'False' + ObjectType = 'profile' + } + @{ + FirmwareId = 2 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 538 + Name = 'NW_WLAN' + ParentId = 533 + MovedToBin = 'False' + ObjectType = 'profile' + } + @{ + FirmwareId = 1 + IsMasterProfile = 'False' + OverridesSessions = 'False' + Id = 540 + Name = 'SEC_PW_Root' + ParentId = 539 + MovedToBin = 'False' + ObjectType = 'profile' + } + ) + Options = @{ + ExcludedPaths = '' + } + } } - @{ - Id = 617 - ObjectType = 'tc' - UnitId = '0A0000000007' - Mac = '0A0000000007' - Name = 'A-QA-007' - ParentId = 613 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' + } + @{ + Function = 'Get-UMSProfileDirectory' + ParameterSets = @{ + Default = @{ + Params1 = @{ + } + Expected = @( + @{ + Id = 528 + Name = 'Sessions' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 531 + Name = 'Accessories' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 533 + Name = 'Network' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 597 + Name = 'Devices' + ParentId = -2 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 534 + Name = 'User Interface' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 539 + Name = 'Security' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + @{ + Id = 527 + Name = 'PSIGEL' + ParentId = -2 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + Children = @{ + Params1 = @{ + Id = 533 # Network + Filter = 'children' + } + Expected = @( + @{ + Id = 533 + Name = 'Network' + ParentId = 527 + MovedToBin = 'False' + ObjectType = 'profiledirectory' + DirectoryChildren = { + @{ + ObjectType = 'profile' + Id = 537 + } + @{ + ObjectType = 'profile' + Id = 538 + } + } + } + ) + Options = @{ + ExcludedPaths = 'DirectoryChildren' + } + } } - @{ - Id = 621 - ObjectType = 'tc' - UnitId = '0A0000000008' - Mac = '0A0000000008' - Name = 'A-QA-008' - ParentId = 613 - FirmwareId = 1 - LastIp = '' - MovedToBin = 'False' + } + @{ + Function = 'Get-UMSProfileAssignment' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 538 # NW_LAN + } + Expected = @( + @{ + Id = 538 + Type = 'profile' + ReceiverId = 577 + ReceiverType = 'tc' + AssignmentPosition = 0 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + Directory = @{ + Params1 = @{ + Id = 538 # NW_LAN + Directory = $true + } + Expected = @( + @{ + Id = 538 + Type = 'profile' + ReceiverId = 504 + ReceiverType = 'tcdirectory' + AssignmentPosition = 0 + } + @{ + Id = 538 + Type = 'profile' + ReceiverId = 517 + ReceiverType = 'tcdirectory' + AssignmentPosition = 1 + } + ) + Options = @{ + ExcludedPaths = '' + } + } } - ) - } -#> -} \ No newline at end of file + } + ) +} diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index 601d2a7..2921bd1 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Move-UMSProfileDirectory -Id 2 -DestId 2 Should not throw' { { Move-UMSProfileDirectory -Id 2 -DestId 2 } | Should -Not -Throw @@ -83,7 +83,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Move-UMSProfileDirectory -Id 2 -DestId 2 -WhatIf @@ -102,7 +102,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It 'Move-UMSProfileDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSProfileDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -116,18 +116,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileDirectory[0].Id - $DestId = $UMS.UMSProfileDirectory[0].DestId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:DestId' = $DestId + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -135,10 +132,15 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Move-UMSProfileDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Move-UMSProfileDirectory @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -149,12 +151,19 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Message should be exactly 'successful.'" { - $Result[0].Message | Should -BeExactly 'successful.' + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } + } } \ No newline at end of file diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index e2ae908..659bce1 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -22,7 +22,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Update-UMSDevice -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSDevice -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -111,7 +111,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Update-UMSDevice -Id 2 -Name 'NameNew' -WhatIf @@ -130,7 +130,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it "Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop should throw Error" { { Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | should -Throw @@ -145,18 +145,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[1].Id - $CommentUpdate = $UMS.UMSDevice[1].CommentUpdate + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Comment' = $CommentUpdate + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -164,10 +161,17 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Update-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 + { $Script:Result = @( + Update-UMSDevice @Params1 + Update-UMSDevice @Params2 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -178,8 +182,18 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Message should be exactly 'Update successful.'" { - $Result[0].Message | Should -BeExactly 'Update successful.' + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } } \ No newline at end of file diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index 78b0edd..9cb3549 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' } | should throw 'Error' @@ -127,18 +127,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDeviceDirectory[1].Id - $NameUpdate = $UMS.UMSDeviceDirectory[1].NameUpdate + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Name' = $NameUpdate + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Update-UMSDeviceDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Update-UMSDeviceDirectory @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,8 +162,19 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Message should be exactly 'Updated directory successfully.'" { - $Result[0].Message | Should -BeExactly 'Updated directory successfully.' + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } + } } \ No newline at end of file diff --git a/Tests/Update-UMSProfile.Tests.ps1 b/Tests/Update-UMSProfile.Tests.ps1 index 01d4b19..c1feb86 100644 --- a/Tests/Update-UMSProfile.Tests.ps1 +++ b/Tests/Update-UMSProfile.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Update-UMSProfile -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSProfile -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Update-UMSProfile -Id 2 -Name 'NameNew' -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | should throw 'Error' @@ -127,18 +127,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfile[0].Id - $NameUpdate = $UMS.UMSProfile[0].NameUpdate + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Name' = $NameUpdate + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Update-UMSProfile } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Update-UMSProfile @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,8 +162,18 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Message should be exactly 'Update successful.'" { - $Result[0].Message | Should -BeExactly 'Update successful.' + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } } \ No newline at end of file diff --git a/Tests/Update-UMSProfileDirectory.Tests.ps1 b/Tests/Update-UMSProfileDirectory.Tests.ps1 index d3015ec..9cb6b6b 100644 --- a/Tests/Update-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Update-UMSProfileDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -34,7 +34,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Update-UMSProfileDirectory -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSProfileDirectory -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Update-UMSProfileDirectory -Id 2 -Name 'NameNew' -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Update-UMSProfileDirectory -Id 2 -Name 'NameNew' } | should throw 'Error' @@ -127,18 +127,15 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSProfileDirectory[0].Id - $NameUpdate = $UMS.UMSProfileDirectory[0].NameUpdate + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Name' = $NameUpdate + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Update-UMSProfileDirectory } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Update-UMSProfileDirectory @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,8 +162,18 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Message should be exactly 'Updated directory successfully.'" { - $Result[0].Message | Should -BeExactly 'Updated directory successfully.' + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } } \ No newline at end of file From f70c6b5f4c192be5b5d72784cde2fb0df11a7753 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 7 Mar 2020 17:20:18 +0100 Subject: [PATCH 067/145] working on Tests --- Scripts/Test.ps1 | 5 +- Tests/Get-UMSDeviceAssignment.Tests.ps1 | 65 +++--- ...Get-UMSDeviceDirectoryAssignment.Tests.ps1 | 65 +++--- Tests/Get-UMSDirectoryRecursive.Tests.ps1 | 100 ++++++--- Tests/IntegrationTestsConfig.psd1 | 209 ++++++++++++++++++ 5 files changed, 346 insertions(+), 98 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 2ca508d..d77da97 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -13,12 +13,15 @@ $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } +$DirectoryColl = Get-UMSDeviceDirectory +$ElementColl = Get-UMSDevice + $Result = '' #$Result = (Get-UMSProfile).Count #$Result = Get-UMSProfileDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2 #$Result = (Get-UMSProfileDirectory -Id 533 -Filter children).DirectoryChildren #$Result = (Get-UMSDeviceAssignment -Id 577).Count -$Result = Get-UMSProfileAssignment -Id 538 #-Directory +$Result = Get-UMSDirectoryRecursive -DirectoryColl $DirectoryColl -Id 511 -ElementColl $ElementColl $Result #($Result[0].MovedToBin).Gettype() diff --git a/Tests/Get-UMSDeviceAssignment.Tests.ps1 b/Tests/Get-UMSDeviceAssignment.Tests.ps1 index 4c2d5a0..bf56d60 100644 --- a/Tests/Get-UMSDeviceAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceAssignment.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSDeviceAssignment Should not throw' { { Get-UMSDeviceAssignment } | Should -Not -Throw @@ -99,7 +99,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSDeviceAssignment } | should throw 'Error' @@ -113,57 +113,54 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDeviceAssignment[0].Id - $ReceiverType = $UMS.UMSDeviceAssignment.ReceiverType - $AssigneeId = $UMS.UMSDeviceAssignment.AssigneeId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Get-UMSDeviceAssignment } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSDeviceAssignment @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] - } - - It "Result.Id should be exactly $($UMS.UMSDeviceAssignment.Id)" { - $Result.Id | Should -BeExactly $UMS.UMSDeviceAssignment.Id - } - - It 'Result.ReceiverType should have type [String]' { - $Result.ReceiverType | Should -HaveType [String] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.ReceiverType should be exactly $ReceiverType)" { - $Result.ReceiverType | Should -BeExactly $ReceiverType + It 'Result[0].ReceiverType should have type [String]' { + $Result[0].ReceiverType | Should -HaveType [String] } - It 'Result.AssigneeID should have type [Int]' { - $Result.AssigneeID | Should -HaveType [Int] - } - - It "Result.AssigneeID should be exactly $AssigneeId)" { - $Result.AssigneeID | Should -BeExactly $AssigneeId + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 index 65d602b..933cabb 100644 --- a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -21,7 +21,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It 'Get-UMSDeviceDirectoryAssignment Should not throw' { { Get-UMSDeviceDirectoryAssignment } | Should -Not -Throw @@ -99,7 +99,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } it 'should throw Error' { { Get-UMSDeviceDirectoryAssignment } | should throw 'Error' @@ -113,57 +113,54 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDeviceDirectoryAssignment[0].Id - $ReceiverType = $UMS.UMSDeviceDirectoryAssignment.ReceiverType - $AssigneeId = $UMS.UMSDeviceDirectoryAssignment.AssigneeId + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Get-UMSDeviceDirectoryAssignment } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Get-UMSDeviceDirectoryAssignment @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] - } - - It "Result.Id should be exactly $UMS.UMSDeviceDirectoryAssignment.Id" { - $Result.Id | Should -BeExactly $UMS.UMSDeviceDirectoryAssignment.Id - } - - It 'Result.ReceiverType should have type [String]' { - $Result.ReceiverType | Should -HaveType [String] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.ReceiverType should be exactly $ReceiverType)" { - $Result.ReceiverType | Should -BeExactly $ReceiverType + It 'Result[0].ReceiverType should have type [String]' { + $Result[0].ReceiverType | Should -HaveType [String] } - It 'Result.AssigneeID should have type [Int]' { - $Result.AssigneeID | Should -HaveType [Int] - } - - It "Result.AssigneeID should be exactly $AssigneeId)" { - $Result.AssigneeID | Should -BeExactly $AssigneeId + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } + } \ No newline at end of file diff --git a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 index 6a9c672..1e17a66 100644 --- a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 +++ b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @@ -29,7 +29,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -47,10 +47,10 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { $Script:Result = '' - Mock 'Get-UMSDirectoryRecursive' {} + Mock 'Get-UMSDirectoryRecursive' { } It 'Get-UMSDirectoryRecursive Should not throw' { - { Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{} } | Should -Not -Throw + { Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{ } } | Should -Not -Throw } It 'Get-UMSDirectoryRecursive -ApiVersion 10 Stop Should throw' { @@ -86,7 +86,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { ObjectType = 'tcdirectory' } ) - Mock 'Get-UMSDirectoryRecursive' {$DirectoryColl} + Mock 'Get-UMSDirectoryRecursive' { $DirectoryColl } Get-UMSDirectoryRecursive -Id 99 -DirectoryColl $DirectoryColl @@ -278,10 +278,10 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { $Script:Result = '' Write-Host $Result - Mock 'Get-UMSDirectoryRecursive' {throw 'Error'} + Mock 'Get-UMSDirectoryRecursive' { throw 'Error' } it 'should throw Error' { - { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{} -ElementColl @{} } | should throw 'Error' + { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{ } -ElementColl @{ } } | should throw 'Error' } It 'Result should be null or empty' { @@ -291,51 +291,93 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -#<# Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDirectoryRecursive[0].Id - $Name = $UMS.UMSDirectoryRecursive[0].Name + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } - $WebSession = New-UMSAPICookie -Credential $Credential + $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Get-UMSDirectoryRecursive - } | Should Not Throw + $Params1 = $TestCfg.Params1 + $Params1.Add('DirectoryColl', (Get-UMSDeviceDirectory)) + { $Script:Result = @( + Get-UMSDirectoryRecursive @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { $Result | Should not BeNullOrEmpty } - It 'Result.Id should have type [Int]' { - $Result.Id | Should -HaveType [Int] + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] } - It "Result.Id should be exactly $Id" { - $Result.Id | Should -BeExactly $Id + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] } - It 'Result.Name should have type [String]' { - $Result.Name | Should -HaveType [String] + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } + } + + Context "ParameterSetName Element" { + + $Script:Result = '' + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Element - It "Result.Name should be exactly $Name" { - $Result.Name | Should -BeExactly $Name + It "doesn't throw" { + $Params1 = $TestCfg.Params1 + $Params1.Add('DirectoryColl', (Get-UMSDeviceDirectory)) + $Params1.Add('ElementColl', (Get-UMSDevice)) + { $Script:Result = @( + Get-UMSDirectoryRecursive @Params1 + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Name should have type [String]' { + $Result[0].Name | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } } -} -#> \ No newline at end of file + +} \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 0fd4395..0b35b5b 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -1009,5 +1009,214 @@ Integration Tests Config } } } + @{ + Function = 'Get-UMSDeviceAssignment' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 577 # BR-MKT-003 + } + Expected = @( + @{ + Id = 577 + ReceiverId = 577 + ReceiverType = 'tc' + AssigneeId = 538 + AssigneeType = 'profile' + AssignmentPosition = 0 + } + @{ + Id = 577 + ReceiverId = 503 + ReceiverType = 'tcdirectory' + AssigneeId = 537 + AssigneeType = 'profile' + AssignmentPosition = 1 + } + @{ + Id = 577 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 529 + AssigneeType = 'profile' + AssignmentPosition = 2 + } + @{ + Id = 577 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 535 + AssigneeType = 'profile' + AssignmentPosition = 3 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + } + } + @{ + Function = 'Get-UMSDeviceDirectoryAssignment' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 504 # BR_HR + } + Expected = @( + @{ + Id = 504 + ReceiverId = 504 + ReceiverType = 'tcdirectory' + AssigneeId = 538 + AssigneeType = 'profile' + AssignmentPosition = 0 + } + @{ + Id = 504 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 535 + AssigneeType = 'profile' + AssignmentPosition = 1 + } + @{ + Id = 504 + ReceiverId = 502 + ReceiverType = 'tcdirectory' + AssigneeId = 529 + AssigneeType = 'profile' + AssignmentPosition = 2 + } + @{ + Id = 504 + ReceiverId = 503 + ReceiverType = 'tcdirectory' + AssigneeId = 537 + AssigneeType = 'profile' + AssignmentPosition = 3 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + } + } + @{ + Function = 'Get-UMSDirectoryRecursive' + ParameterSets = @{ + Default = @{ + Params1 = @{ + #DirectoryColl = 'Get-UMSDeviceDirectory' + Id = 511 # Augsburg + } + Expected = @( + @{ + Id = 511 + Name = 'Augsburg' + ParentId = 502 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 514 + Name = 'A_Development' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + @{ + Id = 594 + Name = 'QA' + ParentId = 511 + MovedToBin = 'False' + ObjectType = 'tcdirectory' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + Element = @{ + Params1 = @{ + #DirectoryColl = 'Get-UMSDeviceDirectory' + #ElementColl = 'Get-UMSDevice' + Id = 511 # Augsburg + } + Expected = @( + @{ + Id = 512 + ObjectType = 'tc' + UnitId = '0A0000000005' + Mac = '0A0000000005' + Name = 'A-DEV-005' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 513 + ObjectType = 'tc' + UnitId = '0A0000000006' + Mac = '0A0000000006' + Name = 'A-DEV-006' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 518 + ObjectType = 'tc' + UnitId = '0A0000000009' + Mac = '0A0000000009' + Name = 'A-DEV-009' + ParentId = 514 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 578 + ObjectType = 'tc' + UnitId = '0A0000000010' + Mac = '0A0000000010' + Name = 'A-DEV-010' + ParentId = 514 + FirmwareId = 2 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 595 + ObjectType = 'tc' + UnitId = '0A0000000007' + Mac = '0A0000000007' + Name = 007 + ParentId = 594 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + @{ + Id = 596 + ObjectType = 'tc' + UnitId = '0A0000000008' + Mac = '0A0000000008' + Name = 008 + ParentId = 594 + FirmwareId = 1 + LastIp = '' + MovedToBin = 'False' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + } + } ) } From a42c740d67fa1a41888b3558bb7bb68110e55454 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 7 Mar 2020 17:32:38 +0100 Subject: [PATCH 068/145] working on Tests --- Tests/IntegrationTestsConfig.psd1 | 38 ++++++++++++++++++----- Tests/Update-UMSDevice.Tests.ps1 | 4 +++ Tests/Update-UMSDeviceDirectory.Tests.ps1 | 2 ++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 0b35b5b..cc14344 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -395,11 +395,19 @@ Integration Tests Config Id = 517 # L_Develpoment Name = 'BR_Development' } + Params2 = @{ + Id = 594 # QA + Name = 'A_QA' + } Expected = @( @{ Id = 517 Message = 'Updated directory successfully.' } + @{ + Id = 594 + Message = 'Updated directory successfully.' + } ) Options = @{ ExcludedPaths = '' @@ -417,7 +425,15 @@ Integration Tests Config } Params2 = @{ Id = 578 # L-DEV-010 - Name = 'A-DEV-010' # ??? + Name = 'A-DEV-010' + } + Params3 = @{ + Id = 595 # 007 + Name = 'A-QA-007' + } + Params4 = @{ + Id = 596 # 008 + Name = 'A-QA-008' } Expected = @( @{ @@ -428,6 +444,14 @@ Integration Tests Config Id = 578 Message = 'Update successful.' } + @{ + Id = 595 + Message = 'Update successful.' + } + @{ + Id = 596 + Message = 'Update successful.' + } ) Options = @{ ExcludedPaths = '' @@ -575,7 +599,7 @@ Integration Tests Config ObjectType = 'tc' UnitId = '0A0000000007' Mac = '0A0000000007' - Name = '007' + Name = 'A-QA-007' ParentId = 594 FirmwareId = 1 LastIp = '' @@ -586,7 +610,7 @@ Integration Tests Config ObjectType = 'tc' UnitId = '0A0000000008' Mac = '0A0000000008' - Name = '008' + Name = 'A-QA-008' ParentId = 594 FirmwareId = 1 LastIp = '' @@ -700,7 +724,7 @@ Integration Tests Config } @{ Id = 594 - Name = 'QA' + Name = 'A_QA' ParentId = 511 MovedToBin = 'False' ObjectType = 'tcdirectory' @@ -1128,7 +1152,7 @@ Integration Tests Config } @{ Id = 594 - Name = 'QA' + Name = 'A_QA' ParentId = 511 MovedToBin = 'False' ObjectType = 'tcdirectory' @@ -1194,7 +1218,7 @@ Integration Tests Config ObjectType = 'tc' UnitId = '0A0000000007' Mac = '0A0000000007' - Name = 007 + Name = 'A-QA-007' ParentId = 594 FirmwareId = 1 LastIp = '' @@ -1205,7 +1229,7 @@ Integration Tests Config ObjectType = 'tc' UnitId = '0A0000000008' Mac = '0A0000000008' - Name = 008 + Name = 'A-QA-008' ParentId = 594 FirmwareId = 1 LastIp = '' diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index 659bce1..0d98c85 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -168,9 +168,13 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { It "doesn't throw" { $Params1 = $TestCfg.Params1 $Params2 = $TestCfg.Params2 + $Params3 = $TestCfg.Params3 + $Params4 = $TestCfg.Params4 { $Script:Result = @( Update-UMSDevice @Params1 Update-UMSDevice @Params2 + Update-UMSDevice @Params3 + Update-UMSDevice @Params4 ) } | Should Not Throw } diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index 9cb3549..a850aa5 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -149,8 +149,10 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { It "doesn't throw" { $Params1 = $TestCfg.Params1 + $Params2 = $TestCfg.Params2 { $Script:Result = @( Update-UMSDeviceDirectory @Params1 + Update-UMSDeviceDirectory @Params2 ) } | Should Not Throw } From fc14da4cd628df61483003c54371bd2344f8974b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 7 Mar 2020 18:38:18 +0100 Subject: [PATCH 069/145] working on Tests --- Scripts/Test.ps1 | 17 ++++--- Tests/IntegrationTestsConfig.psd1 | 85 +++++++++++++++++++++++++++++++ Tests/Pipeline.Tests.ps1 | 65 +++++++++++++++++++++++ 3 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 Tests/Pipeline.Tests.ps1 diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index d77da97..e3a8b8c 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -13,15 +13,18 @@ $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } -$DirectoryColl = Get-UMSDeviceDirectory -$ElementColl = Get-UMSDevice +$Params1 = @{ + Mac = '0A00000000FF' + Name = 'PipelineDevice' + FirmwareId = 1 + ParentId = -1 +} + +#$Params1.Mac -match '^([0-9a-f]{12})$' $Result = '' -#$Result = (Get-UMSProfile).Count -#$Result = Get-UMSProfileDirectory | Sort-Object -Property Id -Descending | Select-Object -First 2 -#$Result = (Get-UMSProfileDirectory -Id 533 -Filter children).DirectoryChildren -#$Result = (Get-UMSDeviceAssignment -Id 577).Count -$Result = Get-UMSDirectoryRecursive -DirectoryColl $DirectoryColl -Id 511 -ElementColl $ElementColl +$Result = $Params1 | New-UMSDevice +#$Result = $Params1.Mac | New-UMSDevice -FirmwareId 1 $Result #($Result[0].MovedToBin).Gettype() diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index cc14344..9e5b749 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -1242,5 +1242,90 @@ Integration Tests Config } } } + @{ + Function = 'Pipeline' + ParameterSets = @{ + UMSDevice = @{ + Params1 = @{ + Mac = '0A00000000FF' + Name = 'PipelineDevice' + FirmwareId = 1 + ParentId = -1 + } + Params2 = @{ + DeviceDirectoryId = 502 + DeviceUpdateName = 'PipelineDeviceUpdated' + } + Expected = @( + @{ + + } + @{ + + } + ) + Options = @{ + ExcludedPaths = '' + } + } + UMSDeviceDirectory = @{ + Params1 = @{ + Id = 111 + } + Params2 = @{ + Id = 222 + } + Expected = @( + @{ + + } + @{ + + } + ) + Options = @{ + ExcludedPaths = '' + } + } + UMSProfile = @{ + Params1 = @{ + Id = 111 + } + Params2 = @{ + Id = 222 + } + Expected = @( + @{ + + } + @{ + + } + ) + Options = @{ + ExcludedPaths = '' + } + } + UMSProfileDirectory = @{ + Params1 = @{ + Id = 111 + } + Params2 = @{ + Id = 222 + } + Expected = @( + @{ + + } + @{ + + } + ) + Options = @{ + ExcludedPaths = '' + } + } + } + } ) } diff --git a/Tests/Pipeline.Tests.ps1 b/Tests/Pipeline.Tests.ps1 new file mode 100644 index 0000000..6763c1b --- /dev/null +++ b/Tests/Pipeline.Tests.ps1 @@ -0,0 +1,65 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False + } + + $WebSession = New-UMSAPICookie + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ParameterSetName UMSDevice" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.UMSDevice + + It "doesn't throw" { + $Params1 = $TestCfg.Params1 + Write-Host $Params1.Mac + { $Script:Result = @( + $Params1 | + New-UMSDevice #| + #Move-UMSDevice -DestId $Params1.DeviceDirectoryId | + #Update-UMSDevice -Name $Params1.DeviceUpdateName | + #Remove-UMSDevice + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + <# + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + #> + } +} \ No newline at end of file From 81a708f740ca90e11874891588c7a8854e6e8eb3 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 8 Mar 2020 14:26:30 +0100 Subject: [PATCH 070/145] working on Tests --- PSIGEL/Public/Move-UMSDevice.ps1 | 2 +- PSIGEL/Public/Move-UMSProfile.ps1 | 2 +- Scripts/Test.ps1 | 84 ++++- Tests/IntegrationTestsConfig.psd1 | 513 +++++++++++++++++++++++------- Tests/Pipeline.Tests.ps1 | 65 ---- 5 files changed, 478 insertions(+), 188 deletions(-) delete mode 100644 Tests/Pipeline.Tests.ps1 diff --git a/PSIGEL/Public/Move-UMSDevice.ps1 b/PSIGEL/Public/Move-UMSDevice.ps1 index bdee8e7..a179f9c 100644 --- a/PSIGEL/Public/Move-UMSDevice.ps1 +++ b/PSIGEL/Public/Move-UMSDevice.ps1 @@ -50,7 +50,7 @@ function Move-UMSDevice Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0} to DestId: {1}' -f $Id, $DestId))) diff --git a/PSIGEL/Public/Move-UMSProfile.ps1 b/PSIGEL/Public/Move-UMSProfile.ps1 index 6797e43..4545123 100644 --- a/PSIGEL/Public/Move-UMSProfile.ps1 +++ b/PSIGEL/Public/Move-UMSProfile.ps1 @@ -50,7 +50,7 @@ function Move-UMSProfile Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0} to DestID: {1}' -f $Id, $DestId))) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index e3a8b8c..ec0c17a 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -5,6 +5,7 @@ $PSDefaultParameterValues = @{ 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath '*-UMS*:Computername' = 'igelrmserver' '*-UMS*:TCPPort' = 9443 + '*-UMS*:Confirm' = $False #'*-UMS*:SecurityProtocol' = 'Tls' } @@ -13,23 +14,82 @@ $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } -$Params1 = @{ - Mac = '0A00000000FF' - Name = 'PipelineDevice' - FirmwareId = 1 - ParentId = -1 +$NewParams = @{ + Name = 'NewDeviceDirectory02' +} +$MoveParams = @{ + DestId = 502 # PSIGEL +} +$UpdateParams = @{ + Name = 'UpdatedDeviceDirectory02' } -#$Params1.Mac -match '^([0-9a-f]{12})$' +#<# +$Result = @( + $null = ((($NewParams.Name | + New-UMSDeviceDirectory | Tee-Object -Variable 'NewUMSDeviceDirectory').Id | + Move-UMSDeviceDirectory @MoveParams | Tee-Object -Variable 'MoveUMSDeviceDirectory').Id | + Update-UMSDeviceDirectory @UpdateParams | Tee-Object -Variable 'UpdateUMSDeviceDirectory').Id | + Remove-UMSDeviceDirectory | Tee-Object -Variable 'RemoveUMSDeviceDirectory' + $NewUMSDeviceDirectory + $MoveUMSDeviceDirectory + $UpdateUMSDeviceDirectory + $RemoveUMSDeviceDirectory +) +$Result +#> -$Result = '' -$Result = $Params1 | New-UMSDevice -#$Result = $Params1.Mac | New-UMSDevice -FirmwareId 1 +<# + $NewParams = @{ + Mac = '0A00000000FF' + Name = 'NewDevice' + FirmwareId = 1 + ParentId = -1 + } + $MoveParams = @{ + Id = 540 # eff + DestId = 527 + } + $UpdateParams = @{ + Name = 'UpdatedProfile' + } + $RemoveParams = @{ + Confirm = $false + } + $Result = @( + $null = ((($NewParams.Mac | + New-UMSDevice -FirmwareId $NewParams.FirmwareId | Tee-Object -Variable 'NewUMSDevice').Id | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | + Remove-UMSDevice @RemoveParams | Tee-Object -Variable 'RemoveUMSDevice' + + $NewUMSDevice + $MoveUMSDevice + $UpdateUMSDevice + $RemoveUMSDevice + ) + $Result + #> + + +<# +$Result = @( + $null = [pscustomobject]$NewParams | + New-UMSDevice | Tee-Object -Variable 'NewUMSDevice' | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | + Remove-UMSDevice @RemoveParams | Tee-Object -Variable 'RemoveUMSDevice' + + $NewUMSDevice + $MoveUMSDevice + $UpdateUMSDevice + $RemoveUMSDevice +) $Result -#($Result[0].MovedToBin).Gettype() +#> <# -Assert-Equivalent -Actual $Result -Expected $Result1 -$Result = New-UMSDeviceDirectory -Name 'QandA' # 01 +$Result = '' +$Result #> \ No newline at end of file diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 9e5b749..d0cd30d 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -12,6 +12,7 @@ Integration Tests Config DeviceRootDirId = 502 # Devices/PSIGEL Tests = @( + # Get-UMSStatus @{ Function = 'Get-UMSStatus' ParameterSets = @{ @@ -30,6 +31,7 @@ Integration Tests Config } } } + # New-UMSDeviceDirectory @{ Function = 'New-UMSDeviceDirectory' ParameterSets = @{ @@ -48,6 +50,7 @@ Integration Tests Config } } } + # New-UMSDevice @{ Function = 'New-UMSDevice' ParameterSets = @{ @@ -86,6 +89,7 @@ Integration Tests Config } } } + # New-UMSProfileDirectory @{ Function = 'New-UMSProfileDirectory' ParameterSets = @{ @@ -104,30 +108,7 @@ Integration Tests Config } } } - @{ - Function = 'Get-UMSFirmware' - ParameterSets = @{ - Default = @{ - Expected = @( - @{ - Id = 1 - Product = 'IGEL OS 11' - Version = '11.3.100.1' - FirmwareType = 'LX' - } - @{ - Id = 2 - Product = 'IGEL OS 11' - Version = '11.3.110.1' - FirmwareType = 'LX' - } - ) - Options = @{ - #ExcludedPaths = 'Id' - } - } - } - } + # New-UMSProfileAssignment @{ Function = 'New-UMSProfileAssignment' ParameterSets = @{ @@ -162,6 +143,7 @@ Integration Tests Config } } } + # Remove-UMSDevice @{ Function = 'Remove-UMSDevice' ParameterSets = @{ @@ -188,6 +170,7 @@ Integration Tests Config } } } + # Remove-UMSDeviceDirectory @{ Function = 'Remove-UMSDeviceDirectory' ParameterSets = @{ @@ -207,6 +190,7 @@ Integration Tests Config } } } + # Remove-UMSProfile @{ Function = 'Remove-UMSProfile' ParameterSets = @{ @@ -224,6 +208,7 @@ Integration Tests Config } } } + # Remove-UMSProfileDirectory @{ Function = 'Remove-UMSProfileDirectory' ParameterSets = @{ @@ -241,6 +226,7 @@ Integration Tests Config } } } + # Remove-UMSProfileAssignment @{ Function = 'Remove-UMSProfileAssignment' ParameterSets = @{ @@ -275,6 +261,7 @@ Integration Tests Config } } } + # Move-UMSDevice @{ Function = 'Move-UMSDevice' ParameterSets = @{ @@ -319,6 +306,7 @@ Integration Tests Config } } } + # Move-UMSDeviceDirectory @{ Function = 'Move-UMSDeviceDirectory' ParameterSets = @{ @@ -347,6 +335,7 @@ Integration Tests Config } } } + # Move-UMSProfileDirectory @{ Function = 'Move-UMSProfileDirectory' ParameterSets = @{ @@ -367,6 +356,7 @@ Integration Tests Config } } } + # Move-UMSProfile @{ Function = 'Move-UMSProfile' ParameterSets = @{ @@ -387,6 +377,7 @@ Integration Tests Config } } } + # Update-UMSDeviceDirectory @{ Function = 'Update-UMSDeviceDirectory' ParameterSets = @{ @@ -415,6 +406,7 @@ Integration Tests Config } } } + #Update-UMSDevice @{ Function = 'Update-UMSDevice' ParameterSets = @{ @@ -459,6 +451,7 @@ Integration Tests Config } } } + # Update-UMSProfileDirectory @{ Function = 'Update-UMSProfileDirectory' ParameterSets = @{ @@ -479,6 +472,7 @@ Integration Tests Config } } } + # Update-UMSProfile @{ Function = 'Update-UMSProfile' ParameterSets = @{ @@ -499,6 +493,385 @@ Integration Tests Config } } } + # Pipeline.UMSProfileAssignment + @{ + Function = 'Pipeline.UMSProfileAssignment' + ParameterSets = @{ + ValueFromPipeline = @{ + NewAssignmentParams = @{ + Id = 595 # SES_RDP_Session02 + ReceiverId = 512 # A-DEV-005 + ReceiverType = 'tc' + } + RemoveAssignmentParams = @{ + Id = 595 # SES_RDP_Session02 + ReceiverId = 512 # A-DEV-005 + ReceiverType = 'tc' + } + Expected = @( + @{ + Id = 595 + Message = '1 asssignments successfully assigned to device <{1}>.' + ReceiverId = 512 + ReceiverType = 'tc' + } + @{ + Id = 595 + Message = 'deleted profile assignment.' + ReceiverId = 512 + ReceiverType = 'tc' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ValueFromPipelineByPropertyName = @{ + NewAssignmentParams = @{ + Id = 596 # SES_RDP_Session03 + ReceiverId = 514 # A_Development + ReceiverType = 'tcdirectory' + } + RemoveAssignmentParams = @{ + Id = 596 # SES_RDP_Session03 + ReceiverId = 514 # A_Development + ReceiverType = 'tcdirectory' + } + Expected = @( + @{ + Id = 596 + Message = '1 asssignments successfully assigned to device directory <{1}>.' + ReceiverId = 514 + ReceiverType = 'tcdirectory' + } + @{ + Id = 596 + Message = 'deleted profile assignment.' + ReceiverId = 514 + ReceiverType = 'tcdirectory' + } + ) + Options = @{ + ExcludedPaths = '' + } + } + + } + } + # Pipeline.UMSDevice + @{ + Function = 'Pipeline.UMSDevice' + ParameterSets = @{ + ValueFromPipeline = @{ + NewParams = @{ + Mac = '0A00000000AA' + Name = 'NewDevice01' + FirmwareId = 1 + ParentId = -1 + } + MoveParams = @{ + DestId = 502 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedDevice01' + } + Expected = @( + @{ + Mac = '0A00000000AA' + Message = 'Device successfully inserted.' + Id = 629 + Name = 'NewDevice' + ParentId = -1 + } + @{ + Id = 629 + Message = 'successful.' + } + @{ + Message = 'Update successful.' + Id = 629 + } + @{ + Message = 'Offline deletion successful.' + Id = 629 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ValueFromPipelineByPropertyName = @{ + NewParams = @{ + Mac = '0A00000000AB' + Name = 'NewDevice02' + FirmwareId = 1 + ParentId = -1 + } + MoveParams = @{ + DestId = 502 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedDevice02' + } + Expected = @( + @{ + Mac = '0A00000000AB' + Message = 'Device successfully inserted.' + Id = 629 + Name = 'NewDevice' + ParentId = -1 + } + @{ + Id = 629 + Message = 'successful.' + } + @{ + Message = 'Update successful.' + Id = 629 + } + @{ + Message = 'Offline deletion successful.' + Id = 629 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + + } + } + # Pipeline.UMSDeviceDirectory + @{ + Function = 'Pipeline.UMSDeviceDirectory' + ParameterSets = @{ + ValueFromPipeline = @{ + NewParams = @{ + Name = 'NewDeviceDirectory01' + } + MoveParams = @{ + DestId = 502 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedDeviceDirectory01' + } + Expected = @( + @{ + Message = 'Directory successfully inserted.' + Id = 629 + Name = 'NewDeviceDirectory01' + } + @{ + Id = 629 + Message = 'successful.' + } + @{ + Message = 'Update successful.' + Id = 629 + } + @{ + Message = 'Offline deletion successful.' + Id = 629 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ValueFromPipelineByPropertyName = @{ + NewParams = @{ + Name = 'NewDeviceDirectory02' + } + MoveParams = @{ + DestId = 502 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedDeviceDirectory02' + } + Expected = @( + @{ + Message = 'Directory successfully inserted.' + Id = 629 + Name = 'NewDeviceDirectory02' + ParentId = -1 + } + @{ + Id = 629 + Message = 'successful.' + } + @{ + Message = 'Update successful.' + Id = 629 + } + @{ + Message = 'Offline deletion successful.' + Id = 629 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + } + } + # Pipeline.UMSProfile + @{ + Function = 'Pipeline.UMSProfile' + ParameterSets = @{ + ValueFromPipeline = @{ + MoveParams = @{ + Id = 595 # SES_RDP_Session02 + DestId = 527 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedProfile' + } + Expected = @( + @{ + Id = 595 + Message = 'successful' + } + @{ + Message = 'Update successful.' + Id = 595 + } + @{ + Message = 'Deleted profile.' + Id = 595 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ValueFromPipelineByPropertyName = @{ + MoveParams = @{ + Id = 596 # SES_RDP_Session03 + DestId = 527 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedProfile' + } + Expected = @( + @{ + Id = 596 + Message = 'successful' + } + @{ + Message = 'Update successful.' + Id = 596 + } + @{ + Message = 'Deleted profile.' + Id = 596 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + + } + } + # Pipeline.UMSProfileDirectory + @{ + Function = 'Pipeline.UMSProfileDirectory' + ParameterSets = @{ + ValueFromPipeline = @{ + NewParams = @{ + Name = 'NewProfileDirectory01' + } + MoveParams = @{ + DestId = 527 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedProfileDirectory01' + } + Expected = @( + @{ + Message = 'Directory successfully inserted.' + Id = 629 + Name = 'NewProfileDirectory01' + } + @{ + Id = 629 + Message = 'successful.' + } + @{ + Message = 'Updated directory successfully.' + Id = 629 + } + @{ + Message = 'Deletion successful.' + Id = 629 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + ValueFromPipelineByPropertyName = @{ + NewParams = @{ + Name = 'NewProfileDirectory02' + } + MoveParams = @{ + DestId = 527 # PSIGEL + } + UpdateParams = @{ + Name = 'UpdatedProfileDirectory02' + } + Expected = @( + @{ + Message = 'Directory successfully inserted.' + Id = 629 + Name = 'NewProfileDirectory02' + ParentId = -1 + } + @{ + Id = 629 + Message = 'successful.' + } + @{ + Message = 'Updated directory successfully.' + Id = 629 + } + @{ + Message = 'Deletion successful.' + Id = 629 + } + ) + Options = @{ + ExcludedPaths = '' + } + } + } + } + # Get-UMSFirmware + @{ + Function = 'Get-UMSFirmware' + ParameterSets = @{ + Default = @{ + Expected = @( + @{ + Id = 1 + Product = 'IGEL OS 11' + Version = '11.3.100.1' + FirmwareType = 'LX' + } + @{ + Id = 2 + Product = 'IGEL OS 11' + Version = '11.3.110.1' + FirmwareType = 'LX' + } + ) + Options = @{ + #ExcludedPaths = 'Id' + } + } + } + } + # Get-UMSDevice @{ Function = 'Get-UMSDevice' ParameterSets = @{ @@ -708,6 +1081,7 @@ Integration Tests Config } } } + # Get-UMSDeviceDirectory @{ Function = 'Get-UMSDeviceDirectory' ParameterSets = @{ @@ -821,6 +1195,7 @@ Integration Tests Config } } } + # Get-UMSProfile @{ Function = 'Get-UMSProfile' ParameterSets = @{ @@ -895,6 +1270,7 @@ Integration Tests Config } } } + # Get-UMSProfileDirectory @{ Function = 'Get-UMSProfileDirectory' ParameterSets = @{ @@ -986,6 +1362,7 @@ Integration Tests Config } } } + # Get-UMSProfileAssignment @{ Function = 'Get-UMSProfileAssignment' ParameterSets = @{ @@ -1033,6 +1410,7 @@ Integration Tests Config } } } + # Get-UMSDeviceAssignment @{ Function = 'Get-UMSDeviceAssignment' ParameterSets = @{ @@ -1080,6 +1458,7 @@ Integration Tests Config } } } + # Get-UMSDeviceDirectoryAssignment @{ Function = 'Get-UMSDeviceDirectoryAssignment' ParameterSets = @{ @@ -1127,6 +1506,7 @@ Integration Tests Config } } } + # Get-UMSDirectoryRecursive @{ Function = 'Get-UMSDirectoryRecursive' ParameterSets = @{ @@ -1242,90 +1622,5 @@ Integration Tests Config } } } - @{ - Function = 'Pipeline' - ParameterSets = @{ - UMSDevice = @{ - Params1 = @{ - Mac = '0A00000000FF' - Name = 'PipelineDevice' - FirmwareId = 1 - ParentId = -1 - } - Params2 = @{ - DeviceDirectoryId = 502 - DeviceUpdateName = 'PipelineDeviceUpdated' - } - Expected = @( - @{ - - } - @{ - - } - ) - Options = @{ - ExcludedPaths = '' - } - } - UMSDeviceDirectory = @{ - Params1 = @{ - Id = 111 - } - Params2 = @{ - Id = 222 - } - Expected = @( - @{ - - } - @{ - - } - ) - Options = @{ - ExcludedPaths = '' - } - } - UMSProfile = @{ - Params1 = @{ - Id = 111 - } - Params2 = @{ - Id = 222 - } - Expected = @( - @{ - - } - @{ - - } - ) - Options = @{ - ExcludedPaths = '' - } - } - UMSProfileDirectory = @{ - Params1 = @{ - Id = 111 - } - Params2 = @{ - Id = 222 - } - Expected = @( - @{ - - } - @{ - - } - ) - Options = @{ - ExcludedPaths = '' - } - } - } - } ) } diff --git a/Tests/Pipeline.Tests.ps1 b/Tests/Pipeline.Tests.ps1 deleted file mode 100644 index 6763c1b..0000000 --- a/Tests/Pipeline.Tests.ps1 +++ /dev/null @@ -1,65 +0,0 @@ -$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) -$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) -$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf -$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force - -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath - - $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $Cfg.Computername - '*-UMS*:TCPPort' = $Cfg.TCPPort - '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol - '*-UMS*:Confirm' = $False - } - - $WebSession = New-UMSAPICookie - $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession - } - - Context "ParameterSetName UMSDevice" { - - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.UMSDevice - - It "doesn't throw" { - $Params1 = $TestCfg.Params1 - Write-Host $Params1.Mac - { $Script:Result = @( - $Params1 | - New-UMSDevice #| - #Move-UMSDevice -DestId $Params1.DeviceDirectoryId | - #Update-UMSDevice -Name $Params1.DeviceUpdateName | - #Remove-UMSDevice - ) } | Should Not Throw - } - - It 'Result should not be null or empty' { - $Result | Should not BeNullOrEmpty - } - - <# - It 'Result[0].Id should have type [Int]' { - $Result[0].Id | Should -HaveType [Int] - } - - It 'Result[0].Message should have type [String]' { - $Result[0].Message | Should -HaveType [String] - } - - It "Result should be Equivalent to Expected" { - [array]$Expected = foreach ($item In $TestCfg.Expected) - { - New-Object psobject -Property $item - } - Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ - ExcludedPaths = $TestCfg.Options.ExcludedPaths - } - } - #> - } -} \ No newline at end of file From e589143a5096a57c34e0760e3628930cb95ff748 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 8 Mar 2020 14:27:21 +0100 Subject: [PATCH 071/145] working on Tests --- Tests/Pipeline.UMSDevice.Tests.ps1 | 119 ++++++++++++++++++ Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 | 119 ++++++++++++++++++ Tests/Pipeline.UMSProfile.Tests.ps1 | 110 ++++++++++++++++ Tests/Pipeline.UMSProfileAssignment.Tests.ps1 | 108 ++++++++++++++++ Tests/Pipeline.UMSProfileDirectory.Tests.ps1 | 117 +++++++++++++++++ 5 files changed, 573 insertions(+) create mode 100644 Tests/Pipeline.UMSDevice.Tests.ps1 create mode 100644 Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 create mode 100644 Tests/Pipeline.UMSProfile.Tests.ps1 create mode 100644 Tests/Pipeline.UMSProfileAssignment.Tests.ps1 create mode 100644 Tests/Pipeline.UMSProfileDirectory.Tests.ps1 diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 new file mode 100644 index 0000000..d60d95f --- /dev/null +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -0,0 +1,119 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False + } + + $WebSession = New-UMSAPICookie + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ValueFromPipeline" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + + It "doesn't throw" { + $NewParams = $TestCfg.NewParams + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = [pscustomobject]$NewParams | + New-UMSDevice | Tee-Object -Variable 'NewUMSDevice' | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | + Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' + $NewUMSDevice + $MoveUMSDevice + $UpdateUMSDevice + $RemoveUMSDevice + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + + } + + Context "ValueFromPipelineByPropertyName" { + + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + + It "doesn't throw" { + $NewParams = $TestCfg.NewParams + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + { $Script:Result = @( + $null = ((($NewParams.Mac | + New-UMSDevice -FirmwareId $NewParams.FirmwareId | Tee-Object -Variable 'NewUMSDevice').Id | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | + Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' + $NewUMSDevice + $MoveUMSDevice + $UpdateUMSDevice + $RemoveUMSDevice + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + + } + +} \ No newline at end of file diff --git a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 new file mode 100644 index 0000000..22104b4 --- /dev/null +++ b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 @@ -0,0 +1,119 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False + } + + $WebSession = New-UMSAPICookie + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ValueFromPipeline" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + + It "doesn't throw" { + $NewParams = $TestCfg.NewParams + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = [pscustomobject]$NewParams | + New-UMSDeviceDirectory | Tee-Object -Variable 'NewUMSDeviceDirectory' | + Move-UMSDeviceDirectory @MoveParams | Tee-Object -Variable 'MoveUMSDeviceDirectory' | + Update-UMSDeviceDirectory @UpdateParams | Tee-Object -Variable 'UpdateUMSDeviceDirectory' | + Remove-UMSDeviceDirectory | Tee-Object -Variable 'RemoveUMSDeviceDirectory' + $NewUMSDeviceDirectory + $MoveUMSDeviceDirectory + $UpdateUMSDeviceDirectory + $RemoveUMSDeviceDirectory + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + + } + + Context "ValueFromPipelineByPropertyName" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + + It "doesn't throw" { + $NewParams = $TestCfg.NewParams + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + { $Script:Result = @( + #<# + $null = ((($NewParams.Name | + New-UMSDeviceDirectory | Tee-Object -Variable 'NewUMSDeviceDirectory').Id | + Move-UMSDeviceDirectory @MoveParams | Tee-Object -Variable 'MoveUMSDeviceDirectory').Id | + Update-UMSDeviceDirectory @UpdateParams | Tee-Object -Variable 'UpdateUMSDeviceDirectory').Id | + Remove-UMSDeviceDirectory | Tee-Object -Variable 'RemoveUMSDeviceDirectory' + $NewUMSDeviceDirectory + $MoveUMSDeviceDirectory + $UpdateUMSDeviceDirectory + $RemoveUMSDeviceDirectory + #> + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + + } +} diff --git a/Tests/Pipeline.UMSProfile.Tests.ps1 b/Tests/Pipeline.UMSProfile.Tests.ps1 new file mode 100644 index 0000000..dfff1bd --- /dev/null +++ b/Tests/Pipeline.UMSProfile.Tests.ps1 @@ -0,0 +1,110 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False + } + + $WebSession = New-UMSAPICookie + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ValueFromPipeline" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + + It "doesn't throw" { + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = [pscustomobject]$MoveParams | + Move-UMSProfile -DestId $MoveParams.DestId | Tee-Object -Variable 'MoveUMSProfile' | + Update-UMSProfile @UpdateParams | Tee-Object -Variable 'UpdateUMSProfile' | + Remove-UMSProfile | Tee-Object -Variable 'RemoveUMSProfile' + $MoveUMSProfile + $UpdateUMSProfile + $RemoveUMSProfile + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + + Context "ValueFromPipelineByPropertyName" { + + $Script:Result + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + + It "doesn't throw" { + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = (($MoveParams.Id | + Move-UMSProfile -DestId $MoveParams.DestId | Tee-Object -Variable 'MoveUMSProfile').Id | + Update-UMSProfile @UpdateParams | Tee-Object -Variable 'UpdateUMSProfile').Id | + Remove-UMSProfile | Tee-Object -Variable 'RemoveUMSProfile' + $MoveUMSProfile + $UpdateUMSProfile + $RemoveUMSProfile + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + } + +} \ No newline at end of file diff --git a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 new file mode 100644 index 0000000..4e2d754 --- /dev/null +++ b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 @@ -0,0 +1,108 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False + } + + $WebSession = New-UMSAPICookie + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ValueFromPipeline" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + + It "doesn't throw" { + $NewAssignmentParams = $TestCfg.NewAssignmentParams + $RemoveAssignmentParams = $TestCfg.RemoveAssignmentParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = [pscustomobject]$NewAssignmentParams | + New-UMSProfileAssignment -ReceiverId $NewAssignmentParams.ReceiverId -ReceiverType $NewAssignmentParams.ReceiverType | Tee-Object -Variable 'NewUMSProfileAssignment' | + Remove-UMSProfileAssignment -ReceiverId $RemoveAssignmentParams.ReceiverId -ReceiverType $RemoveAssignmentParams.ReceiverType | Tee-Object -Variable 'RemoveUMSProfileAssignment' + $NewUMSProfileAssignment + $RemoveUMSProfileAssignment + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + } + + Context "ValueFromPipelineByPropertyName" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + + It "doesn't throw" { + $NewAssignmentParams = $TestCfg.NewAssignmentParams + $RemoveAssignmentParams = $TestCfg.RemoveAssignmentParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = (($NewAssignmentParams.Id | + New-UMSProfileAssignment -ReceiverId $NewAssignmentParams.ReceiverId -ReceiverType $NewAssignmentParams.ReceiverType | Tee-Object -Variable 'NewUMSProfileAssignment').Id | + Remove-UMSProfileAssignment -ReceiverId $RemoveAssignmentParams.ReceiverId -ReceiverType $RemoveAssignmentParams.ReceiverType | Tee-Object -Variable 'RemoveUMSProfileAssignment').Id + $NewUMSProfileAssignment + $RemoveUMSProfileAssignment + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + + } + +} \ No newline at end of file diff --git a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 new file mode 100644 index 0000000..66d0856 --- /dev/null +++ b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 @@ -0,0 +1,117 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False + } + + $WebSession = New-UMSAPICookie + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ValueFromPipeline" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + + It "doesn't throw" { + $NewParams = $TestCfg.NewParams + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + Write-Host $Params1.Mac + { $Script:Result = @( + $null = [pscustomobject]$NewParams | + New-UMSProfileDirectory | Tee-Object -Variable 'NewUMSProfileDirectory' | + Move-UMSProfileDirectory @MoveParams | Tee-Object -Variable 'MoveUMSProfileDirectory' | + Update-UMSProfileDirectory @UpdateParams | Tee-Object -Variable 'UpdateUMSProfileDirectory' | + Remove-UMSProfileDirectory | Tee-Object -Variable 'RemoveUMSProfileDirectory' + $NewUMSProfileDirectory + $MoveUMSProfileDirectory + $UpdateUMSProfileDirectory + $RemoveUMSProfileDirectory + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + } + + Context "ValueFromPipelineByPropertyName" { + + $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + + It "doesn't throw" { + $NewParams = $TestCfg.NewParams + $MoveParams = $TestCfg.MoveParams + $UpdateParams = $TestCfg.UpdateParams + + { $Script:Result = @( + $null = ((($NewParams.Name | + New-UMSProfileDirectory | Tee-Object -Variable 'NewUMSProfileDirectory').Id | + Move-UMSProfileDirectory @MoveParams | Tee-Object -Variable 'MoveUMSProfileDirectory').Id | + Update-UMSProfileDirectory @UpdateParams | Tee-Object -Variable 'UpdateUMSProfileDirectory').Id | + Remove-UMSProfileDirectory | Tee-Object -Variable 'RemoveUMSProfileDirectory' + $NewUMSProfileDirectory + $MoveUMSProfileDirectory + $UpdateUMSProfileDirectory + $RemoveUMSProfileDirectory + ) } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result[0].Id should have type [Int]' { + $Result[0].Id | Should -HaveType [Int] + } + + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] + } + + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } + } + $Result = '' + } + +} \ No newline at end of file From 7fec9e41b4e12e891061d4c4c67f1f201572f9a7 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 9 Mar 2020 14:10:49 +0100 Subject: [PATCH 072/145] edited IntegrationTests --- Tests/IntegrationTestsConfig.psd1 | 138 ++++++++++++++--------------- Tests/Pipeline.UMSDevice.Tests.ps1 | 2 +- 2 files changed, 69 insertions(+), 71 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index d0cd30d..c9238c4 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -41,7 +41,7 @@ Integration Tests Config } Expected = @{ Message = 'Directory successfully inserted.' - Id = 594 + Id = 597 Name = 'QA' } Options = @{ @@ -71,14 +71,14 @@ Integration Tests Config @{ Mac = '0A0000000007' Message = 'Device successfully inserted.' - Id = 595 + Id = 598 Name = '007' ParentId = -1 } @{ Mac = '0A0000000008' Message = 'Device successfully inserted.' - Id = 596 + Id = 599 Name = '008' ParentId = - 1 } @@ -99,7 +99,7 @@ Integration Tests Config } Expected = @{ Message = 'Directory successfully inserted.' - Id = 597 + Id = 600 Name = 'Devices' } Options = @{ @@ -275,12 +275,12 @@ Integration Tests Config DestId = 514 # A_Development } Params3 = @{ - Id = 595 # 007 - DestId = 594 # QA + Id = 598 # 007 + DestId = 597 # QA } Params4 = @{ - Id = 596 # 008 - DestId = 594 # QA + Id = 599 # 008 + DestId = 597 # QA } Expected = @( @{ @@ -292,11 +292,11 @@ Integration Tests Config Message = 'successful.' } @{ - Id = 595 + Id = 598 Message = 'successful.' } @{ - Id = 596 + Id = 599 Message = 'successful.' } ) @@ -312,7 +312,7 @@ Integration Tests Config ParameterSets = @{ Default = @{ Params1 = @{ - Id = 594 # QA + Id = 597 # QA DestId = 511 # Augsburg } Params2 = @{ @@ -321,7 +321,7 @@ Integration Tests Config } Expected = @( @{ - Id = 594 + Id = 597 Message = 'successful.' } @{ @@ -387,7 +387,7 @@ Integration Tests Config Name = 'BR_Development' } Params2 = @{ - Id = 594 # QA + Id = 597 # QA Name = 'A_QA' } Expected = @( @@ -396,7 +396,7 @@ Integration Tests Config Message = 'Updated directory successfully.' } @{ - Id = 594 + Id = 597 Message = 'Updated directory successfully.' } ) @@ -420,11 +420,11 @@ Integration Tests Config Name = 'A-DEV-010' } Params3 = @{ - Id = 595 # 007 + Id = 598 # 007 Name = 'A-QA-007' } Params4 = @{ - Id = 596 # 008 + Id = 599 # 008 Name = 'A-QA-008' } Expected = @( @@ -437,11 +437,11 @@ Integration Tests Config Message = 'Update successful.' } @{ - Id = 595 + Id = 598 Message = 'Update successful.' } @{ - Id = 596 + Id = 599 Message = 'Update successful.' } ) @@ -579,21 +579,21 @@ Integration Tests Config @{ Mac = '0A00000000AA' Message = 'Device successfully inserted.' - Id = 629 - Name = 'NewDevice' + Id = 601 + Name = 'NewDevice01' ParentId = -1 } @{ - Id = 629 + Id = 601 Message = 'successful.' } @{ Message = 'Update successful.' - Id = 629 + Id = 601 } @{ Message = 'Offline deletion successful.' - Id = 629 + Id = 601 } ) Options = @{ @@ -617,21 +617,21 @@ Integration Tests Config @{ Mac = '0A00000000AB' Message = 'Device successfully inserted.' - Id = 629 - Name = 'NewDevice' + Id = 602 + Name = 'NewDevice02' ParentId = -1 } @{ - Id = 629 + Id = 602 Message = 'successful.' } @{ Message = 'Update successful.' - Id = 629 + Id = 602 } @{ Message = 'Offline deletion successful.' - Id = 629 + Id = 602 } ) Options = @{ @@ -658,20 +658,20 @@ Integration Tests Config Expected = @( @{ Message = 'Directory successfully inserted.' - Id = 629 + Id = 603 Name = 'NewDeviceDirectory01' } @{ - Id = 629 + Id = 603 Message = 'successful.' } @{ - Message = 'Update successful.' - Id = 629 + Message = 'Updated directory successfully.' + Id = 603 } @{ - Message = 'Offline deletion successful.' - Id = 629 + Message = 'Deletion successful.' + Id = 603 } ) Options = @{ @@ -690,22 +690,21 @@ Integration Tests Config } Expected = @( @{ - Message = 'Directory successfully inserted.' - Id = 629 - Name = 'NewDeviceDirectory02' - ParentId = -1 + Message = 'Directory successfully inserted.' + Id = 604 + Name = 'NewDeviceDirectory02' } @{ - Id = 629 + Id = 604 Message = 'successful.' } @{ - Message = 'Update successful.' - Id = 629 + Message = 'Updated directory successfully.' + Id = 604 } @{ - Message = 'Offline deletion successful.' - Id = 629 + Message = 'Deletion successful.' + Id = 604 } ) Options = @{ @@ -790,20 +789,20 @@ Integration Tests Config Expected = @( @{ Message = 'Directory successfully inserted.' - Id = 629 + Id = 605 Name = 'NewProfileDirectory01' } @{ - Id = 629 + Id = 605 Message = 'successful.' } @{ Message = 'Updated directory successfully.' - Id = 629 + Id = 605 } @{ Message = 'Deletion successful.' - Id = 629 + Id = 605 } ) Options = @{ @@ -822,22 +821,21 @@ Integration Tests Config } Expected = @( @{ - Message = 'Directory successfully inserted.' - Id = 629 - Name = 'NewProfileDirectory02' - ParentId = -1 + Message = 'Directory successfully inserted.' + Id = 606 + Name = 'NewProfileDirectory02' } @{ - Id = 629 + Id = 606 Message = 'successful.' } @{ Message = 'Updated directory successfully.' - Id = 629 + Id = 606 } @{ Message = 'Deletion successful.' - Id = 629 + Id = 606 } ) Options = @{ @@ -968,23 +966,23 @@ Integration Tests Config MovedToBin = 'False' } @{ - Id = 595 + Id = 598 ObjectType = 'tc' UnitId = '0A0000000007' Mac = '0A0000000007' Name = 'A-QA-007' - ParentId = 594 + ParentId = 597 FirmwareId = 1 LastIp = '' MovedToBin = 'False' } @{ - Id = 596 + Id = 599 ObjectType = 'tc' UnitId = '0A0000000008' Mac = '0A0000000008' Name = 'A-QA-008' - ParentId = 594 + ParentId = 597 FirmwareId = 1 LastIp = '' MovedToBin = 'False' @@ -1097,7 +1095,7 @@ Integration Tests Config ObjectType = 'tcdirectory' } @{ - Id = 594 + Id = 597 Name = 'A_QA' ParentId = 511 MovedToBin = 'False' @@ -1300,16 +1298,16 @@ Integration Tests Config ObjectType = 'profiledirectory' } @{ - Id = 597 - Name = 'Devices' - ParentId = -2 + Id = 534 + Name = 'User Interface' + ParentId = 527 MovedToBin = 'False' ObjectType = 'profiledirectory' } @{ - Id = 534 - Name = 'User Interface' - ParentId = 527 + Id = 600 + Name = 'Devices' + ParentId = -2 MovedToBin = 'False' ObjectType = 'profiledirectory' } @@ -1531,7 +1529,7 @@ Integration Tests Config ObjectType = 'tcdirectory' } @{ - Id = 594 + Id = 597 Name = 'A_QA' ParentId = 511 MovedToBin = 'False' @@ -1594,23 +1592,23 @@ Integration Tests Config MovedToBin = 'False' } @{ - Id = 595 + Id = 598 ObjectType = 'tc' UnitId = '0A0000000007' Mac = '0A0000000007' Name = 'A-QA-007' - ParentId = 594 + ParentId = 597 FirmwareId = 1 LastIp = '' MovedToBin = 'False' } @{ - Id = 596 + Id = 599 ObjectType = 'tc' UnitId = '0A0000000008' Mac = '0A0000000008' Name = 'A-QA-008' - ParentId = 594 + ParentId = 597 FirmwareId = 1 LastIp = '' MovedToBin = 'False' diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 index d60d95f..b3ea151 100644 --- a/Tests/Pipeline.UMSDevice.Tests.ps1 +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -80,7 +80,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $UpdateParams = $TestCfg.UpdateParams { $Script:Result = @( $null = ((($NewParams.Mac | - New-UMSDevice -FirmwareId $NewParams.FirmwareId | Tee-Object -Variable 'NewUMSDevice').Id | + New-UMSDevice -FirmwareId $NewParams.FirmwareId -Name $NewParams.Name | Tee-Object -Variable 'NewUMSDevice').Id | Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' From 84c7a7fce560e19b16a78c5efaed85d558b30d72 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 9 Mar 2020 15:55:40 +0100 Subject: [PATCH 073/145] removed OS* Functions --- Docs/Get-OSFirmware.md | 73 ---------- Docs/Get-OSUpdateConfiguration.md | 77 ---------- Docs/Get-OSWifiConnection.md | 98 ------------- PSIGEL/PSIGEL.psd1 | 3 - PSIGEL/Public/Get-OSFirmware.ps1 | 33 ----- PSIGEL/Public/Get-OSUpdateConfiguration.ps1 | 66 --------- PSIGEL/Public/Get-OSWifiConnection.ps1 | 86 ----------- README.MD | 12 -- Tests/Get-OSFirmware.Tests.ps1 | 88 ------------ Tests/Get-OSUpdateConfiguration.Tests.ps1 | 118 --------------- Tests/Get-OSWifiConnection.Tests.ps1 | 152 -------------------- 11 files changed, 806 deletions(-) delete mode 100644 Docs/Get-OSFirmware.md delete mode 100644 Docs/Get-OSUpdateConfiguration.md delete mode 100644 Docs/Get-OSWifiConnection.md delete mode 100644 PSIGEL/Public/Get-OSFirmware.ps1 delete mode 100644 PSIGEL/Public/Get-OSUpdateConfiguration.ps1 delete mode 100644 PSIGEL/Public/Get-OSWifiConnection.ps1 delete mode 100644 Tests/Get-OSFirmware.Tests.ps1 delete mode 100644 Tests/Get-OSUpdateConfiguration.Tests.ps1 delete mode 100644 Tests/Get-OSWifiConnection.Tests.ps1 diff --git a/Docs/Get-OSFirmware.md b/Docs/Get-OSFirmware.md deleted file mode 100644 index d3c9db0..0000000 --- a/Docs/Get-OSFirmware.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -external help file: PSIGEL-help.xml -Module Name: PSIGEL -online version: -schema: 2.0.0 ---- - -# Get-OSFirmware - -## SYNOPSIS -Gets firmware from a device. - -## SYNTAX - -``` -Get-OSFirmware [-SSHSession] [] -``` - -## DESCRIPTION -Gets firmware from a device via Posh-SSH. - -## EXAMPLES - -### Example 1 - -Get firmware from device with name V10-01: - -```powershell -$Params = @{ - ComputerName = 'V10-01' - Credential = Get-Credential - AcceptKey = $true -} -$SSHSession = New-SSHSession @Params - -Get-OSFirmware -SSHSession $SSHSession - -Version -------- -10.05.500.01 -``` - -## PARAMETERS - -### -SSHSession -Posh-SSH SSHSession - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Object - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/Docs/Get-OSUpdateConfiguration.md b/Docs/Get-OSUpdateConfiguration.md deleted file mode 100644 index ed6287c..0000000 --- a/Docs/Get-OSUpdateConfiguration.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -external help file: PSIGEL-help.xml -Module Name: PSIGEL -online version: -schema: 2.0.0 ---- - -# Get-OSUpdateConfiguration - -## SYNOPSIS -Gets firmware from a device. - -## SYNTAX - -``` -Get-OSUpdateConfiguration [-SSHSession] [] -``` - -## DESCRIPTION -Gets update configuration from a device via Posh-SSH. - -## EXAMPLES - -### Example 1 - -Get update configuration from device with name V10-01: - -```powershell -$Params = @{ - ComputerName = 'V10-01' - Credential = Get-Credential - AcceptKey = $true -} -$SSHSession = New-SSHSession @Params - -Get-OSUpdateConfiguration -SSHSession $SSHSession - -Host : V10-01 -Protocol : http -Hostname : igelrmserver -Port : 9080 -Username : igelums -Password : 0009330f34121a177eb62d -Path : ums_filetransfer/IGEL_Universal_Desktop_LX-10.05.500 -``` - -## PARAMETERS - -### -SSHSession -Posh-SSH SSHSession - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Object - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/Docs/Get-OSWifiConnection.md b/Docs/Get-OSWifiConnection.md deleted file mode 100644 index edaab99..0000000 --- a/Docs/Get-OSWifiConnection.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -external help file: PSIGEL-help.xml -Module Name: PSIGEL -online version: -schema: 2.0.0 ---- - -# Get-OSWifiConnection - -## SYNOPSIS -Gets wifi connection from a device. - -## SYNTAX - -``` -Get-OSWifiConnection [-SSHSession] [[-Interface] ] [] -``` - -## DESCRIPTION -Gets wifi connection from a device via Posh-SSH. - -## EXAMPLES - -### Example 1 - -Get WiFi connection from device with name V10-01: - -```powershell -$Params = @{ - ComputerName = 'V10-01' - Credential = Get-Credential - AcceptKey = $true -} -$SSHSession = New-SSHSession @Params - -Get-OSUpdateConfiguration -SSHSession $SSHSession - -Host : V10-01 -Interface : wlan0 -ESSID : WLAN-0123456 -Mode : Managed -Frequency : 5,18 -AccessPoint : 00:42:6D:36:F8:E8 -BitRate : 18 -TxPower : 20 -LinkQualityActual : 68 -LinkQualityMax : 70 -SignalLevel : -42 -``` - -## PARAMETERS - -### -Interface -Wifi interface of the device - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 1 -Default value: wlan0 -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -SSHSession -Posh-SSH SSHSession - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Object - -### System.String - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index e173aa9..1639df1 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -69,9 +69,6 @@ # Aus diesem Modul zu exportierende Funktionen. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und loeschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Funktionen vorhanden sind. FunctionsToExport = @( - 'Get-OSFirmware' - 'Get-OSUpdateConfiguration' - 'Get-OSWifiConnection' 'Get-UMSDevice' 'Get-UMSDeviceAssignment' 'Get-UMSDeviceDirectory' diff --git a/PSIGEL/Public/Get-OSFirmware.ps1 b/PSIGEL/Public/Get-OSFirmware.ps1 deleted file mode 100644 index c0f77b4..0000000 --- a/PSIGEL/Public/Get-OSFirmware.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -#Requires -Modules Posh-SSH -function Get-OSFirmware -{ - [CmdletBinding()] - param ( - [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)] - $SSHSession - ) - - begin - { - $Command = "cat /etc/firmware" - } - process - { - try - { - $CommandResultColl = (Invoke-SSHCommandStream -SSHSession $SSHSession -Command $Command) -replace ('\s', '') - $Properties = [ordered]@{ - 'Version' = [Version]::new($CommandResultColl) - } - $Result = New-Object psobject -Property $Properties - $Result - } - catch - { - Write-Output -InputObject $PSItem.Exception.Message - } - } - end - { - } -} \ No newline at end of file diff --git a/PSIGEL/Public/Get-OSUpdateConfiguration.ps1 b/PSIGEL/Public/Get-OSUpdateConfiguration.ps1 deleted file mode 100644 index dda2b8d..0000000 --- a/PSIGEL/Public/Get-OSUpdateConfiguration.ps1 +++ /dev/null @@ -1,66 +0,0 @@ -#Requires -Modules Posh-SSH -function Get-OSUpdateConfiguration -{ - [CmdletBinding()] - param ( - [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)] - $SSHSession - ) - - begin - { - $Command = 'cat /wfs/updateconf.ini' - $PatternProtocol = 'protocol=\"(?.*)\"' - $PatternHostname = 'hostname=\"(?.*)\"' - $PatternPort = 'port=\"(?.*)\"' - $PatternUsername = 'username=\"(?.*)\"' - $PatternPassword = 'password=\"(?.*)\"' - $PatternPath = 'path=\"(?.*)\"' - } - process - { - try - { - $CommandResultColl = Invoke-SSHCommandStream -SSHSession $SSHSession -Command $Command - $Properties = [ordered]@{ - Host = [String]$SSHSession.Host - } - foreach ($CommandResult in $CommandResultColl) - { - if ($CommandResult -match $PatternProtocol) - { - $Properties.Protocol = [String]$matches.Protocol - } - if ($CommandResult -match $PatternHostname) - { - $Properties.Hostname = [String]$matches.Hostname - } - if ($CommandResult -match $PatternPort) - { - $Properties.Port = [Int]$matches.Port - } - if ($CommandResult -match $PatternUsername) - { - $Properties.Username = [String]$matches.Username - } - if ($CommandResult -match $PatternPassword) - { - $Properties.Password = [String]$matches.Password - } - if ($CommandResult -match $PatternPath) - { - $Properties.Path = [String]$matches.Path - } - } - $Result = New-Object psobject -Property $Properties - $Result - } - catch - { - Write-Output -InputObject $PSItem.Exception.Message - } - } - end - { - } -} \ No newline at end of file diff --git a/PSIGEL/Public/Get-OSWifiConnection.ps1 b/PSIGEL/Public/Get-OSWifiConnection.ps1 deleted file mode 100644 index ac9f926..0000000 --- a/PSIGEL/Public/Get-OSWifiConnection.ps1 +++ /dev/null @@ -1,86 +0,0 @@ -#Requires -Modules Posh-SSH -function Get-OSWifiConnection -{ - [CmdletBinding()] - param ( - [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)] - $SSHSession, - - [Parameter(ValueFromPipelineByPropertyName)] - [String] - $Interface = 'wlan0' - ) - - begin - { - $Command = "iwconfig $Interface" - $PatternESSID = 'ESSID(:|=)\"(?.*)\"' - $PatternMode = 'Mode(:|=)(?[^\s]*)' - $PatternFrequency = 'Frequency(:|=)(?[^\s]*)\s(?[^\s]*)' - $PatternAccessPoint = 'Access Point:\s(?[^\s]*)' - $PatternBitRate = 'Bit Rate(:|=)(?[^\s]*)\s(?[^\s]*)' - $PatternTxPower = 'Tx-Power(:|=)(?[^\s]*)\s(?[^\s]*)' - $PatternLinkQualityActual = 'Link Quality(:|=)(?\d+)' - $PatternLinkQualityMax = 'Link Quality(:|=)\d*\/(?\d+)' - $PatternSignalLevel = 'Signal level(:|=)(?[^\s]*)\s(?[^\s]*)' - } - process - { - try - { - $CommandResultColl = Invoke-SSHCommandStream -SSHSession $SSHSession -Command $Command - $Properties = [ordered]@{ - Host = [String]$SSHSession.Host - Interface = [String]$Interface - } - foreach ($CommandResult in $CommandResultColl) - { - if ($CommandResult -match $PatternESSID) - { - $Properties.ESSID = [String]$matches.ESSID - } - if ($CommandResult -match $PatternMode) - { - $Properties.Mode = [String]$matches.Mode - } - if ($CommandResult -match $PatternFrequency) - { - $Properties.Frequency = [Single]$matches.Frequency - } - if ($CommandResult -match $PatternAccessPoint) - { - $Properties.AccessPoint = [String]$matches.AccessPoint - } - if ($CommandResult -match $PatternBitRate) - { - $Properties.BitRate = [Int]$matches.BitRate - } - if ($CommandResult -match $PatternTxPower) - { - $Properties.TxPower = [Int]$matches.TxPower - } - if ($CommandResult -match $PatternLinkQualityActual) - { - $Properties.LinkQualityActual = [Int]$matches.LinkQualityActual - } - if ($CommandResult -match $PatternLinkQualityMax) - { - $Properties.LinkQualityMax = [Int]$matches.LinkQualityMax - } - if ($CommandResult -match $PatternSignalLevel) - { - $Properties.SignalLevel = [Int]$matches.SignalLevel - } - } - $Result = New-Object psobject -Property $Properties - $Result - } - catch - { - Write-Output -InputObject $PSItem.Exception.Message - } - } - end - { - } -} \ No newline at end of file diff --git a/README.MD b/README.MD index 66687c6..1a12ebd 100644 --- a/README.MD +++ b/README.MD @@ -6,10 +6,6 @@ Currently the module only supports PowerShell version **5.1** . **API** functions got the noun-prefix **UMS** (for Universal Management Server), e.g. Get-**UMS**Something -**SSH** functions got the noun-prefix **OS** (for Device), e.g. Get-**OS**Something - -To connect to the Devices via **SSH**, the Module [Posh-SSH](https://github.com/darkoperator/Posh-SSH) by Carlos Perez aka darkoperator is required. - The **API** uses a cookie as authentication. You can create it with [New-UMSAPICookie](/Docs/New-UMSAPICookie.md): ```powershell @@ -29,14 +25,6 @@ Install-Module -Name PSIGEL Alternatively you can download a ZIP file of the latest version from our [Releases](https://github.com/IGEL-Community/PSIGEL/releases) page. ## PSIGEL Cmdlets -### [Get-OSFirmware](/Docs/Get-OSFirmware.md) -Gets firmware from a device. - -### [Get-OSUpdateConfiguration](/Docs/Get-OSUpdateConfiguration.md) -Gets firmware from a device. - -### [Get-OSWifiConnection](/Docs/Get-OSWifiConnection.md) -Gets wifi connection from a device. ### [Get-UMSDevice](/Docs/Get-UMSDevice.md) Gets information on a device. diff --git a/Tests/Get-OSFirmware.Tests.ps1 b/Tests/Get-OSFirmware.Tests.ps1 deleted file mode 100644 index 710d048..0000000 --- a/Tests/Get-OSFirmware.Tests.ps1 +++ /dev/null @@ -1,88 +0,0 @@ -$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) -$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) -$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf -$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") - -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - $Global:ConfirmPreference = 'None' - . ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) - $PSDefaultParameterValues = @{ - '*:SSHSession' = New-MockObject -Type 'SSH.SshSession' - } - } - - Context "Parameter Validation" { - - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys - $KnownParameters = 'SSHSession' - - It "Should contain our specific parameters" { - (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count - } - } - - Context "Code Execution" { - Mock 'Invoke-SSHCommandStream' { - @' -10.05.500.01 -'@ - } - Mock 'Write-Output' {} - - $Result = Get-OSFirmware - - It 'Assert Invoke-SSHCommandStream is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Invoke-SSHCommandStream' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - - It 'Result Count should be 1' { - @($Result).Count | Should Be 1 - } - - It 'Result should have type [pscustomobject]' { - $Result | Should -HaveType [pscustomobject] - } - - It 'Result.Version should be exactly 10.05.500.01' { - $Result.Version | Should BeExactly '10.05.500.01' - } - - - It 'Assert Write-Output is called exactly 0 times' { - $AMCParams = @{ - CommandName = 'Write-Output' - Times = 0 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - } - - Context "Error Handling" { - Mock 'Invoke-SSHCommandStream' {throw 'Error'} - Mock 'Write-Output' {} - - $Result = Get-OSFirmware - - It 'Assert Write-Output is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Write-Output' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - - It 'Result should be null or empty' { - $Result | Should BeNullOrEmpty - } - } -} \ No newline at end of file diff --git a/Tests/Get-OSUpdateConfiguration.Tests.ps1 b/Tests/Get-OSUpdateConfiguration.Tests.ps1 deleted file mode 100644 index e061b86..0000000 --- a/Tests/Get-OSUpdateConfiguration.Tests.ps1 +++ /dev/null @@ -1,118 +0,0 @@ -$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) -$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) -$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf -$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") - -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - $Global:ConfirmPreference = 'None' - . ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) - $PSDefaultParameterValues = @{ - '*:SSHSession' = New-MockObject -Type 'SSH.SshSession' - } - } - - Context "Parameter Validation" { - - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys - $KnownParameters = 'SSHSession' - - It "Should contain our specific parameters" { - (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count - } - } - - Context "Code Execution" { - Mock 'Invoke-SSHCommandStream' { - @' -[UPDATECONF] -protocol="http" -hostname="igelrmserver.acme.org" -port="8443" -username="igelums" -password="00a8430e21213a154e5c2f" -path="ums_filetransfer/IGEL_Universal_Desktop_LX-10.05.500" -'@ - } - Mock 'Write-Output' {} - - $Result = Get-OSUpdateConfiguration - - It 'Assert Invoke-SSHCommandStream is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Invoke-SSHCommandStream' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - - It 'Result Count should be 1' { - @($Result).Count | Should Be 1 - } - - It 'Result should have type [pscustomobject]' { - $Result | Should -HaveType [pscustomobject] - } - - It 'Result.Protocol should be exactly http' { - $Result.Protocol | Should BeExactly 'http' - } - - It 'Result.Hostname should be exactly igelrmserver.acme.org' { - $Result.Hostname | Should BeExactly 'igelrmserver.acme.org' - } - - It 'Result.Port should have type [Int]' { - $Result.Port | Should -HaveType [Int] - } - - It 'Result.Port should be exactly 8443' { - $Result.Port | Should BeExactly 8443 - } - - It 'Result.Username should be exactly igelums' { - $Result.Username | Should BeExactly 'igelums' - } - - It 'Result.Password should be exactly 00a8430e21213a154e5c2f' { - $Result.Password | Should BeExactly '00a8430e21213a154e5c2f' - } - - It 'Result.Path should be exactly ums_filetransfer/IGEL_Universal_Desktop_LX-10.05.500' { - $Result.Path | Should BeExactly 'ums_filetransfer/IGEL_Universal_Desktop_LX-10.05.500' - } - - - It 'Assert Write-Output is called exactly 0 times' { - $AMCParams = @{ - CommandName = 'Write-Output' - Times = 0 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - } - - Context "Error Handling" { - Mock 'Invoke-SSHCommandStream' {throw 'Error'} - Mock 'Write-Output' {} - - $Result = Get-OSUpdateConfiguration - - It 'Assert Write-Output is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Write-Output' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - - It 'Result should be null or empty' { - $Result | Should BeNullOrEmpty - } - } -} \ No newline at end of file diff --git a/Tests/Get-OSWifiConnection.Tests.ps1 b/Tests/Get-OSWifiConnection.Tests.ps1 deleted file mode 100644 index 42346fd..0000000 --- a/Tests/Get-OSWifiConnection.Tests.ps1 +++ /dev/null @@ -1,152 +0,0 @@ -$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) -$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) -$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf -$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") - -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { - BeforeAll { - $Global:ConfirmPreference = 'None' - . ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) - $PSDefaultParameterValues = @{ - '*:SSHSession' = New-MockObject -Type 'SSH.SshSession' - } - } - - Context "Parameter Validation" { - - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys - $KnownParameters = 'SSHSession', 'Interface' - - It "Should contain our specific parameters" { - (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count - } - } - - Context "Code Execution" { - Mock 'Invoke-SSHCommandStream' { - @' -wlan0 IEEE 802.11 ESSID:"WLAN-0123456" - Mode:Managed Frequency:5.18 GHz Access Point: 00:42:4C:24:E8:F9 - Bit Rate=54 Mb/s Tx-Power=20 dBm - Retry short long limit:2 RTS thr:off Fragment thr:off - Encryption key:off - Power Management:off - Link Quality=66/70 Signal level=-44 dBm - Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 - Tx excessive retries:0 Invalid misc:17 Missed beacon:0 -'@ - } - Mock 'Write-Output' {} - - $Result = Get-OSWifiConnection - - It 'Assert Invoke-SSHCommandStream is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Invoke-SSHCommandStream' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - - It 'Result Count should be 1' { - @($Result).Count | Should Be 1 - } - - It 'Result should have type [pscustomobject]' { - $Result | Should -HaveType [pscustomobject] - } - - It 'Result.ESSID should be exactly WLAN-0123456' { - $Result.ESSID | Should BeExactly 'WLAN-0123456' - } - - It 'Result.Mode should be exactly Managed' { - $Result.Mode | Should BeExactly 'Managed' - } - - It 'Result.Frequency should have type [Single]' { - $Result.Frequency | Should -HaveType [Single] - } - - It 'Result.Frequency should be exactly 5.18' { - $Result.Frequency | Should BeExactly '5.18' - } - - It 'Result.AccessPoint should be exactly 00:42:4C:24:E8:F9' { - $Result.AccessPoint | Should BeExactly '00:42:4C:24:E8:F9' - } - - It 'Result.BitRate should have type [Int]' { - $Result.BitRate | Should -HaveType [Int] - } - - It 'Result.BitRate should be exactly 54' { - $Result.BitRate | Should BeExactly 54 - } - - It 'Result.TxPower should have type [Int]' { - $Result.TxPower | Should -HaveType [Int] - } - - It 'Result.TxPower should be exactly 20' { - $Result.TxPower | Should BeExactly 20 - } - - It 'Result.LinkQualityActual should have type [Int]' { - $Result.LinkQualityActual | Should -HaveType [Int] - } - - It 'Result.LinkQualityActual should be exactly 66' { - $Result.LinkQualityActual | Should BeExactly 66 - } - - It 'Result.LinkQualityMax should have type [Int]' { - $Result.LinkQualityMax | Should -HaveType [Int] - } - - It 'Result.LinkQualityMax should be exactly 70' { - $Result.LinkQualityMax | Should BeExactly 70 - } - - It 'Result.SignalLevel should have type [Int]' { - $Result.SignalLevel | Should -HaveType [Int] - } - - It 'Result.SignalLevel should be exactly -44' { - $Result.SignalLevel | Should BeExactly -44 - } - - - It 'Assert Write-Output is called exactly 0 times' { - $AMCParams = @{ - CommandName = 'Write-Output' - Times = 0 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - } - - Context "Error Handling" { - Mock 'Invoke-SSHCommandStream' {throw 'Error'} - Mock 'Write-Output' {} - - $Result = Get-OSWifiConnection -Interface 'wlan0' - - It 'Assert Write-Output is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Write-Output' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } - - It 'Result should be null or empty' { - $Result | Should BeNullOrEmpty - } - } -} \ No newline at end of file From a94b372da4c07aa95d5fad4665261d1eef2da66e Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 9 Mar 2020 15:55:47 +0100 Subject: [PATCH 074/145] Delete UMS.json --- Tests/UMS.json | 241 ------------------------------------------------- 1 file changed, 241 deletions(-) delete mode 100644 Tests/UMS.json diff --git a/Tests/UMS.json b/Tests/UMS.json deleted file mode 100644 index 7cc607c..0000000 --- a/Tests/UMS.json +++ /dev/null @@ -1,241 +0,0 @@ -[ - { - "Computername": "localhost", - "TCPPort": "8443", - "User": "igelums", - "Credpath": "C:\\Credentials\\UMSRmdb.cred", - "SecurityProtocol": "Tls12", - "Prefix": "P_", - "TCPrefix": "TC", - "TCDirPrefix": "TCDir", - "ProfileDirPrefix": "ProfileDir", - "TestOrder": { - "Public": [ - "Get-UMSFirmware", - "Get-UMSProfile", - "Get-UMSProfileDirectory", - "Get-UMSProfileAssignment", - "Get-UMSStatus", - "Get-UMSDevice", - "Get-UMSDeviceAssignment", - "Get-UMSDeviceDirectory", - "Get-UMSDeviceDirectoryAssignment", - "Get-UMSDirectoryRecursive", - "Start-UMSDevice", - "Send-UMSDeviceSetting", - "Restart-UMSDevice", - "Stop-UMSDevice", - "Update-UMSProfile", - "Update-UMSProfileDirectory", - "Update-UMSDevice", - "Update-UMSDeviceDirectory", - "Move-UMSProfile", - "Move-UMSProfileDirectory", - "Move-UMSDevice", - "Move-UMSDeviceDirectory", - "New-UMSProfileAssignment", - "New-UMSProfileDirectory", - "New-UMSDevice", - "New-UMSDeviceDirectory", - "Remove-UMSProfileAssignment", - "Remove-UMSProfile", - "Remove-UMSProfileDirectory", - "Remove-UMSDevice", - "Remove-UMSDeviceDirectory", - "Reset-UMSDevice" - ], - "Private": [] - }, - "UMSFirmware": [ - { - "Id": "2", - "Version": "11.1.100.1" - }, - { - "Id": "3", - "Version": "10.5.500.1" - } - ], - "UMSProfile": [ - { - "Id": "463", - "DestId": "456", - "Name": "P_Profile01", - "NameUpdate": "P_Profile01_Update" - }, - { - "Id": "464", - "DestId": "455", - "Name": "P_Profile02" - } - ], - "UMSProfileAssignment": [ - { - "Id": "463", - "ReceiverID": "457", - "ReceiverType": "tcdirectory", - "ReceiverIdNew": "462", - "ReceiverTypeNew": "tc" - }, - { - "Id": "464", - "ReceiverID": "461", - "ReceiverType": "tc" - } - ], - "UMSProfileDirectory": [ - { - "Id": "455", - "DestId": "456", - "Name": "P_ProfileDir01", - "NameUpdate": "P_ProfileDir01_Update", - "ParentId": "-2", - "DirectoryChildren": { - "ObjectType": "profile", - "Id": "463" - } - }, - { - "Id": "456", - "Name": "P_ProfileDir02", - "NameUpdate": "P_ProfileDir02_Update", - "ParentId": "-2", - "DirectoryChildren": { - "ObjectType": "profile", - "Id": "464" - } - }, - { - "NameNew": "P_ProfileDir03" - }, - { - "Id": "1759", - "Name": "P_ProfileDir04" - } - ], - "UMSStatus": [ - { - "RmGuiServerVersion": "6.2.100", - "BuildNumber": "42027" - } - ], - "UMSDevice": [ - { - "Id": "461", - "ObjectType": "tc", - "Mac": "001122334455", - "Name": "P_TC01", - "ParentId": "457", - "DestId": "458", - "Comment": "Comment", - "Online": "false", - "ShadowSecret": { - "certificate": "", - "password": "99cbbd4d-3292-4df5-9564-85976cdd0ceb" - } - }, - { - "Id": "462", - "ObjectType": "tc", - "Mac": "112233445566", - "Name": "P_TC02", - "ParentId": "458", - "DestId": "457", - "Comment": "Comment", - "CommentUpdate": "Comment_Update", - "Online": "false", - "ShadowSecret": { - "certificate": "", - "password": "a9484d4b-6fb9-4f60-82fb-114a5eafdd24" - } - }, - { - "Id": "1831", - "ObjectType": "tc", - "Mac": "334455667788", - "Name": "P_TC01_01_01", - "ParentId": "1829" - }, - { - "NameNew": "P_TC03", - "MacNew": "223344556677", - "FirmwareIdNew": "2", - "ParentId": "457" - } - ], - "UMSDeviceAssignment": [ - { - "Id": "461", - "ReceiverId": "461", - "ReceiverType": "tc", - "AssigneeId": "464", - "AssigneeType": "profile", - "AssignmentPosition": "0" - }, - { - "Id": "461", - "ReceiverId": "457", - "ReceiverType": "tcdirectory", - "AssigneeId": "463", - "AssigneeType": "profile", - "AssignmentPosition": "1" - } - ], - "UMSDeviceDirectory": [ - { - "Id": "457", - "Name": "P_TCDir01", - "ParentId": "-1", - "DestId": "458", - "DirectoryChildren": { - "ObjectType": "tc", - "Id": "461" - } - }, - { - "Id": "458", - "Name": "P_TCDir02", - "NameUpdate": "P_TCDir02_Update", - "ParentId": "-1", - "DestId": "629", - "DirectoryChildren": { - "ObjectType": "tc", - "Id": "462" - } - }, - { - "Id": "629", - "Name": "P_TCDir03", - "ParentId": "-1" - }, - { - "Id": "1827", - "NameNew": "P_TCDir01_01", - "ParentId": "457" - }, - { - "Id": "1828", - "Name": "P_TCDir01_02", - "ParentId": "457" - }, - { - "Id": "1829", - "Name": "P_TCDir01_01_01", - "ParentId": "1827" - }, - { - "NameNew": "P_TCDir04" - } - ], - "UMSDeviceDirectoryAssignment": [ - { - "Id": "457", - "ReceiverID": "457", - "ReceiverType": "tcdirectory", - "AssigneeId": "463", - "AssigneeType": "profile", - "AssignmentPosition": "0" - } - ] - } -] \ No newline at end of file From 96e3fd5b9fbcbceba054c98617b12df4ef8ca66b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 11 Mar 2020 07:59:44 +0100 Subject: [PATCH 075/145] added Get-UMSDevice to Pipeline Test --- Scripts/Test.ps1 | 27 ++++++++++++++++----------- Tests/IntegrationTestsConfig.psd1 | 22 ++++++++++++++++++++++ Tests/Pipeline.UMSDevice.Tests.ps1 | 12 ++++++++---- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index ec0c17a..87ae387 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -15,26 +15,31 @@ $PSDefaultParameterValues += @{ } $NewParams = @{ - Name = 'NewDeviceDirectory02' + Mac = '0A00000000AA' + Name = 'NewDevice01' + FirmwareId = 1 + ParentId = -1 } $MoveParams = @{ DestId = 502 # PSIGEL } $UpdateParams = @{ - Name = 'UpdatedDeviceDirectory02' + Name = 'UpdatedDevice01' } #<# $Result = @( - $null = ((($NewParams.Name | - New-UMSDeviceDirectory | Tee-Object -Variable 'NewUMSDeviceDirectory').Id | - Move-UMSDeviceDirectory @MoveParams | Tee-Object -Variable 'MoveUMSDeviceDirectory').Id | - Update-UMSDeviceDirectory @UpdateParams | Tee-Object -Variable 'UpdateUMSDeviceDirectory').Id | - Remove-UMSDeviceDirectory | Tee-Object -Variable 'RemoveUMSDeviceDirectory' - $NewUMSDeviceDirectory - $MoveUMSDeviceDirectory - $UpdateUMSDeviceDirectory - $RemoveUMSDeviceDirectory + $null = [pscustomobject]$NewParams | + New-UMSDevice | Tee-Object -Variable 'NewUMSDevice' | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | + Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice' | + Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' + $NewUMSDevice + $MoveUMSDevice + $UpdateUMSDevice + $GetUMSDevice + $RemoveUMSDevice ) $Result #> diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index c9238c4..99d482d 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -591,6 +591,17 @@ Integration Tests Config Message = 'Update successful.' Id = 601 } + @{ + FirmwareId = 1 + Id = 601 + LastIp = '' + Mac = '0A00000000AA' + MovedToBin = 'False' + Name = 'UpdatedDevice01' + ObjectType = 'tc' + ParentId = 502 + UnitId = '0A00000000AA' + } @{ Message = 'Offline deletion successful.' Id = 601 @@ -629,6 +640,17 @@ Integration Tests Config Message = 'Update successful.' Id = 602 } + @{ + FirmwareId = 1 + Id = 602 + LastIp = '' + Mac = '0A00000000AB' + MovedToBin = 'False' + Name = 'UpdatedDevice02' + ObjectType = 'tc' + ParentId = 502 + UnitId = '0A00000000AB' + } @{ Message = 'Offline deletion successful.' Id = 602 diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 index b3ea151..796cdbf 100644 --- a/Tests/Pipeline.UMSDevice.Tests.ps1 +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -36,10 +36,12 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { New-UMSDevice | Tee-Object -Variable 'NewUMSDevice' | Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | + Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice' | Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' $NewUMSDevice $MoveUMSDevice $UpdateUMSDevice + $GetUMSDevice $RemoveUMSDevice ) } | Should Not Throw } @@ -79,14 +81,16 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { $MoveParams = $TestCfg.MoveParams $UpdateParams = $TestCfg.UpdateParams { $Script:Result = @( - $null = ((($NewParams.Mac | - New-UMSDevice -FirmwareId $NewParams.FirmwareId -Name $NewParams.Name | Tee-Object -Variable 'NewUMSDevice').Id | - Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | - Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | + $null = (((($NewParams.Mac | + New-UMSDevice -FirmwareId $NewParams.FirmwareId -Name $NewParams.Name | Tee-Object -Variable 'NewUMSDevice').Id | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | + Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice').Id | Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' $NewUMSDevice $MoveUMSDevice $UpdateUMSDevice + $GetUMSDevice $RemoveUMSDevice ) } | Should Not Throw } From aa2eca052a10de261482e387b3763790641b3695 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 11 Mar 2020 09:08:29 +0100 Subject: [PATCH 076/145] excluded Pipeline Tests from UnitTests --- Tests/IntegrationTestsConfig.psd1 | 10 +-- Tests/Pester.ps1 | 62 +++++-------------- Tests/Pipeline.UMSDevice.Tests.ps1 | 8 +-- Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 | 8 +-- Tests/Pipeline.UMSProfile.Tests.ps1 | 8 +-- Tests/Pipeline.UMSProfileAssignment.Tests.ps1 | 8 +-- Tests/Pipeline.UMSProfileDirectory.Tests.ps1 | 8 +-- 7 files changed, 41 insertions(+), 71 deletions(-) diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/IntegrationTestsConfig.psd1 index 99d482d..c9357c7 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/IntegrationTestsConfig.psd1 @@ -495,7 +495,7 @@ Integration Tests Config } # Pipeline.UMSProfileAssignment @{ - Function = 'Pipeline.UMSProfileAssignment' + Special = 'Pipeline.UMSProfileAssignment' ParameterSets = @{ ValueFromPipeline = @{ NewAssignmentParams = @{ @@ -560,7 +560,7 @@ Integration Tests Config } # Pipeline.UMSDevice @{ - Function = 'Pipeline.UMSDevice' + Special = 'Pipeline.UMSDevice' ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ @@ -665,7 +665,7 @@ Integration Tests Config } # Pipeline.UMSDeviceDirectory @{ - Function = 'Pipeline.UMSDeviceDirectory' + Special = 'Pipeline.UMSDeviceDirectory' ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ @@ -737,7 +737,7 @@ Integration Tests Config } # Pipeline.UMSProfile @{ - Function = 'Pipeline.UMSProfile' + Special = 'Pipeline.UMSProfile' ParameterSets = @{ ValueFromPipeline = @{ MoveParams = @{ @@ -796,7 +796,7 @@ Integration Tests Config } # Pipeline.UMSProfileDirectory @{ - Function = 'Pipeline.UMSProfileDirectory' + Special = 'Pipeline.UMSProfileDirectory' ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 83cc1b0..12902fc 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -3,71 +3,34 @@ param [ValidateSet('All', 'UnitTests', 'IntegrationTests')] [String] #$Tags = 'All' - #$Tags = 'UnitTests' - $Tags = 'IntegrationTests' + $Tags = 'UnitTests' + #$Tags = 'IntegrationTests' ) $ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) $ModuleName = Split-Path $ModuleRoot -Leaf $OutputPath = '{0}\Tests\Data' -f $ProjectRoot - -<# -$UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $ProjectRoot) | -ConvertFrom-Json -#> $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential '*-UMS*:Computername' = $Cfg.Computername - #'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMS.Credpath '*-UMS*:TCPPort' = $Cfg.TCPPort '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol '*-UMS*:Confirm' = $false - #'Invoke-Pester:Show' = 'Failed' -} - -<# -$IgelRmGuiServerService = Get-Service -Name 'IGELRMGUIServer' -switch ($IgelRmGuiServerService) -{ - $false - { - throw "Service $IgelRmGuiServerService not found!" - } - {$_.Status -eq 'Stopped'} - { - "Stopped" - $i = 0 - $IgelRmGuiServerService | Start-Service -ErrorAction Stop - do - { - Start-Sleep -Seconds 3 - $i++ - if ($i -ge 10) - { - throw "TCPPort $UMS.TCPPort not responding!" - } - } - until ((Test-NetConnection -Port $UMS.TCPPort).TcpTestSucceeded -eq $true ) - } + 'Invoke-Pester:Show' = 'Failed' } -#> -#$WebSession = New-UMSAPICookie -Credential $Credential $PSDefaultParameterValues += @{ - #'*-UMS*:WebSession' = $WebSession '*-UMS*:WebSession' = (New-UMSAPICookie) } -#Invoke-Pester -Script ('{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $ModuleName) -OutputFile ('{0}\{1}.Tests.xml' -f $OutputPath, $ModuleName) +Invoke-Pester -Script ('{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $ModuleName) -OutputFile ('{0}\{1}.Tests.xml' -f $OutputPath, $ModuleName) foreach ($Test in $Cfg.Tests) { - #$Test.Function - #<# $IVPParams = @{ Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.Function OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.Function @@ -76,18 +39,25 @@ foreach ($Test in $Cfg.Tests) { 'All' { - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function + if ($Test.Function) + { + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function + Invoke-Pester @IVPParams + } } 'UnitTests' { - $IVPParams.Tag = 'UnitTests' - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function + if ($Test.Function) + { + $IVPParams.Tag = 'UnitTests' + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function + Invoke-Pester @IVPParams + } } 'IntegrationTests' { $IVPParams.Tag = 'IntegrationTests' + Invoke-Pester @IVPParams } } - Invoke-Pester @IVPParams - #> } diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 index 796cdbf..ac4de81 100644 --- a/Tests/Pipeline.UMSDevice.Tests.ps1 +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -2,10 +2,10 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath @@ -24,7 +24,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -74,7 +74,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 index 22104b4..1e8de45 100644 --- a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 @@ -2,10 +2,10 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath @@ -24,7 +24,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -71,7 +71,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Pipeline.UMSProfile.Tests.ps1 b/Tests/Pipeline.UMSProfile.Tests.ps1 index dfff1bd..0abbf2d 100644 --- a/Tests/Pipeline.UMSProfile.Tests.ps1 +++ b/Tests/Pipeline.UMSProfile.Tests.ps1 @@ -2,10 +2,10 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath @@ -24,7 +24,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $MoveParams = $TestCfg.MoveParams @@ -67,7 +67,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { $Script:Result - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $MoveParams = $TestCfg.MoveParams diff --git a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 index 4e2d754..4ceecc7 100644 --- a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 +++ b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 @@ -2,10 +2,10 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath @@ -24,7 +24,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewAssignmentParams = $TestCfg.NewAssignmentParams @@ -65,7 +65,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewAssignmentParams = $TestCfg.NewAssignmentParams diff --git a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 index 66d0856..1b57059 100644 --- a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 +++ b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 @@ -2,10 +2,10 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath @@ -24,7 +24,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -70,7 +70,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams From e422e708dd1fac0a87fb68f95f326b6e031a94fa Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 11 Mar 2020 13:57:54 +0100 Subject: [PATCH 077/145] working on Tests --- Scripts/Test.ps1 | 6 +- ...ntegrationTestsConfig.psd1 => Config.psd1} | 128 ++++++++++++----- Tests/Get-UMSDevice.Tests.ps1 | 26 ++-- Tests/Get-UMSDeviceAssignment.Tests.ps1 | 18 +-- Tests/Get-UMSDeviceDirectory.Tests.ps1 | 20 +-- ...Get-UMSDeviceDirectoryAssignment.Tests.ps1 | 18 +-- Tests/Get-UMSDirectoryRecursive.Tests.ps1 | 22 +-- Tests/Get-UMSFirmware.Tests.ps1 | 14 +- Tests/Get-UMSProfile.Tests.ps1 | 18 +-- Tests/Get-UMSProfileAssignment.Tests.ps1 | 20 +-- Tests/Get-UMSProfileDirectory.Tests.ps1 | 20 +-- Tests/Get-UMSStatus.Tests.ps1 | 14 +- .../Invoke-UMSRestMethodWebSession.Tests.ps1 | 12 +- Tests/Move-UMSDevice.Tests.ps1 | 14 +- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 14 +- Tests/Move-UMSProfile.Tests.ps1 | 14 +- Tests/Move-UMSProfileDirectory.Tests.ps1 | 14 +- Tests/New-UMSAPICookie.Tests.ps1 | 14 +- Tests/New-UMSDevice.Tests.ps1 | 14 +- Tests/New-UMSDeviceDirectory.Tests.ps1 | 14 +- ...ests.ps1 => New-UMSFilterString.Tests.ps1} | 12 +- Tests/New-UMSProfileAssignment.Tests.ps1 | 14 +- Tests/New-UMSProfileDirectory.Tests.ps1 | 14 +- Tests/PSIGEL.Tests.ps1 | 35 ++--- Tests/Pester.ps1 | 131 ++++++++++++++---- Tests/Pipeline.UMSDevice.Tests.ps1 | 10 +- Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 | 10 +- Tests/Pipeline.UMSProfile.Tests.ps1 | 10 +- Tests/Pipeline.UMSProfileAssignment.Tests.ps1 | 10 +- Tests/Pipeline.UMSProfileDirectory.Tests.ps1 | 10 +- Tests/Remove-UMSDevice.Tests.ps1 | 14 +- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 14 +- Tests/Remove-UMSProfile.Tests.ps1 | 14 +- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 14 +- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 14 +- Tests/Reset-UMSDevice.Tests.ps1 | 20 +-- Tests/Restart-UMSDevice.Tests.ps1 | 20 +-- Tests/Send-UMSDeviceSetting.Tests.ps1 | 20 +-- Tests/Start-UMSDevice.Tests.ps1 | 20 +-- Tests/Stop-UMSDevice.Tests.ps1 | 20 +-- Tests/Update-UMSDevice.Tests.ps1 | 18 +-- Tests/Update-UMSDeviceDirectory.Tests.ps1 | 18 +-- Tests/Update-UMSProfile.Tests.ps1 | 18 +-- Tests/Update-UMSProfileDirectory.Tests.ps1 | 18 +-- 44 files changed, 529 insertions(+), 403 deletions(-) rename Tests/{IntegrationTestsConfig.psd1 => Config.psd1} (94%) rename Tests/{New-UMSFunctionString.Tests.ps1 => New-UMSFilterString.Tests.ps1} (78%) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 87ae387..bb79c60 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -67,7 +67,7 @@ $Result Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | Remove-UMSDevice @RemoveParams | Tee-Object -Variable 'RemoveUMSDevice' - + $NewUMSDevice $MoveUMSDevice $UpdateUMSDevice @@ -75,8 +75,8 @@ $Result ) $Result #> - - + + <# $Result = @( $null = [pscustomobject]$NewParams | diff --git a/Tests/IntegrationTestsConfig.psd1 b/Tests/Config.psd1 similarity index 94% rename from Tests/IntegrationTestsConfig.psd1 rename to Tests/Config.psd1 index c9357c7..f0b5ef2 100644 --- a/Tests/IntegrationTestsConfig.psd1 +++ b/Tests/Config.psd1 @@ -1,5 +1,5 @@ <# -Integration Tests Config +Tests Config #> @{ @@ -12,9 +12,61 @@ Integration Tests Config DeviceRootDirId = 502 # Devices/PSIGEL Tests = @( + # PSIGEL + @{ + General = 'PSIGEL' + } + # New-UMSAPICookie + <# + @{ + UnitTests = 'New-UMSAPICookie' + } + #> + # Reset-UMSDevice + <# + @{ + UnitTests = 'Reset-UMSDevice' + } + #> + # Restart-UMSDevice + <# + @{ + UnitTests = 'Restart-UMSDevice' + } + #> + # Send-UMSDeviceSetting + <# + @{ + UnitTests = 'Send-UMSDeviceSetting' + } + #> + # Start-UMSDevice + <# + @{ + UnitTests = 'Start-UMSDevice' + } + #> + # Stop-UMSDevice + <# + @{ + UnitTests = 'Stop-UMSDevice' + } + #> + # Invoke-UMSRestMethodWebSession + <# + @{ + PrivateUnitTests = 'Invoke-UMSRestMethodWebSession' + } + #> + # New-UMSFilterString + <# + @{ + PrivateUnitTests = 'New-UMSFilterString' + } + #> # Get-UMSStatus @{ - Function = 'Get-UMSStatus' + All = 'Get-UMSStatus' ParameterSets = @{ Default = @{ Expected = @{ @@ -33,7 +85,7 @@ Integration Tests Config } # New-UMSDeviceDirectory @{ - Function = 'New-UMSDeviceDirectory' + All = 'New-UMSDeviceDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -52,7 +104,7 @@ Integration Tests Config } # New-UMSDevice @{ - Function = 'New-UMSDevice' + All = 'New-UMSDevice' ParameterSets = @{ Default = @{ Params1 = @{ @@ -91,7 +143,7 @@ Integration Tests Config } # New-UMSProfileDirectory @{ - Function = 'New-UMSProfileDirectory' + All = 'New-UMSProfileDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -110,7 +162,7 @@ Integration Tests Config } # New-UMSProfileAssignment @{ - Function = 'New-UMSProfileAssignment' + All = 'New-UMSProfileAssignment' ParameterSets = @{ Default = @{ Params1 = @{ @@ -145,7 +197,7 @@ Integration Tests Config } # Remove-UMSDevice @{ - Function = 'Remove-UMSDevice' + All = 'Remove-UMSDevice' ParameterSets = @{ Default = @{ Params1 = @{ @@ -172,7 +224,7 @@ Integration Tests Config } # Remove-UMSDeviceDirectory @{ - Function = 'Remove-UMSDeviceDirectory' + All = 'Remove-UMSDeviceDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -192,7 +244,7 @@ Integration Tests Config } # Remove-UMSProfile @{ - Function = 'Remove-UMSProfile' + All = 'Remove-UMSProfile' ParameterSets = @{ Default = @{ Params1 = @{ @@ -210,7 +262,7 @@ Integration Tests Config } # Remove-UMSProfileDirectory @{ - Function = 'Remove-UMSProfileDirectory' + All = 'Remove-UMSProfileDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -228,7 +280,7 @@ Integration Tests Config } # Remove-UMSProfileAssignment @{ - Function = 'Remove-UMSProfileAssignment' + All = 'Remove-UMSProfileAssignment' ParameterSets = @{ Default = @{ Params1 = @{ @@ -263,7 +315,7 @@ Integration Tests Config } # Move-UMSDevice @{ - Function = 'Move-UMSDevice' + All = 'Move-UMSDevice' ParameterSets = @{ Default = @{ Params1 = @{ @@ -308,7 +360,7 @@ Integration Tests Config } # Move-UMSDeviceDirectory @{ - Function = 'Move-UMSDeviceDirectory' + All = 'Move-UMSDeviceDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -337,7 +389,7 @@ Integration Tests Config } # Move-UMSProfileDirectory @{ - Function = 'Move-UMSProfileDirectory' + All = 'Move-UMSProfileDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -358,7 +410,7 @@ Integration Tests Config } # Move-UMSProfile @{ - Function = 'Move-UMSProfile' + All = 'Move-UMSProfile' ParameterSets = @{ Default = @{ Params1 = @{ @@ -379,7 +431,7 @@ Integration Tests Config } # Update-UMSDeviceDirectory @{ - Function = 'Update-UMSDeviceDirectory' + All = 'Update-UMSDeviceDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -408,7 +460,7 @@ Integration Tests Config } #Update-UMSDevice @{ - Function = 'Update-UMSDevice' + All = 'Update-UMSDevice' ParameterSets = @{ Default = @{ Params1 = @{ @@ -453,7 +505,7 @@ Integration Tests Config } # Update-UMSProfileDirectory @{ - Function = 'Update-UMSProfileDirectory' + All = 'Update-UMSProfileDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -474,7 +526,7 @@ Integration Tests Config } # Update-UMSProfile @{ - Function = 'Update-UMSProfile' + All = 'Update-UMSProfile' ParameterSets = @{ Default = @{ Params1 = @{ @@ -495,8 +547,8 @@ Integration Tests Config } # Pipeline.UMSProfileAssignment @{ - Special = 'Pipeline.UMSProfileAssignment' - ParameterSets = @{ + IntegrationTests = 'Pipeline.UMSProfileAssignment' + ParameterSets = @{ ValueFromPipeline = @{ NewAssignmentParams = @{ Id = 595 # SES_RDP_Session02 @@ -560,8 +612,8 @@ Integration Tests Config } # Pipeline.UMSDevice @{ - Special = 'Pipeline.UMSDevice' - ParameterSets = @{ + IntegrationTests = 'Pipeline.UMSDevice' + ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ Mac = '0A00000000AA' @@ -665,8 +717,8 @@ Integration Tests Config } # Pipeline.UMSDeviceDirectory @{ - Special = 'Pipeline.UMSDeviceDirectory' - ParameterSets = @{ + IntegrationTests = 'Pipeline.UMSDeviceDirectory' + ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ Name = 'NewDeviceDirectory01' @@ -737,8 +789,8 @@ Integration Tests Config } # Pipeline.UMSProfile @{ - Special = 'Pipeline.UMSProfile' - ParameterSets = @{ + IntegrationTests = 'Pipeline.UMSProfile' + ParameterSets = @{ ValueFromPipeline = @{ MoveParams = @{ Id = 595 # SES_RDP_Session02 @@ -796,8 +848,8 @@ Integration Tests Config } # Pipeline.UMSProfileDirectory @{ - Special = 'Pipeline.UMSProfileDirectory' - ParameterSets = @{ + IntegrationTests = 'Pipeline.UMSProfileDirectory' + ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ Name = 'NewProfileDirectory01' @@ -868,7 +920,7 @@ Integration Tests Config } # Get-UMSFirmware @{ - Function = 'Get-UMSFirmware' + All = 'Get-UMSFirmware' ParameterSets = @{ Default = @{ Expected = @( @@ -893,7 +945,7 @@ Integration Tests Config } # Get-UMSDevice @{ - Function = 'Get-UMSDevice' + All = 'Get-UMSDevice' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1103,7 +1155,7 @@ Integration Tests Config } # Get-UMSDeviceDirectory @{ - Function = 'Get-UMSDeviceDirectory' + All = 'Get-UMSDeviceDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1217,7 +1269,7 @@ Integration Tests Config } # Get-UMSProfile @{ - Function = 'Get-UMSProfile' + All = 'Get-UMSProfile' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1292,7 +1344,7 @@ Integration Tests Config } # Get-UMSProfileDirectory @{ - Function = 'Get-UMSProfileDirectory' + All = 'Get-UMSProfileDirectory' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1384,7 +1436,7 @@ Integration Tests Config } # Get-UMSProfileAssignment @{ - Function = 'Get-UMSProfileAssignment' + All = 'Get-UMSProfileAssignment' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1432,7 +1484,7 @@ Integration Tests Config } # Get-UMSDeviceAssignment @{ - Function = 'Get-UMSDeviceAssignment' + All = 'Get-UMSDeviceAssignment' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1480,7 +1532,7 @@ Integration Tests Config } # Get-UMSDeviceDirectoryAssignment @{ - Function = 'Get-UMSDeviceDirectoryAssignment' + All = 'Get-UMSDeviceDirectoryAssignment' ParameterSets = @{ Default = @{ Params1 = @{ @@ -1528,7 +1580,7 @@ Integration Tests Config } # Get-UMSDirectoryRecursive @{ - Function = 'Get-UMSDirectoryRecursive' + All = 'Get-UMSDirectoryRecursive' ParameterSets = @{ Default = @{ Params1 = @{ diff --git a/Tests/Get-UMSDevice.Tests.ps1 b/Tests/Get-UMSDevice.Tests.ps1 index f43d704..b70024d 100644 --- a/Tests/Get-UMSDevice.Tests.ps1 +++ b/Tests/Get-UMSDevice.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Filter', 'Id' It "Should contain our specific parameters" { @@ -424,11 +424,11 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { @($Result).Count | Should BeExactly 1 } - It 'Result.BiosDate should be bull or empty' { + It 'Result.BiosDate should be null or empty' { $Result.BiosDate | Should -BeNullOrEmpty } - It 'Result.LastBoottime should be bull or empty' { + It 'Result.LastBoottime should be null or empty' { $Result.LastBoottime | Should -BeNullOrEmpty } } @@ -436,8 +436,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSDevice } | should throw 'Error' + It 'should throw Error' { + { Get-UMSDevice } | Should throw 'Error' } It 'Result should be null or empty' { @@ -447,8 +447,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -466,7 +466,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( @@ -504,7 +504,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Details" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Details + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Details It "doesn't throw" { $Params1 = $TestCfg.Params1 @@ -543,7 +543,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Online" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Online + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Online It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDeviceAssignment.Tests.ps1 b/Tests/Get-UMSDeviceAssignment.Tests.ps1 index bf56d60..a90b5d7 100644 --- a/Tests/Get-UMSDeviceAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceAssignment.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -101,8 +101,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSDeviceAssignment } | should throw 'Error' + It 'should throw Error' { + { Get-UMSDeviceAssignment } | Should throw 'Error' } It 'Result should be null or empty' { @@ -112,8 +112,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -131,7 +131,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDeviceDirectory.Tests.ps1 b/Tests/Get-UMSDeviceDirectory.Tests.ps1 index f53c851..8972d7a 100644 --- a/Tests/Get-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Filter', 'Id' It "Should contain our specific parameters" { @@ -191,8 +191,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSDeviceDirectory } | should throw 'Error' + It 'should throw Error' { + { Get-UMSDeviceDirectory } | Should throw 'Error' } It 'Result should be null or empty' { @@ -202,8 +202,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -221,7 +221,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( @@ -259,7 +259,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Children" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Children + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Children It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 index 933cabb..5575123 100644 --- a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -101,8 +101,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSDeviceDirectoryAssignment } | should throw 'Error' + It 'should throw Error' { + { Get-UMSDeviceDirectoryAssignment } | Should throw 'Error' } It 'Result should be null or empty' { @@ -112,8 +112,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -131,7 +131,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 index 1e17a66..b036762 100644 --- a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 +++ b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 @@ -2,10 +2,10 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { BeforeAll { if ($null -ne $Result) @@ -18,13 +18,13 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Id', 'DirectoryColl', 'ElementColl' It "Should contain our specific parameters" { @@ -265,7 +265,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } It 'Result[0].ObjectType should be tc' { - $Result[0].ObjectType | should be 'tc' + $Result[0].ObjectType | Should be 'tc' } It 'Result[0].Id should have type [Int]' { @@ -280,8 +280,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Mock 'Get-UMSDirectoryRecursive' { throw 'Error' } - it 'should throw Error' { - { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{ } -ElementColl @{ } } | should throw 'Error' + It 'should throw Error' { + { $Script:Result = Get-UMSDirectoryRecursive -Id 99 -DirectoryColl @{ } -ElementColl @{ } } | Should throw 'Error' } It 'Result should be null or empty' { @@ -291,8 +291,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -310,7 +310,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 @@ -346,7 +346,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Element" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Element + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Element It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index 64499d0..2de8cab 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -142,8 +142,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -160,7 +160,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = Get-UMSFirmware } | Should Not Throw diff --git a/Tests/Get-UMSProfile.Tests.ps1 b/Tests/Get-UMSProfile.Tests.ps1 index cbefe0a..37903d0 100644 --- a/Tests/Get-UMSProfile.Tests.ps1 +++ b/Tests/Get-UMSProfile.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -145,8 +145,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSProfile } | should throw 'Error' + It 'should throw Error' { + { Get-UMSProfile } | Should throw 'Error' } It 'Result should be null or empty' { @@ -156,8 +156,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -175,7 +175,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( diff --git a/Tests/Get-UMSProfileAssignment.Tests.ps1 b/Tests/Get-UMSProfileAssignment.Tests.ps1 index 84622f4..b2f7cc3 100644 --- a/Tests/Get-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Get-UMSProfileAssignment.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'Directory' It "Should contain our specific parameters" { @@ -146,8 +146,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSProfileAssignment } | should throw 'Error' + It 'should throw Error' { + { Get-UMSProfileAssignment } | Should throw 'Error' } It 'Result should be null or empty' { @@ -157,8 +157,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -176,7 +176,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 @@ -211,7 +211,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Directory" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Directory + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Directory It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSProfileDirectory.Tests.ps1 b/Tests/Get-UMSProfileDirectory.Tests.ps1 index 181ccd3..c4c01bd 100644 --- a/Tests/Get-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Get-UMSProfileDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Filter', 'Id' It "Should contain our specific parameters" { @@ -191,8 +191,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Get-UMSProfileDirectory } | should throw 'Error' + It 'should throw Error' { + { Get-UMSProfileDirectory } | Should throw 'Error' } It 'Result should be null or empty' { @@ -202,8 +202,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -221,7 +221,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( @@ -259,7 +259,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Children" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Children + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Children It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index 15b3e58..8ab1bb0 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession' It "Should contain our specific parameters" { @@ -100,8 +100,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -117,7 +117,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = Get-UMSStatus } | Should Not Throw diff --git a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 index c832d9b..a2249f4 100644 --- a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 +++ b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Private\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Private\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'WebSession', 'SecurityProtocol', 'Uri', 'Body', 'ContentType', 'Headers', 'Method' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } } diff --git a/Tests/Move-UMSDevice.Tests.ps1 b/Tests/Move-UMSDevice.Tests.ps1 index 171eaf9..170d372 100644 --- a/Tests/Move-UMSDevice.Tests.ps1 +++ b/Tests/Move-UMSDevice.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'DestId' It "Should contain our specific parameters" { @@ -116,8 +116,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -134,7 +134,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index 69c2391..13a2892 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'DestId' It "Should contain our specific parameters" { @@ -116,8 +116,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -135,7 +135,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Move-UMSProfile.Tests.ps1 b/Tests/Move-UMSProfile.Tests.ps1 index 1a8f464..ee645e6 100644 --- a/Tests/Move-UMSProfile.Tests.ps1 +++ b/Tests/Move-UMSProfile.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'DestId' It "Should contain our specific parameters" { @@ -115,8 +115,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -134,7 +134,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index 2921bd1..8391b70 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'DestId' It "Should contain our specific parameters" { @@ -115,8 +115,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -134,7 +134,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index ff75238..f042292 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'Credential', 'ApiVersion', 'SecurityProtocol' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -107,9 +107,9 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json + ConvertFrom-Json $CredPath = $UMS.CredPath $Password = Get-Content $CredPath | ConvertTo-SecureString $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index b01a2ef..9dbf52c 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Mac', 'FirmwareId', 'Name', 'ParentId', 'Site', 'Department', 'CostCenter', 'LastIP', 'Comment', 'AssetId', 'InserviceDate', 'SerialNumber' @@ -118,8 +118,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -136,7 +136,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index 8a3f27b..bba52e2 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Name' It "Should contain our specific parameters" { @@ -116,8 +116,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -133,7 +133,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSFunctionString.Tests.ps1 b/Tests/New-UMSFilterString.Tests.ps1 similarity index 78% rename from Tests/New-UMSFunctionString.Tests.ps1 rename to Tests/New-UMSFilterString.Tests.ps1 index 4d14854..cb9efb6 100644 --- a/Tests/New-UMSFunctionString.Tests.ps1 +++ b/Tests/New-UMSFilterString.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Private\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Private\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Filter' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -30,7 +30,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { It "New-UMSFilterString -Filter 'short' Should not throw" { - { New-UMSFilterString -Filter 'short'} | Should -Not -Throw + { New-UMSFilterString -Filter 'short' } | Should -Not -Throw } It "New-UMSFilterString -Filter 'nonexisting' -ErrorAction Stop Should throw" { diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 8e7e672..4a83a42 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'ReceiverId', 'ReceiverType' It "Should contain our specific parameters" { @@ -172,8 +172,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -190,7 +190,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index b9926ba..c5842c0 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Name' It "Should contain our specific parameters" { @@ -115,8 +115,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -133,7 +133,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/PSIGEL.Tests.ps1 b/Tests/PSIGEL.Tests.ps1 index c486d3e..d47ff75 100644 --- a/Tests/PSIGEL.Tests.ps1 +++ b/Tests/PSIGEL.Tests.ps1 @@ -1,14 +1,15 @@ -$ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) -$ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) -$ModuleName = Split-Path $ModuleRoot -Leaf -$ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $ModuleRoot, $ModuleName) +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "General project validation: $ModuleName" { Context 'Basic Module Testing' { $ScriptColl = Get-ChildItem $ModuleRoot -Include *.ps1, *.psm1, *.psd1 -Recurse - $TestCase = $ScriptColl | Foreach-Object { + $TestCase = $ScriptColl | ForEach-Object { @{ File = $_ } @@ -68,19 +69,19 @@ Describe "General project validation: $ModuleName" { $PublicFunctionColl = (Get-ChildItem -Path ('{0}\Public' -f $ModuleRoot) -Filter *.ps1 | Select-Object -ExpandProperty Name ) -replace '\.ps1$' - $TestCase = $PublicFunctionColl | Foreach-Object { + $TestCase = $PublicFunctionColl | ForEach-Object { @{ - FunctionName = $_ + ScriptName = $_ } } - It "Function should be in manifest" -TestCases $TestCase { + It "Function should be in manifest" -TestCases $TestCase { param( - $FunctionName + $ScriptName ) $ManifestFunctionColl = $Manifest.ExportedFunctions.Keys - $FunctionName -in $ManifestFunctionColl | Should Be $true + $ScriptName -in $ManifestFunctionColl | Should Be $true } It 'Proper Number of Functions Exported compared to Manifest' { @@ -102,17 +103,17 @@ Describe "General project validation: $ModuleName" { Context 'Private Functions' { $PrivateFunctionColl = (Get-ChildItem -Path ('{0}\Private' -f $ModuleRoot) -Filter *.ps1 | Select-Object -ExpandProperty Name ) -replace '\.ps1$' - $TestCase = $PrivateFunctionColl | Foreach-Object { + $TestCase = $PrivateFunctionColl | ForEach-Object { @{ - FunctionName = $_ + ScriptName = $_ } } - It "Private function is not directly accessible outside the module" -TestCases $TestCase { + It "Private function is not directly accessible outside the module" -TestCases $TestCase { param( - $FunctionName + $ScriptName ) - { . ('\{0}' -f $FunctionName) } | Should Throw + { . ('\{0}' -f $ScriptName) } | Should Throw } } @@ -151,7 +152,7 @@ Describe "$ModuleName ScriptAnalyzer" -Tag 'Compliance' { $FunctionWithErrorColl = $ScriptAnalyzerErrorColl.ScriptName | Sort-Object -Unique if ($ScriptAnalyzerErrorColl) { - $TestCase = $ScriptAnalyzerErrorColl | Foreach-Object { + $TestCase = $ScriptAnalyzerErrorColl | ForEach-Object { @{ RuleName = $_.RuleName ScriptName = $_.ScriptName @@ -181,7 +182,7 @@ Describe "$ModuleName ScriptAnalyzer" -Tag 'Compliance' { } Context 'Successful ScriptAnalyzer Testing' { - $TestCase = $FunctionWithoutErrorColl | Foreach-Object { + $TestCase = $FunctionWithoutErrorColl | ForEach-Object { @{ ScriptName = $_ } diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 12902fc..b575d85 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -2,62 +2,135 @@ param ( [ValidateSet('All', 'UnitTests', 'IntegrationTests')] [String] - #$Tags = 'All' - $Tags = 'UnitTests' - #$Tags = 'IntegrationTests' + $Tags = 'UnitTests', + + [ValidateSet('Default', 'Passed', 'Failed', 'Pending', 'Skipped', 'Inconclusive', 'Describe', 'Context', 'Summary')] + [String] + $Show = 'Summary', + + [Switch] + $EnableExit = $false ) $ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) $ModuleName = Split-Path $ModuleRoot -Leaf $OutputPath = '{0}\Tests\Data' -f $ProjectRoot -$Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +$Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $Cfg.Computername - '*-UMS*:TCPPort' = $Cfg.TCPPort - '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol - '*-UMS*:Confirm' = $false - 'Invoke-Pester:Show' = 'Failed' + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $false + 'Invoke-Pester:Show' = $Show + 'Invoke-Pester:EnableExit' = $EnableExit } $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = (New-UMSAPICookie) } -Invoke-Pester -Script ('{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $ModuleName) -OutputFile ('{0}\{1}.Tests.xml' -f $OutputPath, $ModuleName) - foreach ($Test in $Cfg.Tests) { - $IVPParams = @{ - Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.Function - OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.Function - } - switch ($Tags) + $IVPParams = @{ } + switch ($Test) { - 'All' + ( { $PSItem.All } ) { - if ($Test.Function) + $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.All + $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.All + switch ($Tags) { - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function - Invoke-Pester @IVPParams + 'All' + { + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.All + Invoke-Pester @IVPParams + } + 'UnitTests' + { + $IVPParams.Tag = 'UnitTests' + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.All + Invoke-Pester @IVPParams + } + 'IntegrationTests' + { + $IVPParams.Tag = 'IntegrationTests' + Invoke-Pester @IVPParams + } } } - 'UnitTests' + ( { $PSItem.IntegrationTests } ) { - if ($Test.Function) + $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.IntegrationTests + $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.IntegrationTests + switch ($Tags) { - $IVPParams.Tag = 'UnitTests' - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.Function - Invoke-Pester @IVPParams + 'All' + { + $IVPParams.Tag = 'IntegrationTests' + Invoke-Pester @IVPParams + } + 'IntegrationTests' + { + $IVPParams.Tag = 'IntegrationTests' + Invoke-Pester @IVPParams + } } } - 'IntegrationTests' + ( { $PSItem.UnitTests } ) { - $IVPParams.Tag = 'IntegrationTests' - Invoke-Pester @IVPParams + $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.UnitTests + $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.UnitTests + switch ($Tags) + { + 'All' + { + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.UnitTests + Invoke-Pester @IVPParams + } + 'UnitTests' + { + $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.UnitTests + Invoke-Pester @IVPParams + } + } + } + ( { $PSItem.PrivateUnitTests } ) + { + $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.PrivateUnitTests + $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.PrivateUnitTests + switch ($Tags) + { + 'All' + { + $IVPParams.CodeCoverage = '{0}\{1}\Private\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.PrivateUnitTests + Invoke-Pester @IVPParams + } + 'UnitTests' + { + $IVPParams.CodeCoverage = '{0}\{1}\Private\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.PrivateUnitTests + Invoke-Pester @IVPParams + } + } + } + ( { $PSItem.General } ) + { + $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.General + $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.General + switch ($Tags) + { + 'All' + { + Invoke-Pester @IVPParams + } + 'UnitTests' + { + Invoke-Pester @IVPParams + } + } } } } diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 index ac4de81..949a626 100644 --- a/Tests/Pipeline.UMSDevice.Tests.ps1 +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -2,11 +2,11 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -24,7 +24,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -74,7 +74,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 index 1e8de45..4ce4d0e 100644 --- a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 @@ -2,11 +2,11 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -24,7 +24,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -71,7 +71,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Pipeline.UMSProfile.Tests.ps1 b/Tests/Pipeline.UMSProfile.Tests.ps1 index 0abbf2d..c746d5e 100644 --- a/Tests/Pipeline.UMSProfile.Tests.ps1 +++ b/Tests/Pipeline.UMSProfile.Tests.ps1 @@ -2,11 +2,11 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -24,7 +24,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $MoveParams = $TestCfg.MoveParams @@ -67,7 +67,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { $Script:Result - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $MoveParams = $TestCfg.MoveParams diff --git a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 index 4ceecc7..aa094c6 100644 --- a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 +++ b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 @@ -2,11 +2,11 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -24,7 +24,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewAssignmentParams = $TestCfg.NewAssignmentParams @@ -65,7 +65,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewAssignmentParams = $TestCfg.NewAssignmentParams diff --git a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 index 1b57059..7d475b1 100644 --- a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 +++ b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 @@ -2,11 +2,11 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:SpecialName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -24,7 +24,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -70,7 +70,7 @@ Describe "$Script:SpecialName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.Special -eq $SpecialName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index 9500c1d..30ace6c 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'Online' It "Should contain our specific parameters" { @@ -168,8 +168,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -187,7 +187,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 846c7a3..1b1eaac 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -118,8 +118,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -137,7 +137,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index 7a2f294..f7a9bb0 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -118,8 +118,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -137,7 +137,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index df772f8..3f69b63 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'ReceiverId', 'ReceiverType' It "Should contain our specific parameters" { @@ -168,8 +168,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -187,7 +187,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 04d32cf..9084326 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { @@ -118,8 +118,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -137,7 +137,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Reset-UMSDevice.Tests.ps1 b/Tests/Reset-UMSDevice.Tests.ps1 index 5721617..d225dd6 100644 --- a/Tests/Reset-UMSDevice.Tests.ps1 +++ b/Tests/Reset-UMSDevice.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Reset-UMSDevice -Id 2 Should not throw" { { Reset-UMSDevice -Id 2 } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Reset-UMSDevice -Id 2 -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Reset-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Reset-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -126,9 +126,9 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json + ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Restart-UMSDevice.Tests.ps1 b/Tests/Restart-UMSDevice.Tests.ps1 index db546c6..48bfdc2 100644 --- a/Tests/Restart-UMSDevice.Tests.ps1 +++ b/Tests/Restart-UMSDevice.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Restart-UMSDevice -Id 2 Should not throw" { { Restart-UMSDevice -Id 2 } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Restart-UMSDevice -Id 2 -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Restart-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Restart-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -126,9 +126,9 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json + ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Send-UMSDeviceSetting.Tests.ps1 b/Tests/Send-UMSDeviceSetting.Tests.ps1 index f9ac986..3b7ee4e 100644 --- a/Tests/Send-UMSDeviceSetting.Tests.ps1 +++ b/Tests/Send-UMSDeviceSetting.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Send-UMSDeviceSetting -Id 2 Should not throw" { { Send-UMSDeviceSetting -Id 2 } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Send-UMSDeviceSetting -Id 2 -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Send-UMSDeviceSetting -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Send-UMSDeviceSetting -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -126,9 +126,9 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json + ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Start-UMSDevice.Tests.ps1 b/Tests/Start-UMSDevice.Tests.ps1 index ddde707..b9dc799 100644 --- a/Tests/Start-UMSDevice.Tests.ps1 +++ b/Tests/Start-UMSDevice.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Start-UMSDevice -Id 2 Should not throw" { { Start-UMSDevice -Id 2 } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Start-UMSDevice -Id 2 -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Start-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Start-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -126,9 +126,9 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json + ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Stop-UMSDevice.Tests.ps1 b/Tests/Stop-UMSDevice.Tests.ps1 index 04f39fe..922a33d 100644 --- a/Tests/Stop-UMSDevice.Tests.ps1 +++ b/Tests/Stop-UMSDevice.Tests.ps1 @@ -2,26 +2,26 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$Params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$Params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id' It "Should contain our specific parameters" { (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $Params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count } } @@ -35,7 +35,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } It "Stop-UMSDevice -Id 2 Should not throw" { { Stop-UMSDevice -Id 2 } | Should -Not -Throw @@ -94,7 +94,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' {} + Mock 'Invoke-UMSRestMethodWebSession' { } $Result = Stop-UMSDevice -Id 2 -WhatIf @@ -113,7 +113,7 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} + Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } It "Stop-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Stop-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw @@ -126,9 +126,9 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json + ConvertFrom-Json $Credential = Import-Clixml -Path $UMS.CredPath $Id = $UMS.UMSDevice[1].Id $Mac = $UMS.UMSDevice[1].Mac diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index 0d98c85..19b8d28 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'Name', 'Site', 'Department', 'CostCenter', 'LastIP', 'Comment', 'AssetId', 'InserviceDate', 'SerialNumber' @@ -132,8 +132,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it "Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop should throw Error" { - { Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | should -Throw + It "Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop should throw Error" { + { Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | Should -Throw } It 'Result should be null or empty' { @@ -144,8 +144,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -163,7 +163,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index a850aa5..50eb41c 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'Name' It "Should contain our specific parameters" { @@ -115,8 +115,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' } | should throw 'Error' + It 'should throw Error' { + { Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' } | Should throw 'Error' } It 'Result should be null or empty' { @@ -126,8 +126,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -145,7 +145,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSProfile.Tests.ps1 b/Tests/Update-UMSProfile.Tests.ps1 index c1feb86..cd24117 100644 --- a/Tests/Update-UMSProfile.Tests.ps1 +++ b/Tests/Update-UMSProfile.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'Name' It "Should contain our specific parameters" { @@ -115,8 +115,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | should throw 'Error' + It 'should throw Error' { + { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should throw 'Error' } It 'Result should be null or empty' { @@ -126,8 +126,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -145,7 +145,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSProfileDirectory.Tests.ps1 b/Tests/Update-UMSProfileDirectory.Tests.ps1 index 9cb6b6b..f9d16c5 100644 --- a/Tests/Update-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Update-UMSProfileDirectory.Tests.ps1 @@ -2,21 +2,21 @@ $Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) -$Script:FunctionName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force -Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Basics" { It "Is valid Powershell (Has no script errors)" { - $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:FunctionName) -ErrorAction Stop + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop $ErrorColl = $Null $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:FunctionName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession', 'Id', 'Name' It "Should contain our specific parameters" { @@ -115,8 +115,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { Context "Error Handling" { Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } - it 'should throw Error' { - { Update-UMSProfileDirectory -Id 2 -Name 'NameNew' } | should throw 'Error' + It 'should throw Error' { + { Update-UMSProfileDirectory -Id 2 -Name 'NameNew' } | Should throw 'Error' } It 'Result should be null or empty' { @@ -126,8 +126,8 @@ Describe "$Script:FunctionName Unit Tests" -Tag 'UnitTests' { } } -Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { - $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\IntegrationTestsConfig.psd1' -f $Script:ProjectRoot) +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ @@ -145,7 +145,7 @@ Describe "$Script:FunctionName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.Function -eq $FunctionName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 From f219d5087acaefbb3dcfc740dc511971dadcd08c Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 15 Mar 2020 13:47:38 +0100 Subject: [PATCH 078/145] working on Tests --- Scripts/Test.ps1 | 42 ++--- Tests/Config.psd1 | 208 +++++++++++++++++++++-- Tests/Move-UMSProfileDirectory.Tests.ps1 | 2 +- Tests/New-UMSAPICookie.Tests.ps1 | 16 +- Tests/Pipeline.UMSDevice.Tests.ps1 | 30 +++- Tests/Reset-UMSDevice.Tests.ps1 | 43 ++--- Tests/Restart-UMSDevice.Tests.ps1 | 43 ++--- Tests/Send-UMSDeviceSetting.Tests.ps1 | 43 ++--- Tests/Start-UMSDevice.Tests.ps1 | 43 ++--- Tests/Stop-UMSDevice.Tests.ps1 | 43 ++--- 10 files changed, 358 insertions(+), 155 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index bb79c60..cbe5f73 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -9,10 +9,13 @@ $PSDefaultParameterValues = @{ #'*-UMS*:SecurityProtocol' = 'Tls' } +#<# $WebSession = New-UMSAPICookie $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } +#> + $NewParams = @{ Mac = '0A00000000AA' @@ -34,33 +37,26 @@ $Result = @( Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice' | + Start-UMSDevice | Tee-Object -Variable 'StartUMSDevice' | + Send-UMSDeviceSetting | Tee-Object -Variable 'SendUMSDeviceSettings' | Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' + $NewUMSDevice $MoveUMSDevice $UpdateUMSDevice $GetUMSDevice + $StartUMSDevice + $SendUMSDeviceSettings $RemoveUMSDevice ) $Result #> + +#Get-UMSDevice -WebSession $Result + <# - $NewParams = @{ - Mac = '0A00000000FF' - Name = 'NewDevice' - FirmwareId = 1 - ParentId = -1 - } - $MoveParams = @{ - Id = 540 # eff - DestId = 527 - } - $UpdateParams = @{ - Name = 'UpdatedProfile' - } - $RemoveParams = @{ - Confirm = $false - } + $Result = @( $null = ((($NewParams.Mac | New-UMSDevice -FirmwareId $NewParams.FirmwareId | Tee-Object -Variable 'NewUMSDevice').Id | @@ -77,21 +73,7 @@ $Result #> -<# -$Result = @( - $null = [pscustomobject]$NewParams | - New-UMSDevice | Tee-Object -Variable 'NewUMSDevice' | - Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | - Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | - Remove-UMSDevice @RemoveParams | Tee-Object -Variable 'RemoveUMSDevice' - $NewUMSDevice - $MoveUMSDevice - $UpdateUMSDevice - $RemoveUMSDevice -) -$Result -#> <# diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index f0b5ef2..bf0e19a 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -16,17 +16,6 @@ Tests Config @{ General = 'PSIGEL' } - # New-UMSAPICookie - <# - @{ - UnitTests = 'New-UMSAPICookie' - } - #> - # Reset-UMSDevice - <# - @{ - UnitTests = 'Reset-UMSDevice' - } #> # Restart-UMSDevice <# @@ -40,12 +29,6 @@ Tests Config UnitTests = 'Send-UMSDeviceSetting' } #> - # Start-UMSDevice - <# - @{ - UnitTests = 'Start-UMSDevice' - } - #> # Stop-UMSDevice <# @{ @@ -64,6 +47,29 @@ Tests Config PrivateUnitTests = 'New-UMSFilterString' } #> + # New-UMSAPICookie + <# + @{ + All = 'New-UMSAPICookie' + ParameterSets = @{ + Default = @{ + Expected = @{ + Headers = @{ } + Cookies = 'System.Net.CookieContainer' + UseDefaultCredentials = 'False' + Credentials = '' + Certificates = '' + UserAgent = 'Mozilla / 5.0 (Windows NT; Windows NT 10.0; de-DE) WindowsPowerShell / 5.1.18362.628' + Proxy = + MaximumRedirection = -1 + } + Options = @{ + ExcludedPaths = '' + } + } + } + } + #> # Get-UMSStatus @{ All = 'Get-UMSStatus' @@ -545,6 +551,126 @@ Tests Config } } } + # Start-UMSDevice + @{ + All = 'Start-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 576 # BR-MKT-004 + } + Expected = @( + @{ + ExecId = 'ID-igelrmserver-40687-1583585133100-2-0' + ExecTime = '1583588923907' + Id = 576 + Mac = '0A0000000004' + Message = 'OK.' + State = 'SUCCESS' + } + ) + Options = @{ + ExcludedPaths = 'ExecId', 'ExecTime' + } + } + } + } + # Send-UMSDeviceSetting + @{ + All = 'Send-UMSDeviceSetting' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 576 # BR-MKT-004 + } + Expected = @( + @{ + ExecId = 'ID-igelrmserver-40687-1583585133100-5-0' + ExecTime = '1583589223680' + Id = 576 + Mac = '0A0000000004' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + ) + Options = @{ + ExcludedPaths = 'ExecId', 'ExecTime' + } + } + } + } + # Restart-UMSDevice + @{ + All = 'Restart-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 576 # BR-MKT-004 + } + Expected = @( + @{ + ExecId = 'ID-igelrmserver-40687-1583585133100-5-0' + ExecTime = '1583589223680' + Id = 576 + Mac = '0A0000000004' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + ) + Options = @{ + ExcludedPaths = 'ExecId', 'ExecTime' + } + } + } + } + # Stop-UMSDevice + @{ + All = 'Stop-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 576 # BR-MKT-004 + } + Expected = @( + @{ + ExecId = 'ID-igelrmserver-40687-1583585133100-5-0' + ExecTime = '1583589223680' + Id = 576 + Mac = '0A0000000004' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + ) + Options = @{ + ExcludedPaths = 'ExecId', 'ExecTime' + } + } + } + } + # Reset-UMSDevice + @{ + All = 'Reset-UMSDevice' + ParameterSets = @{ + Default = @{ + Params1 = @{ + Id = 576 # BR-MKT-004 + } + Expected = @( + @{ + ExecId = 'ID-igelrmserver-40687-1583585133100-2-0' + ExecTime = '1583586682807' + Id = 576 + Mac = '0A0000000004' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + ) + Options = @{ + ExcludedPaths = 'ExecId', 'ExecTime' + } + } + } + } # Pipeline.UMSProfileAssignment @{ IntegrationTests = 'Pipeline.UMSProfileAssignment' @@ -654,6 +780,30 @@ Tests Config ParentId = 502 UnitId = '0A00000000AA' } + @{ + Id = 601 + Mac = '0A00000000AA' + Message = 'OK.' + State = 'SUCCESS' + } + @{ + Id = 601 + Mac = '0A00000000AA' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + @{ + Id = 601 + Mac = '0A00000000AA' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + @{ + Id = 601 + Mac = '0A00000000AA' + Message = 'Found no IP address for device.' + State = 'FAILED' + } @{ Message = 'Offline deletion successful.' Id = 601 @@ -703,6 +853,30 @@ Tests Config ParentId = 502 UnitId = '0A00000000AB' } + @{ + Id = 602 + Mac = '0A00000000AB' + Message = 'OK.' + State = 'SUCCESS' + } + @{ + Id = 602 + Mac = '0A00000000AB' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + @{ + Id = 602 + Mac = '0A00000000AB' + Message = 'Found no IP address for device.' + State = 'FAILED' + } + @{ + Id = 602 + Mac = '0A00000000AB' + Message = 'Found no IP address for device.' + State = 'FAILED' + } @{ Message = 'Offline deletion successful.' Id = 602 diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index 8391b70..09cc1d7 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index f042292..9154e59 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -27,24 +27,23 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { InModuleScope $Script:ModuleName { - <# $PSDefaultParameterValues = @{ - '*-UMS*:Computername' = 'igelrmserver.acme.org' - '*:Credential' = New-MockObject -Type 'System.Management.Automation.PSCredential' + '*:Credential' = New-MockObject -Type 'System.Management.Automation.PSCredential' + '*:Computername' = 'igelrmserver.acme.org' } Context "General Execution" { - New-UMSAPICookie -Credential $Credential It "New-UMSAPICookie" { { New-UMSAPICookie } | Should -Not -Throw } - It 'New-UMSAPICookie -ApiVersion 10 Stop Should throw' { + It 'New-UMSAPICookie -ApiVersion 10 -ErrorAction Stop Should throw' { { New-UMSAPICookie -ApiVersion 10 -ErrorAction Stop } | Should -Throw } } + <# Context "All" { @@ -107,6 +106,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } } +<# Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | ConvertFrom-Json @@ -138,4 +138,6 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Result.GetType().Name | Should -BeExactly 'WebRequestSession' } } -} \ No newline at end of file +} + +#> \ No newline at end of file diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 index 949a626..f6fd652 100644 --- a/Tests/Pipeline.UMSDevice.Tests.ps1 +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -37,11 +37,21 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice' | Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice' | Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice' | + Start-UMSDevice | Tee-Object -Variable 'StartUMSDevice' | + Send-UMSDeviceSetting | Tee-Object -Variable 'SendUMSDeviceSetting' | + Restart-UMSDevice | Tee-Object -Variable 'RestartUMSDevice' | + Stop-UMSDevice | Tee-Object -Variable 'StopUMSDevice' | + Reset-UMSDevice | Tee-Object -Variable 'ResetUMSDevice' | Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' $NewUMSDevice $MoveUMSDevice $UpdateUMSDevice $GetUMSDevice + $StartUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $SendUMSDeviceSettings | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $RestartUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $StopUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $ResetUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' $RemoveUMSDevice ) } | Should Not Throw } @@ -81,16 +91,26 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $MoveParams = $TestCfg.MoveParams $UpdateParams = $TestCfg.UpdateParams { $Script:Result = @( - $null = (((($NewParams.Mac | - New-UMSDevice -FirmwareId $NewParams.FirmwareId -Name $NewParams.Name | Tee-Object -Variable 'NewUMSDevice').Id | - Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | - Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | - Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice').Id | + $null = ((((((((($NewParams.Mac | + New-UMSDevice -FirmwareId $NewParams.FirmwareId -Name $NewParams.Name | Tee-Object -Variable 'NewUMSDevice').Id | + Move-UMSDevice @MoveParams | Tee-Object -Variable 'MoveUMSDevice').Id | + Update-UMSDevice @UpdateParams | Tee-Object -Variable 'UpdateUMSDevice').Id | + Get-UMSDevice | Tee-Object -Variable 'GetUMSDevice').Id | + Start-UMSDevice | Tee-Object -Variable 'StartUMSDevice').Id | + Send-UMSDeviceSetting | Tee-Object -Variable 'SendUMSDeviceSetting').Id | + Restart-UMSDevice | Tee-Object -Variable 'RestartUMSDevice').Id | + Stop-UMSDevice | Tee-Object -Variable 'StopUMSDevice').Id | + Reset-UMSDevice | Tee-Object -Variable 'ResetUMSDevice').Id | Remove-UMSDevice | Tee-Object -Variable 'RemoveUMSDevice' $NewUMSDevice $MoveUMSDevice $UpdateUMSDevice $GetUMSDevice + $StartUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $SendUMSDeviceSettings | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $RestartUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $StopUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' + $ResetUMSDevice | Select-Object -Property * -ExcludeProperty 'ExecId', 'ExecTime' $RemoveUMSDevice ) } | Should Not Throw } diff --git a/Tests/Reset-UMSDevice.Tests.ps1 b/Tests/Reset-UMSDevice.Tests.ps1 index d225dd6..544a0be 100644 --- a/Tests/Reset-UMSDevice.Tests.ps1 +++ b/Tests/Reset-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -127,18 +127,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[1].Id - $Mac = $UMS.UMSDevice[1].Mac + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Reset-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Reset-UMSDevice @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,16 +162,19 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Mac should be exactly $Mac" { - $Result[0].Mac | Should -BeExactly $Mac + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } - It "Result[0].Message should be exactly 'Connection refused: connect.'" { - $Result[0].Message | Should -BeExactly 'Connection refused: connect.' - } } } \ No newline at end of file diff --git a/Tests/Restart-UMSDevice.Tests.ps1 b/Tests/Restart-UMSDevice.Tests.ps1 index 48bfdc2..c8901d2 100644 --- a/Tests/Restart-UMSDevice.Tests.ps1 +++ b/Tests/Restart-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -127,18 +127,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[1].Id - $Mac = $UMS.UMSDevice[1].Mac + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Restart-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Restart-UMSDevice @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,16 +162,19 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Mac should be exactly $Mac" { - $Result[0].Mac | Should -BeExactly $Mac + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } - It "Result[0].Message should be exactly 'Connection refused: connect.'" { - $Result[0].Message | Should -BeExactly 'Connection refused: connect.' - } } } \ No newline at end of file diff --git a/Tests/Send-UMSDeviceSetting.Tests.ps1 b/Tests/Send-UMSDeviceSetting.Tests.ps1 index 3b7ee4e..2838a92 100644 --- a/Tests/Send-UMSDeviceSetting.Tests.ps1 +++ b/Tests/Send-UMSDeviceSetting.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -127,18 +127,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[1].Id - $Mac = $UMS.UMSDevice[1].Mac + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Send-UMSDeviceSetting } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Send-UMSDeviceSetting @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,16 +162,19 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Mac should be exactly $Mac" { - $Result[0].Mac | Should -BeExactly $Mac + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } - It "Result[0].Message should be exactly 'Connection refused: connect.'" { - $Result[0].Message | Should -BeExactly 'Connection refused: connect.' - } } } \ No newline at end of file diff --git a/Tests/Start-UMSDevice.Tests.ps1 b/Tests/Start-UMSDevice.Tests.ps1 index b9dc799..d6e703e 100644 --- a/Tests/Start-UMSDevice.Tests.ps1 +++ b/Tests/Start-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -127,18 +127,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[1].Id - $Mac = $UMS.UMSDevice[1].Mac + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Start-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Start-UMSDevice @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,16 +162,19 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Mac should be exactly $Mac" { - $Result[0].Mac | Should -BeExactly $Mac + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } - It "Result[0].Message should be exactly 'OK.'" { - $Result[0].Message | Should -BeExactly 'OK.' - } } } \ No newline at end of file diff --git a/Tests/Stop-UMSDevice.Tests.ps1 b/Tests/Stop-UMSDevice.Tests.ps1 index 922a33d..cce00f8 100644 --- a/Tests/Stop-UMSDevice.Tests.ps1 +++ b/Tests/Stop-UMSDevice.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -127,18 +127,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $Credential = Import-Clixml -Path $UMS.CredPath - $Id = $UMS.UMSDevice[1].Id - $Mac = $UMS.UMSDevice[1].Mac + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol - '*-UMS*:Id' = $Id - '*-UMS*:Confirm' = $false + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $False } $WebSession = New-UMSAPICookie @@ -146,10 +143,15 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { '*-UMS*:WebSession' = $WebSession } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { + + $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { - { $Script:Result = Stop-UMSDevice } | Should Not Throw + $Params1 = $TestCfg.Params1 + { $Script:Result = @( + Stop-UMSDevice @Params1 + ) } | Should Not Throw } It 'Result should not be null or empty' { @@ -160,16 +162,19 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Result[0].Id | Should -HaveType [Int] } - It "Result[0].Id should be exactly $Id" { - $Result[0].Id | Should -BeExactly $Id + It 'Result[0].Message should have type [String]' { + $Result[0].Message | Should -HaveType [String] } - It "Result[0].Mac should be exactly $Mac" { - $Result[0].Mac | Should -BeExactly $Mac + It "Result should be Equivalent to Expected" { + [array]$Expected = foreach ($item In $TestCfg.Expected) + { + New-Object psobject -Property $item + } + Assert-Equivalent -Actual $Result -Expected $Expected -Options @{ + ExcludedPaths = $TestCfg.Options.ExcludedPaths + } } - It "Result[0].Message should be exactly 'Connection refused: connect.'" { - $Result[0].Message | Should -BeExactly 'Connection refused: connect.' - } } } \ No newline at end of file From e56799c1179d77a8b2874f937321bb7d2b2ddcbd Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 15 Mar 2020 15:19:00 +0100 Subject: [PATCH 079/145] edited New-UMSFilterString Test --- Tests/Config.psd1 | 21 +-------------------- Tests/New-UMSFilterString.Tests.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index bf0e19a..6b0f36e 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -16,25 +16,6 @@ Tests Config @{ General = 'PSIGEL' } - #> - # Restart-UMSDevice - <# - @{ - UnitTests = 'Restart-UMSDevice' - } - #> - # Send-UMSDeviceSetting - <# - @{ - UnitTests = 'Send-UMSDeviceSetting' - } - #> - # Stop-UMSDevice - <# - @{ - UnitTests = 'Stop-UMSDevice' - } - #> # Invoke-UMSRestMethodWebSession <# @{ @@ -42,7 +23,7 @@ Tests Config } #> # New-UMSFilterString - <# + #<# @{ PrivateUnitTests = 'New-UMSFilterString' } diff --git a/Tests/New-UMSFilterString.Tests.ps1 b/Tests/New-UMSFilterString.Tests.ps1 index cb9efb6..28068ff 100644 --- a/Tests/New-UMSFilterString.Tests.ps1 +++ b/Tests/New-UMSFilterString.Tests.ps1 @@ -3,7 +3,7 @@ $Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:Project $Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf $Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) $Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { @@ -16,7 +16,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys + [object[]]$params = (Get-ChildItem function:\$Content).Parameters.Keys $KnownParameters = 'Filter' It "Should contain our specific parameters" { From 098b266cdaf07c5063d303054deaeed6185094a1 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 19 Mar 2020 15:16:52 +0100 Subject: [PATCH 080/145] working on Tests --- Tests/Config.psd1 | 4 - .../Invoke-UMSRestMethodWebSession.Tests.ps1 | 94 ++++++++++++++++++- Tests/New-UMSAPICookie.Tests.ps1 | 4 + Tests/New-UMSFilterString.Tests.ps1 | 13 ++- Tests/Pester.ps1 | 26 +++-- 5 files changed, 118 insertions(+), 23 deletions(-) diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index 6b0f36e..580b0d2 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -17,17 +17,13 @@ Tests Config General = 'PSIGEL' } # Invoke-UMSRestMethodWebSession - <# @{ PrivateUnitTests = 'Invoke-UMSRestMethodWebSession' } - #> # New-UMSFilterString - #<# @{ PrivateUnitTests = 'New-UMSFilterString' } - #> # New-UMSAPICookie <# @{ diff --git a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 index a2249f4..3a2298b 100644 --- a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 +++ b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 @@ -7,6 +7,7 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { + <# Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -16,12 +17,95 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys - $KnownParameters = 'WebSession', 'SecurityProtocol', 'Uri', 'Body', 'ContentType', 'Headers', 'Method' + InModuleScope $Script:ModuleName { - It "Should contain our specific parameters" { - (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys + $KnownParameters = 'WebSession', 'SecurityProtocol', 'Uri', 'Body', 'ContentType', 'Headers', 'Method' + + It "Should contain our specific parameters" { + (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + } } } + #> + + InModuleScope $Script:ModuleName { + + $PSDefaultParameterValues = @{ + #'*:WebSession' = New-MockObject -Type 'System.Management.Automation.PSCustomObject' + '*:WebSession' = New-MockObject -Type 'Microsoft.PowerShell.Commands.WebRequestSession' + '*:SecurityProtocol' = 'Tls12' + #'*:Uri' = 'Uri' + '*:Uri' = 'https://igelrmserver/api/' + #'*:Body' = 'Body' + #'*:ContentType' = 'ContentType' + #'*:Headers' = @{ } + '*:Method' = 'Get' + } + + Context "General Execution" { + + Mock 'Invoke-RestMethod' { + [pscustomobject]@{ } + } + + It "Invoke-UMSRestMethodWebSession Should not throw" { + { Invoke-UMSRestMethodWebSession } | Should -Not -Throw + } + + It "Invoke-UMSRestMethodWebSession -Method 'nonexisting' -ErrorAction Stop Should throw" { + { Invoke-UMSRestMethodWebSession -Method 'nonexisting' -ErrorAction Stop } | Should -Throw + } + + } + + Context "Method Get" { + + Mock 'Invoke-RestMethod' { + [pscustomobject]@{ Test = 'Test' } + } + + $Result = Invoke-UMSRestMethodWebSession + + It 'Assert Invoke-RestMethod is called exactly 1 time' { + $AMCParams = @{ + CommandName = 'Invoke-RestMethod' + Times = 1 + Exactly = $true + } + Assert-MockCalled @AMCParams + } + + It 'Result should have type PSCustomObject' { + $Result | Should -HaveType ([PSCustomObject]) + } + + It 'Result should have 1 element' { + @($Result).Count | Should BeExactly 1 + } + + It "Result.Test should be exactly 'Test'" { + $Result.Test | Should BeExactly 'Test' + } + } + + + <# + Context "Mock an exception" { + + Mock 'Invoke-RestMethod' { + [System.Net.WebException]::new('400') | + Add-Member -NotePropertyName Response -PassThru -Force -NotePropertyValue ( + [PSCustomObject]@{ StatusCode = [System.Net.HttpStatusCode]::BadRequest } + ) + } + + It Invoke-UMSRestMethodWebSession' should throw' { + { Invoke-UMSRestMethodWebSession } | Should Throw 'some error' + } + } + #> + + } } diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index 9154e59..9e6a0e8 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -34,6 +34,10 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { + Mock 'Invoke-RestMethod' { + [pscustomobject]@{ } + } + It "New-UMSAPICookie" { { New-UMSAPICookie } | Should -Not -Throw } diff --git a/Tests/New-UMSFilterString.Tests.ps1 b/Tests/New-UMSFilterString.Tests.ps1 index 28068ff..aefc1e3 100644 --- a/Tests/New-UMSFilterString.Tests.ps1 +++ b/Tests/New-UMSFilterString.Tests.ps1 @@ -16,12 +16,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $ErrorColl | Should -HaveCount 0 } - [object[]]$params = (Get-ChildItem function:\$Content).Parameters.Keys - $KnownParameters = 'Filter' + InModuleScope $Script:ModuleName { - It "Should contain our specific parameters" { - (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | - Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + [object[]]$params = (Get-ChildItem function:\$Content).Parameters.Keys + $KnownParameters = 'Filter' + + It "Should contain our specific parameters" { + (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + } } } diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index b575d85..16f2f52 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -19,18 +19,26 @@ $OutputPath = '{0}\Tests\Data' -f $ProjectRoot $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath -$PSDefaultParameterValues = @{ - '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $Cfg.Computername - '*-UMS*:TCPPort' = $Cfg.TCPPort - '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol - '*-UMS*:Confirm' = $false - 'Invoke-Pester:Show' = $Show - 'Invoke-Pester:EnableExit' = $EnableExit +if ($Tags -contains { 'IntegrationTest ' -or 'All' }) +{ + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + '*-UMS*:Confirm' = $false + } + + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = (New-UMSAPICookie) + } + } $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = (New-UMSAPICookie) + 'Invoke-Pester:Show' = $Show + 'Invoke-Pester:EnableExit' = $EnableExit } foreach ($Test in $Cfg.Tests) From 282bca7279a9bf9d8ede9fe8216cb9c66630dfbe Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 19 Mar 2020 16:47:59 +0100 Subject: [PATCH 081/145] added Logo --- PSIGEL_1280_320.png | Bin 0 -> 20891 bytes README.MD | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 PSIGEL_1280_320.png diff --git a/PSIGEL_1280_320.png b/PSIGEL_1280_320.png new file mode 100644 index 0000000000000000000000000000000000000000..0f20d23d6a9fd536551405d8da64c5492154cb01 GIT binary patch literal 20891 zcmeIabyU=A7dHF@2}J}26_GLsX$9$2P`bNOL`p!q!vYbcTNtDpq@_`ihM_^ahM@CF z0YOUlrNkepI_s~DU2wnFKX$T?d~$vJmq&dnn`OUtiFS6b_Q>#d_rSn@S*}_F+jhae zW~D`Tzj}LX*7<4@@BxA7*|)mq zSG~`^dH=cxVV!;TSAww5zFklLzds0e;{Wd9>2>)3%C)(y>`O!ynyXXB&0OiY(&L3O zZ&4X=sn>GD7!+F9Nf}Z)r5wg=_%yXxi!Sa+jn7s07;Q7TI5ZOMHEkl$xy0#hJU$4n zn1r;BFt1MCh2t16xHe-sg_F#9WOZTb?ze+suBIS?k<5wl3nrD2u+)*@K!3lKrDZOq zlczqteB8aGgPo{B124VRiY2!4y}2)R{QTO-OSQ+@zx@3CLUgRkpRCp#SnbWwoZPdn zTKAESeJG`#ufJkd_H4wQ1+&@m!15+3vLK0I0pga^;MGJF1r~z;@BZcNlA|f^7NQznu4N)J@%V9;es>Q z?cxQTwpmbbq!@F4=>ju`R zK-JcPcZk`5S8PH_K}51;t98%zc5>9v9mMG^pU>GLdW5xlgdbgVGTZt!{)Lf0IX>Wm zmFv7^`G=&UqxbfHpD9?$wxy$%_JhLmt3p`c(U)3Xl|7{I4?7M-4%p%W1? zK*`NAva&jO;Z=EZe>_o9R!%bEU*onOUoMwZNg5x#dIUiaKVx^IQR`NsRo|l!>F(pBU8=D}i9)y$x1wyxq{?1! zX~>VFS#fX;EbPn!_CGyFR;PYydnCi%x_UQapf-x&;zc2u8@-{iu~`xU@TADT>({PH zp~kBbb_oY@$n{O5;WBG>k;5tCF=m|pLSr?3iMPlEukj7%%L3?8J9vxVEj_>05~1Ft zV*wC_Zc1R8@~QEvGd_bjgpu1GO!}c!x3Q&S zE1z-ne@}pPp0i{O6;aS)(x{DB@j5(GJ>*lI)m4G+MRUhH z`sR~4w(tkp1ja{L2YISPH6E2nUyk0;$jCGaLiQ}tXaT1@S_XzTjoN)RxRI#}zvJ?~ zAmROtfEy1UtLJJXB4MTbM<_3p3*kp9C0uJ-GVi1Pt=?oXdHs73s|40i>!xCD7G1(t zo3PQ0MBA@w&e^m_Gh@tn{T}lK#1Tu$pY0qnvb6ORN~EovP2%kBqqg{Mf+~Y#Y8!jL zDRdrWSn9^wqoU{x4h%nS!fMr9vsdm>-h+5^_*scE}Yol@+ zz5NdFQfO8dlgEqYM_8s#_aH_P{Y(jPzas8I?;^Ul5MP;aNf%Kk*F{W9mW7lT*q%L^ z>EoFA6szrG)1z!QvIY@RT&$gIV2xhNzwB;0E35U*u2yw#ckwQP=!uf?4=~*9LVCis zpn6E0k4*!ENG+LzO&LtpZK2q(492BJ7Qn)+)!8{>ESnI_ceh#vVTI zSFgUlzVAD=ZinklsbaoFuqMB_PIk}ri{w03al)?0PyTz6VsR=mJ}P4j^}=i252Xw$ z#o$k8`Q3B0kMFz0=yq`?AMZL-3D{N;e$MwgarZEV$&P5J1SRc(J$-b|%RDB#;%CRw z?qyU)lB$rLb93-*t2c`hSG^s5v4a8L@J>^Nv;(p42bkTnBk7sVsxhK-=pf=#C(|M( zR#K?a`%;#s;Ev#A-v3es;8{ z+RZ73#~S7)b50}?Di*lvjR7qWKL9hm>W$aHY7;k;5KiX=T!jzI2n#+_-~xH!U|Q&1 zbnOh;ph&ld-j>APVBy0mFW0$d9$$rsWrxZDR;qhYN3m)59hb$-^c2gHQdrZwV!?@% z;~nGSVzYh8FG1K{tBQ~^Ktf$t2}IkJpqp3qynj{2OphZi4}J7pBbPaiH>k_^b6+7n zqNLZ!GUo3n3bF33-VQTvrTgeNH=PHl4$#do+qo7DB<4~4%x!! zxupMIiOx9cHq)-8X9h_><0h#xXME$gJm6;XZZR5>}3 z3>-))+2_|01{tBzj8U7N;bmlbQ5@$!i4xSUF|)Bn8XPTZzz*adhvCz>E52-xPBdv? z`R@bnTANQ|X>2*7nQMuBhj5)cOf4?dt~neR_nW>@n;5h~{pqtp2z#}_qwC9pUrlHQ z??Lsc{VZAe=HLkh-Ra{|-*dQz&VBv;Ee0q18gLJ~sgBP)4||-8 zMPY7bDBpz9{vITj|Lt3s2TAUrCkdx5#&dXMo!bofK=x;s34POx$RtOX`_b!p=ak7( zc4(km_fP%VJiMWbPaEcxKg+QrZhq3uv@p)#zY}R@<3Fp)S8L)^#ch-tCrDo5CZi1b zsH>|->e~Fe20M^!m$tVrK1i7~jNt6}%Vg`PEW|cO-L$he0!Q!_!V~v&Hfyn_kP9oHOo9k6sVxRlue4j+ z7bB0a*lqk`_f#rItr<$}p|b{5D9sR`=3 zoDmTkf;;}ZccTnE%L8t5NyA^7DnY|k1mKdr-WA6hdcB(HDc2rcdVw5W6tKtfa?A0z zU5fI_1xWP!sR!vok*^4AX^a^>=}5hR$2NXXDeG{9lKlbuqPXA_&u|VMxZ#>2gf|#+ zS7O$W0k$^EFr8m)F(`iw(7=4mB{0yRrI}pwHc9i{R~wsf4ba_E4-|~xO1N_w`uXv6 z7q5#OT-e=NXxqy1ffowl)A7GyINoPnnNdl}DwT&n#|)tW(A^#CP#6g*TCU}n8NDEZ??##J|11741YCG zC9HmT?7-M1DCowQjNOMjv;tQ_*qNE{PDY0%95&b)d=%+TlcPArG}o?ObBz>x_xEis zx>)CvVK=<1y3@Au1rH%T8V9al=Q&$JNt7N`XLcG>ikTOs^TPW_ww8Sc>_{V>1O0AL zB5@8rYh`Z|;?dw5PDVsUwbc`gESJ+X)Rs^AP>hye;`)29kh&18b$*}jr%k4JOEPuQ=HYJmWlYQk6i$Gi=Bi>shR)lueiy(ucT6^C|>1Q-O`M~%!9h0fESI$Q1Q z4z}UZw@-v@(_m9w-%si@SEaO$j&uYYp9IJ(e@QkT4?J?k1G{qn8_ac)5x!1(GIzKE zkHWopeV&|1=biNhQxAb}9jtN}YWu-u zZk*_LXO55Pxqe@ZT|VWW=`VGmcZp(HH*PQ}z`~I*H+g`N1)CHO$+;4$-F60wD5?KA z#QT)k+7OIf53jNDbL8q#A!2>grLZ7H*7_RMMe=8yPAR1_SWMyTK`f!(A9h+a)Q3~) z;(Q`YL1`VA+B%9Ep>sxk8A`Aj`r|;?d5Q0To5^`?Ea#V_99?@XVc{#|<1bq0glzA< zFXP36bk0mHDa!% z=dyt@)bRAUpqyVt-MHbPOqsxTSKY^R!TKCQ-N5fcWB&v1^Z5_JNo&Z7iydO z+lSpw!JUlhHa3h(Q7yMI%&V$4eRoif4|VaL9XGX!e!d5T1l-XumrZ!KN?74|OK!S% zmVwc3Yxx5{u3?*+s%kS&&H5$yI>||zOcYz8EkYXnK5*%$*scEdE6nd3ymgfC4E5^J zW)vWzN+raBh|e}(aPd6@qY6L=DJFui^oZ$~U*7y>ckiy?ewD7@%d%S?W_zGVO)b=09nmphqBg!kv~3f0ej{S*GD z3}wOj+LPa);E`rS#Uq3tIk)|=6?zVR)IFVhK!ClhB!DaeTRCO=ojzl$mm;f65w#C> ze`I*#RiPIqQ0cq}*Q1!&<@EAQ*sAV9a6L1#O#At+A9isK31+=%p9MGCIbD4^9{;sf zKbo=E+P@orwX2DW!=NUqv{%2GQzQCq-{Sj1A4Shb4d&fA_+sOaaQ2oz^x}P4D&BOk zcI;)sa`JJNPo1AWt-&S3p-U^ask2{MA9(&bNwo)kBg<)ouBsau&nXF{e z_=a>3G?$$JO^wH~ZX6Z_1a)>QIy%fECwuU*pUoCvib^}SEbKfR(xiVIZ6lfYB_*WX z;zqDtp3{-H4f3b}3lC!Or=VwT3d-KW2bxudV+JtRBX0`m%OjtM_*$x%6 z7c7*0!-+DO1nEo(V9uvl{>+?QJ1-&5#e@ir!HNkSl!&YBry%u~Xtj}4u7*}JPi zo_CVz2Ke%q!lUVoFdh7@x$Z1C>-=>NL*jrSlbj#Udw z6R*k;>FFd@u;WPR&o-;NmznqeVxz}eYhZtKbpHo*(dJ%HwLzrr5VPKJg@}T@t8)OO zI3_PX(JGJ&>LI-9-H|SwVqo9>1U6G7l(iY)=Vy};>^AO#Z23iIz=Dakx{kk%)02*C z_mPVePAkJ|!zC6B-QC@=d=u$D%_w#rBR)@~za8>!5hQqb_0uPidn<(1&LL!`5^Xc{ zW-k1Mmc;>Rs=ew>MXEdtd*)($@-5SLVy(*iY4zMCR6y897{_9ibA^UI--!+tX?@fMh6d~g&`sQ099*H;jlDU zp8HxnBG#xepu5O|O$01Tz%d*HqFKGAHtc@jk~O!n*UDmj4Bqg-ns4MQQ#M%SN7_-j zBAcBgWTS*H4zvW;Uvp*0sw2W2tPGa(kpSPS(SCKLSt<7-7cot?W7NAWOW84HTCaHR zTZ7wh8x$$B&25Y;vVqV^L}$jUiGADCvUj>F-TG$u65G@ze23a!cRNcjev(E+8Hq$X zuDUVi9^-H{YsA5#!r9b14~8FtlP)s+fo(QYnu{EIC9SF&KI(a}5*iY68=r_WI9Vb{ zT2F6jqHJ;8FCrpBSy_2n-)1mbg1CHZKu4(Qa@OX`h(=K7E6;n-3BWGjH?paN#X4CR zzvKE3>c(6LNdH?hKrUOz*Ou`aYBWJZA6sTL;%*GtKcD{*H8w z;&72k5G_4@D_PAN?!sufUGr-GZkxfea!{Q+W+8iUuf^`4wEA|&+902(ufbjm_>Q#c zG|8A{*>gX!;qaWX+VOXU-6E{ZKMi3+?slc9Fr+QnAUjf319!jp{9)r-rfX2A-g>vu zs+xm-zJ=;^?~Bc>$3o^s86*z-19x0Jf0FRkI;kI#`kmX<|745K*UAp?cus{oX`)m3 z!cQmE<#QWKsm)d*kdl0xVKOUJjg{RKVBOh@rMwMFi?8Ude6O+Uif;CMP`C156J5k! zQ?Y+DmEp znaFkqG#=lK!+>icJiR02lL-6Nh^CaLxc)7fcjsO|naoAW1smZ_M8{$__F&TGa|>Ka zV?-{7;|aiGoBFZIIXSYzhimm;S;_-He|A6_%rji|Hf78&=U~0+J#~c~1W&#roT;|` z7cF(aC{o`7u(x*M)Yp~<@LSckXk{d9FABX>NsesHV%RHf*gt37X%Sru4@&Lmzq^g^ zz}`AB%MvQ%Y62^uL8{|5^45B(t=~TS^b&+rZ9oztoeyu6RH+Na?4(BN_qdtVcpWVn ztdjbiD|o0`-3WZs7V`lhqn7q;|3O!B6 zq=kk{Rkij-;(K2&3vg!LyBRxCcmU-w3A1#!7{w1>XbjXDWGc|M9mGo9FYh?4&1b2T~tohu$Jb7x* z-DmKET}CQ?`{40vx25XB`mc}PrRbDd!48%p+)&jTCsJNXkhqLXM}%1-L`Y0f_cTeE zGXqW}rG@^0HS=P&_3>|~V(CTqwGV8N+i5Cs|Mlw0YxAStH$sip>dLb^chh8yE#s+O zHuh4XL#;V%q30(8iZ-(QY?=&uVevD0)YolawopdVGiH}9O_&K2h*~piw9B=Se2B}KgC+#7kTd#Q(Aq>?@{!D8Bn;@gW9E$E^LK>{@up}{T(Mw(J z!hC!EMB4t6zVB7<@nb-Ax&_v=mrs9Ue$f%jO%d8S9k~T z1<6v1(c>)LQ2`YaWL}7Ey~qjl?c!!I57! zmXVPW9iU)Nh`f^jbyVuKx5b8kr8nD=Mzywj_@*SyjcTBvx^jS1fyEhiFtIq+mTU~; zCx^zdx&^5&D)A(+6NoxE=(@+cJ2YPvGCyGXt#@Z>J8IzsNpscPL`F_-i}D=}2`TB! zNcvc5W2xl`CPU|SpcLMnJa=S$7=(S96~U#E_5u68;5|r(6d9*3^60x*{;R!4d=&u9 zxC#-5<-!%vWzDk-oKxRqKFVBFwf!Swvo%Dh^t$&YKbZ($iH@GTz83)ObsTdTbP4=H zT#&iTuhA4=D`4P)xaP7_GPo&HaPD75g2!E8lMJ>kR#4D2t$o5ql*Sl3Pk8F>@W#Wm zE(-4a$e=Z8dw;2N>*E)=2JY7b`x4bXo5j)V5%K2*3F;KIYuw9=Ek_3I2@7RLfb~t{Qmf_ z{d;$#L{L-Y(Qd2fZ**^QIfr>ax5q5jF5oIAKFz&BxS0BlToEp zMn0^;#bWGe%Fi6+)y~5MxjKkxfA;OsnieT}`2jbGLg^nz+tdxnc8e+g@||~?wk{K| z%(6Rw$r>;kiIMcs@jsA(HOI2IZHKo4Y$9~`uS62hSKD#1gr+g&1MXyAAwhZJgeGcm zQ%?2DeAPr4N2&~*&}B`ecebCL`NdqRhb#LPKxw9fF!{@FgdRDdV;yl0|NGSUj{i7F z1&{Upgliwr_S@JC;c@z224;Cgg!+9pa*|<=E#$UHP*mA(k0`V{c_u^wz2-icV=*2W+f(P*4d9iNG+BaZH+y-9fS8O<6%o&T;F5priZr)wVC-A(7YADTuL=Ks zo%aRzz8Pk_#cfAuR4{zYkigPJ0iHV%GdhM_XnrODQVFgKE)dQUn*stx0&`@-AECk-f`9}Ox0fj^J15{}>^D%LIgzEv% z=<9dOzw1B$y!(NMK(xmm6o9i$IE$+qp96Hg@->g3eL{yxY=ftb_-RMz_M(hg5=LsXx`(5#ZkP#yblMEDnOT+z;Wqq{I%m6F=0idYg+RlW+d*jXI==_-M7Y^&UJ>IW~VclEB@0y=Cg|Ea$Zm*1h==ho1#kp@_ zpcN!I#`~KK;wGRXx<8LY4R%2cYsmQ?bXVeuTrSJ7+8qxOefEi)57dUYZ=%LwAACPL z`(j@fJ$L46)PsI!x3m9>D?fJVeC*UBZqYuX)Xp&pG0b&z_uOXduXdXBWiDO3Ye@_i zZ<63KVE2W7?gu_iUoug`IeemKM3lj*K9|(u2B<49B$GN{^*$!XHJnL=0%RB6%K+xs z)c&TP=P3|n{FC}WZk~!`j(P?C-sC4mF|C%BNcbWa{jq@89iha%|GWAsmqOQ#avy#l|yTxDfkHUt$IciWnMbW-@JGyhICl#`JWZ0))61vc{V!Ib`S zHU=|;dk@Z+0zm0b`{Fe9>#O{?s*(9&)2 za=qx;Foi`WUozau--!^d+z0G$>mZ*gk6dQ7vHpR^MQ%v=;vhLg5j&SaS^AG_$yNDQ zrkdx@+{EX3%ve_=%%Tt^{Mxl$ORx6uw~-s|c{5%txz=zDw5ffWYrZ9>_xLs#lvSrx zvdn4>vs~Bh;{^n@B*Xe_040xc|x!! z#-Qx?$E;tK9}1-&SDxrSj-~C;$=$j2TADc1{>&9e^=*^`{;>K5>TQ3V?D4+BZnsAu28w2T!p}s z<7tJ~a1TU;s{*#g4^UCj=g`3NVeNE#K>t7t)*j3L!MAlQCz=in`}Qq1d?h9t!0Ltn z-q$<9eGzX&;L+?nms%qNFJx{hkPaY?OyZNt!Eyh&xz1K|mJ{s6$0oxIU(Ovcf-=jJ z8|fwtN1`#7iX=YHvcK^B1l{@8XRXXl>t)10A2 z_}jihalXAL1K504UDa5O(2)|9b#OHc(MtdIU-$I=&(e1iAlrzPCM#ij>QRG!bU_m9 z{8!+z5r=Bfz`PRvU`rT7>aynN905goBX#Sj10T8E6K*(iXWx`eoA%%DNewSE8Q9C#*{mV8VTP_Y% z190oIdTxY2!}zC)RxEZ&Ecerh}zgI{h z^QQ6KO~lNpgJ*&TU>4UtP|*0--jkKcI=_5YaA;{>qx;)Br{Sif64sxK3<$!EB-r;6 zw#4H>(Wlifb2g&B?YFTv_An0&H>EdcsC{r95R-_=T8#*!HoBAe+0~kueJIO>UJ&es z`_7n?P??FgRmB25f#^F>osA_pb;|EA46Lw+3HZuBSUmiD@tF`UD_qT^N!rZVH1foA zI3wbN?URY+{R3=UF2miVKo8r}s!Co#8lnhEb_oB{&DnAxOmzLvJLKEbYObZ`t~nl8 zt!+j9F!A`Ai!RprI>pmCTP(OZd*^}JK8t3$iJ;&B&AqS#;W*d*OjBAxn{i^QP)=i0 z&ovsn8H{DD&osGN!Hd7)3@s}{p=pm#BiR)ut|o=%206FcGCu#=QYQxKCUNB9pb);J zur>LvG4J1|Uo6CE>uFm7TUpD>6JTSP)xGmzan{%O-Fq&jPRdynYdqJiuB;6 z%+aE*EBLM=7k%>OqzhcEiCylm>S1cc{+9 zmsWcn3Y4KZqfF}>*K}DD}v4&#mtMXDW*-@7A ze*=-P)eFJFOh$vK9!|@&yZu~1+~tmZ-{M9i`I_`v0)0MQH`Cx9-!g-9m;1t9t}*Ch*;|aMjsMS3$fV*VZ2;`UzXK-~>2y^2@1YuF z+AfCmrdCxvg%^6YPm~+z$5p8&&Ggc03q6oqA#Qv3jskfEDk7z@Hv0t}EvaTL& zRh61)k2}v?`k$!k9;uDA>z)PoEoR++bR=cy+rNhc3AXTffdTxRNCZ`O$b^FS9ja-e z?I0Yw{C3T}AkQ@bR5VppX)(|k$t~9gN)NgJ6ImL8=eh&X%}WG&eD3`}H!PewnXWOW zDJq>cij+ZNk$k&s8qKtDukb^_Au{C7hiw?w(tq>f&7*N^qkiBO_Za z%f{wFw8rR6mi{}cB)xHUMfHr)q33|u1hGS}RsF9OMT*CNYe;R;@Rbi)teA0iT(QZ? zlaJ(OFt=vaWgpz8(eO%2i@czMgU6!O>2(f|jc66W3HSnLW@d!I#9km+WP5>8qT6G8 zP!jqNTe@G^AJ2Q+<;zYhQ2#}a;3e6&CYX`N$ixCGJ*3s-7U*bp@yoXM^|Qzmdq(v|Ri)1aVlD6cR^x z>EZQ%3`rtyUO;`|Dosz(O};GiAen)Rc(nMOVEN3ERF6{pDBVk56jBvFBOd#4f4g$W zS*v)-Tet$qeD0wEsel>ma9%>BCz*)mUzQa>xVTUam;=efI4;`}!^jQl9@V5e<=H2ZtDYRF}By5{t3QB1Y?eu6$&}Uk9SZ@Ap6W9+jq8^EdYxkfh zc!W1@VTx-bT&(f@4*xS^ag;Vza^%i2ze%FIOPBaUcyuRv-0u9}Zg11+dHgF8dsR5S zuqB`+(BcEw3pw&QA`Z)vcl~4>jw>(6rOsaUzSEno5CwQNSF6F|hK7db?=~}=&Gmpm z{0~>VlHB>`1f(w&w1wzou79lAGhm;d^GU@H1v7@Ci)k>?syz8ds9UAv87r(%!~Y^w zw?{xFiIih8|MH8LHFBwtlbq4CAZ=+jj)GMT18Dxoq9Z6J-i%U-qi7Njl!H^+l3 zgaU##DOuTYY9ZHP1;o~%fl~rEHPKng<4A!OrB_ucK0TM?NHhBbJzn>Zo$RwL;xGuy z<#{nQu@-l6_y+a!Hs#CGTMgf3SI}ddpcGac-WgCJbBqdbraU;`nw)938A8AU5_pWF z7o^bbQMHH0W$!PNsYL^INx$8zkXSIA6F|K#{aqV6T4-nq<8Y7(5#+QA0Tk)`eKjf; z)Fsn@JZLQmqP^D=B_9x-e&jQp^Yf02!@h0#b}pr#i(PTpgVlU}yJvPa=wop{ZI$dG z=}ARsz-=}}La@xj{ACBhxW{b~89lvt7VTomxsESng)F+?6)T)jt1c|Ek^nuN93n-w zOrMdQRauS;XB0mi(&dX*ykDRQztnwPoPqTrb% zLCt6NeF_h5^z1Q4)G9Z7O0jmm!e`DlZh?_VMOQur3wjZ`gU5WSsh2N7h@DSvl>)|q zVjW{a^uIZo2J=4Cm8@mdrjYi`{?w1*FmZdJas0t=pYOM>t9aV0ad1dFY=c`g3MX@nuF~ ztRZ9+y^6CCx*VrbZctoU#WShYq~bBY#HXG|bzgrPaN!R4L^4zftWX?~VF144r39om~vpv%Ur%SvX6ZN^lDX5X5g@3jti+#u2v&` zqwX6WuCpQFS4I_~*p|~G(^o#n2({LUwCj?C;*mQ(OqOw@f~Id@r%M3y}>hhVF5kRw6ryjO9W`O+JiCFDWzv* zWc>5}1=r2(WauFem^eC?89=TZ!uZSS zhJn4;?HVs&GCN>GBN!%gWa79qJSu8Q=o)LKo$1H8DFoH@En|!wz>bjw5f+uS5||xuVvw}2 z3d+N?Z`=e6h0A_1jeuqWcgB|>1tOsde)&H^c)Zh=B$rJ8&Do976 zJRgeTv5(9OOOZp`Kv)NE*6lzYh_9&vsR?wNG8mnq4$;%b&Wb8;Zn;bKD@AG={8K`3F<>U z5IA4L{TlP9YzahElSz?#o@SFcG1s0Mq?|hsXb&K3#=CuKqBE0%3haG95U%~W!a2&2 zkjo^T668LsS%L~KR#?+Kjt!@)B`=dKebRg__>-$-^A>8>9nE`#oS;sz9JIIyHW|8B z*e~3{@VRc!0F7uThGk0sr?~tGYv@x3oMb%{G$2T!r&Cf3fvR0N3%X2scJzv><*9kg z(yih1!sWIzb-FHQi?%xy6)V1h(ktuDRSyk>T$TrR=pVYYgMxTy2y@wj$g|p%a*L`U zUnNjwi~wy0&31&IA1i1k(TKJ!*bvZ#|6}EbAW)UwT8w;9-Pod{wPD;?dWSKSH!X-B z!T~B?P_59RE=eiVJG{XFG7nH4Fx`~hGu`9P%*gDOAR`uNYB<{N;ZxUd>iW!tP0BHg zf7hgC{rq>|mMW@)RGmV*=ST+@S-*{mcNY7fQz61DYAG(C>xmb-65r)$7Cc7z3H{F@ zY$QkSI?72$)y^Vh)L0W3p!b0BL%6F!S z5nNH*Ew=eD4(23O5GSdf5oGji5oKgn!65HX`5q^+;)YQy00on<+d{rZAIfHK3b0AW zvjmm-c!G*btWi4-f&POw_vt#lh*!xYo5VyP&z218Z&3Og*n$d~^rJ^_#wi4VYos6$ z<@}HG?KJFwKcO}bPCZ7VGIsI8(>xZ8wrRf^OLQI-mO9ySzwUD{r<-lew&d)|U&j$V zfmKV7YgH-jvky;RcO&Il3BeU0Zk`^aD_j+gdBwzc=a)qG_lo=&P-KvPJ{`ZKYS&t; zK>K94F|}0>r4UJ1DYKRR8)0Z%qWjDh3nU*vkb>D&2i*9Cd~DV7$+s7CDgb@+U+3$| zbP3rg)YM8g5x?xds)_RKoCLNdD|)6}N}#!~-=e=>-xYddl*}bxt4=W-tmUy^E5ZFUs(R!%^0a5^Kn`pEtlto z*Y2^06Ag5(4Q~L``~87Y+zd6Q&M!j8&8-gll*W{M;s3rj7|p?=?hs%4CppOwkPF(^ z4(S8i6y|^o0jmV8_>Ll|GPFh}-(JGnU>C-^Jl;M_Jw5Lc)Qgk|%r`@N$p zzve`68u+w4JQ}5irt1KMGzB^UR zcOqngNZ)R&1KHvb5HWr{=ZpQ#3=scYltBi`d8U-yuQcnTLh*H;Jxe^WH_G?mxQ%J= zp#KvvsY6tuMt&t3clPCoRTwIB!w6afLP5-mFN4a1))8s=xq{^~KB-n))RkRyF?LK* zwPw&ycMvdaw{#Ynq=Gy+?me&$jLg*8UR1&dG1{bZDX&tnX%;!^IARHORL>3zCmogs zS}w9z86GOX0?KqzQj7(-9ITXWnO>1r2RmQI)42!uDz?>_+ahhzNa21=%J8nnT*O1-{h+%a9?XZ-IrlkNc#dfh|lkzqTp`Bk}b%z;b)X8WDl8Gn@ z>foh7)wLt+sy~Ca>pS=Gf^GRybR6Jo7^HhdQI6Dq9odF|-R>CxC0~zIj*usU@T1&a5Z4M;l3&-2M@I3+@ z)hjWFuu&>_Fe zV%R;s3VR!wS?0X&Z{v*m)bfahHiKa+b>QYr=L2@0#9?(Vu09jLXKdpUtV+O3?6md%zPLESE?kk+!D)VIF49+4DHTH!FR1?9Ehx;&Zvmqj*c;Cv zM~{VY#w7$T0GYor8p$Z5fUtJiLrb=@>`Y|i2ZLTWy`*@N>`3ZLnP3n1SN!}8)juAC zxq~*|d11kNivU_%z{+U@uhXM>rxdb>|Bl;ugw$1x@Kkuw8FrF0G&e4D6S@PS7BD#* zwtaSOni_^3Q8xsfBgqD(zE8M0jfZhQ4ROr^sdJ|3A@h5IuD^QWi zy#UxtmMa<%cia-4af=*ku0jDl<~g51De|oG+$?m9@-!XzIM+J%T_VXXuq1u?j!9F@ z1lKR$%>aCA+{togM#hlNcmcP-F!7h5GGGCct(!6_*D$JGgxg({)={cof9uqf_^z)o zg~Esy!I!JGOH0F_QhQ)v*z~99lG( z%-QbcutNRSuz0~Qm6GbK0<^|W=9|qB1j-p_KjS76&9s>Du=s-^+n;zziMDW}no+`iu&4p=H2*f)*MnQ2rc+3qaoRv!8kRw3_GGU|-NrzCGp8 z-}}(8k40$X2MDwL0*=eUOZmV{x6|7GJtcQNh+DAhE}smL-qR_Vum|Tj2yC8*AWZWW zSlh$7i6V8W0RH1}FGq&F!=BPv-Y!p;CTS_2NUr_@phZWGoFVx^fJW?t*YK<#}< zXWU8_2PgOqOgJ?DG<-Urw-Jtz_u>=r=FKvzCN^+4?9_0?XTa}ZE(VD8zv*`i;ql6CBn=dCyX z{4V1*^BJ%sOp{mKk9YVg&{M#1oZSNd-?)>eeydZ5vB7LBVLb?ndNi%s_)SK_?!AkU zIKinynC=DOK?>PG=ohG9yqCY?rw|6PWfv!nJD3)iVI2h8YcOq8XQvpz2E}jm1gZ2rI_xYHFFCKgtgbf7o_Lq1KXL;JgtX&8(Yi3D83#6%lb^WjQdr4 znj(q`XhRWp)+TL5Gi0rp@?kavJw789Oh37L5o%W{4b!E#bY5J4rn)!Csk84{r4P5A z$Mk*a>c$~!F1ul>)-6-@zFPs{a{u}9S3nv@JE7_a)G_&0Jl!6l)>4QEd^YG5Ph3be zt2X$hP=P<&C9e_(st&cw0bb%&&_*6{IeC;a8EhGk`Wc5I_7fG^FVQm|w(; z^TLEG&@e`eq4`q@!ZZ}INtvO;!uc@e=3`RG`}JvW?QBnNx# zO;B13K)S6uH2G0X(jw6PGZ9p`vRX+KomHnfsETOUvP5TNbp&v-lWli~YK?3!#9Ra< za2FHslNhRCwf}|wfmHja*z|lLL@s>MLIN7S{<@GC)Um!>dA+95$AQjM{=sWS ztX3NDtd6;+{q+B{1Auvl&ae}NJ(YJSq+QK?gB{tim-(cTA zblq8HCDVQV2I(2rb=s5#+9eia9)NDnQ{(u6eHp?eNd%%eV!&(P=<1(If4IjZOgtOnV>(ISDUfI<8Oez9MMqK8vV|d@kq| zPG7Db)Qp3zXMWB;;s>>zTr9cTSCElDspc^5NfQEShvf@sdek-7TJvYGnRgMCY}@FO zVJ|1%~l<@7{*ocnq|IX<=PQ`{y7oa3<3&;at$1PyACc`(?@rXmEn>w z%wrgsdIjL@dL_Dn3tj=b7c+oM{`9f^#4&eSn=;}Gtu0gaggwvzfCHib#wyMObs9wU z_5;H}k5e!x81qe0vWp}^n=}sBMlzI=XVGo!JK((o7?3%+fTs6TSsUn=3X1gt&5WlG z4fDj%sdIUsDXd)}SHu0H@L)2S$R?9ysYXJLg&hZePq30My$$n72v7{}XY2z0vQ`dM z6jy6cJTdt{EjRbT#?WtSwcSi#SNFX(gGdnYbd>hv{r=||WHszlq-_UKp&IG=!6(#w zDiz!9_EA48WIpsC3`8>H%qRmHsmd^2YFn9vY#3}~p!qGxYgZdCc+diIau*S3P7i%n z@6&>LMPXsQx)S-Im^DhzG3IdDM8s~#t={L-zT}YazlV)uf@)InYOZu%GSs3aBZZA>)PZakPws}E^5?C1X_)43TDi+0G)mdJ?hsi7ny$Ws(t6uMcix!uX2=b zZf~iT>H$E3uF+am%dPFyx;MkU93DHft&128|MZD~oa4nuLMr~gp{kv6H!CH-NKDJt zpuSrNE4k{Mff5T1@DR@W;Wx9#n3@u%r2r)0ig`8r=6mBiHAuFVG0+4wp4^NEK)Lb& zwN>=!kY;OQA})?nXygso>q$|#CCSMP@c+7UV?iOGurGV(W4iq=(HVzU+LRIMm;Tn{ zKLoFxlv_K)Fqy6H0D~ClN$e9brDa^&4D*Foh29tb<+s1ZIek1{yf2cSq%ZT!D+U{WMM<2h~TI^TW&`6gcf*?p7cs8geeKlD_ONRl`Ut$Zy zP*-V$=qY3Zzwca^1#fWZ!?bUC#fGwbMOVqL?%h%Vm70c^n07h@GG=2;j_E*56i^?{%l}AEs7RXa`aYEwWLlYiMP;vC`AgwE%FWvy*u9 zjeE};YuV@>r!j{pOhf4EH9w$lutSY$fSxho-@nKp1kJ3pJf=7vYgmp!?f8+9#XydYzYzFqh*j+W^+RKIjK7zhS|ylEL(g}tA#_qe z^}m+F@FFIVfY0kzGCYOI`4m}_%!P=%6f&)wl~|=;!LuotPrCcFI$l3dJ3_xcz$?x5 z+}$6;bVHxMTIQ_+q?3YIz19DE3=OR4DM0MG;(ul;544SI0G#=O@Q3-tfx^rbz*Hn4 z-e5kwpd;ZYh*ETa%>?8{?}435V_YQoOkO3ZJ5P-JH3H+!z^4wp<8lQYE%Tpe)Bb-r zfmX8d_}NHN+Q(sWtY4(>L6(1=x;%NUO<90`b-cLg(>$hAa`>N Date: Tue, 24 Mar 2020 14:16:57 +0100 Subject: [PATCH 082/145] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index b037d66..1877887 100644 --- a/README.MD +++ b/README.MD @@ -1,6 +1,6 @@ ![Logo](PSIGEL_1280_320.png) -**PSIGEL** is a module to interact with the IGEL UMS via API and IGEL OS Devices via SSH. +**PSIGEL** is a module to interact with the IGEL UMS via API. Currently the module only supports PowerShell version **5.1** . From 4d4883c9fddbf3a7e13f0cca9dbc2c42acdcac93 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 24 Mar 2020 14:17:00 +0100 Subject: [PATCH 083/145] Update Test.ps1 --- Scripts/Test.ps1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index cbe5f73..5b25e3b 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -9,14 +9,22 @@ $PSDefaultParameterValues = @{ #'*-UMS*:SecurityProtocol' = 'Tls' } -#<# $WebSession = New-UMSAPICookie + + +$WebSession.Cookies.GetCookies('https://igelrmserver').Name + + + +<# $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = $WebSession } #> +<# + $NewParams = @{ Mac = '0A00000000AA' Name = 'NewDevice01' @@ -30,7 +38,6 @@ $UpdateParams = @{ Name = 'UpdatedDevice01' } -#<# $Result = @( $null = [pscustomobject]$NewParams | New-UMSDevice | Tee-Object -Variable 'NewUMSDevice' | From 334a90bf047caa21c4ecb6c75e5dc457bb667c85 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 24 Mar 2020 14:17:04 +0100 Subject: [PATCH 084/145] Update Config.psd1 --- Tests/Config.psd1 | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index 580b0d2..cec2185 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -25,28 +25,12 @@ Tests Config PrivateUnitTests = 'New-UMSFilterString' } # New-UMSAPICookie - <# @{ All = 'New-UMSAPICookie' ParameterSets = @{ - Default = @{ - Expected = @{ - Headers = @{ } - Cookies = 'System.Net.CookieContainer' - UseDefaultCredentials = 'False' - Credentials = '' - Certificates = '' - UserAgent = 'Mozilla / 5.0 (Windows NT; Windows NT 10.0; de-DE) WindowsPowerShell / 5.1.18362.628' - Proxy = - MaximumRedirection = -1 - } - Options = @{ - ExcludedPaths = '' - } - } + Default = @{ } } } - #> # Get-UMSStatus @{ All = 'Get-UMSStatus' From c6adb878526694e4846b0701c6228aa836f9cd63 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 24 Mar 2020 14:17:11 +0100 Subject: [PATCH 085/145] Update Invoke-UMSRestMethodWebSession.Tests.ps1 --- Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 index 3a2298b..522c296 100644 --- a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 +++ b/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 @@ -90,22 +90,19 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } } - - <# Context "Mock an exception" { - Mock 'Invoke-RestMethod' { + Mock 'Invoke-RestMethod' -Skip { [System.Net.WebException]::new('400') | Add-Member -NotePropertyName Response -PassThru -Force -NotePropertyValue ( [PSCustomObject]@{ StatusCode = [System.Net.HttpStatusCode]::BadRequest } - ) + ) # work in progress } - It Invoke-UMSRestMethodWebSession' should throw' { + It Invoke-UMSRestMethodWebSession' should throw' -Skip { { Invoke-UMSRestMethodWebSession } | Should Throw 'some error' - } + } # makes no sense without above } - #> } } From 01aecbb05d4c292369ed1e415f015daaf04b021f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 24 Mar 2020 14:17:17 +0100 Subject: [PATCH 086/145] Update New-UMSAPICookie.Tests.ps1 --- Tests/New-UMSAPICookie.Tests.ps1 | 90 ++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index 9e6a0e8..32cdfa1 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -27,15 +27,22 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { InModuleScope $Script:ModuleName { + + $User = "User" + $PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force $PSDefaultParameterValues = @{ - '*:Credential' = New-MockObject -Type 'System.Management.Automation.PSCredential' + '*:Credential' = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PassWord '*:Computername' = 'igelrmserver.acme.org' } Context "General Execution" { Mock 'Invoke-RestMethod' { - [pscustomobject]@{ } + ( + [pscustomobject]@{ + message = 'JSESSIONID=3FB2F3F6A089FE9029DFD6DAFEF146DC' + } + ) } It "New-UMSAPICookie" { @@ -47,11 +54,10 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } } - <# Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-RestMethod' { ( [pscustomobject]@{ message = 'JSESSIONID=3FB2F3F6A089FE9029DFD6DAFEF146DC' @@ -61,70 +67,61 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = New-UMSAPICookie - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-RestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-RestMethod' Times = 1 Exactly = $true } Assert-MockCalled @AMCParams } - It 'Result should have type pscustomobject' { - $Result | Should -HaveType ([pscustomobject]) + It 'Result should have type Microsoft.Powershell.Commands.Webrequestsession' { + $Result | Should -HaveType ([Microsoft.Powershell.Commands.Webrequestsession]) } It 'Result should have 1 element' { @($Result).Count | Should BeExactly 1 } - It 'Result[0] should have type [pscustomobject]' { - $Result[0] | Should -HaveType [pscustomobject] + It 'Result[0].Cookies should have type [System.Net.CookieContainer]' { + $Result[0].Cookies | Should -HaveType [System.Net.CookieContainer] } - It 'Result[0].Id should be exactly 2' { - $Result[0].Id | Should BeExactly 2 + It 'Result[0].Cookies.Count should be exactly 1' { + $Result[0].Cookies.Count | Should BeExactly 1 } - It 'Result[0].Id should have type [Int]' { - $Result[0].Id | Should -HaveType [Int] - } - - It "Result[0].Message should be exactly '1 asssignments successfully assigned.'" { - $Result[0].Message | Should BeExactly '1 asssignments successfully assigned.' - } } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' {throw 'Error'} - it 'should throw Error' { - { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | should throw 'Error' - } + Mock 'Invoke-RestMethod' { throw 'Error' } - It 'Result should be null or empty' { - $Result | Should BeNullOrEmpty - } + It 'should throw Error' -Skip { + { 'New-UMSAPICookie -ErrorAction Stop' } | Should throw 'Error' + } # cant get to throw + + It 'Result should be null or empty' -Skip { + New-UMSAPICookie | Should BeNullOrEmpty + } # only useful with above working } - #> + } } -<# Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { - $UMS = Get-Content -Raw -Path ('{0}\Tests\UMS.json' -f $Script:ProjectRoot) | - ConvertFrom-Json - $CredPath = $UMS.CredPath - $Password = Get-Content $CredPath | ConvertTo-SecureString - $Credential = New-Object System.Management.Automation.PSCredential($UMS.User, $Password) + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential - '*-UMS*:Computername' = $UMS.Computername - '*-UMS*:SecurityProtocol' = $UMS.SecurityProtocol + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol } - Context "ParameterSetName All" { + Context "ParameterSetName Default" { It "doesn't throw" { { $Script:Result = New-UMSAPICookie } | Should Not Throw @@ -141,7 +138,22 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { It "Result.GetType().Name should be exactly WebRequestSession" { $Result.GetType().Name | Should -BeExactly 'WebRequestSession' } - } -} -#> \ No newline at end of file + It 'Result[0].Cookies should have type [System.Net.CookieContainer]' { + $Result[0].Cookies | Should -HaveType [System.Net.CookieContainer] + } + + It 'Result[0].Cookies.Count should be exactly 1' { + $Result[0].Cookies.Count | Should BeExactly 1 + } + + It "Result[0].Cookies.GetCookies('https://{0}' -f $($Cfg.Computername)).Name should have type [String]" { + $Result[0].Cookies.GetCookies('https://{0}' -f $($Cfg.Computername)).Name | Should -HaveType [String] + } + + It "Result[0].Cookies.GetCookies('https://{0}' -f $($Cfg.Computername)).Name should be exactly JSESSIONID" { + $Result[0].Cookies.GetCookies('https://{0}' -f $($Cfg.Computername)).Name | Should BeExactly 'JSESSIONID' + } + + } +} \ No newline at end of file From ce20ef49ac9695e2b5c9b4a4a8d3f5f3e3e7e947 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 24 Mar 2020 14:17:25 +0100 Subject: [PATCH 087/145] Create Get-UMSPropertyCast.ps1 --- PSIGEL/Private/Get-UMSPropertyCast.ps1 | 93 ++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 PSIGEL/Private/Get-UMSPropertyCast.ps1 diff --git a/PSIGEL/Private/Get-UMSPropertyCast.ps1 b/PSIGEL/Private/Get-UMSPropertyCast.ps1 new file mode 100644 index 0000000..b8e12f6 --- /dev/null +++ b/PSIGEL/Private/Get-UMSPropertyCast.ps1 @@ -0,0 +1,93 @@ +function Get-UMSPropertyCast +{ + <# + .EXAMPLE + Get-UMSPropertyCast -APIObjectColl $APIObjectColl -CastedPropertyColl $CastedPropertyColl + + #> + + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + $APIObjectColl, + + [Parameter(Mandatory)] + $PropertyColl + ) + + begin + { + } + process + { + $Result = foreach ($APIObject in $APIObjectColl) + { + $CastedPropertyColl = @{ } + foreach ($StringProperty in $PropertyColl.String) + { + $Name = $StringProperty + if ($APIObject.($StringProperty)) + { + $Value = [String]$APIObject.($StringProperty) + $CastedPropertyColl.Add($Name, $Value) + } + } + foreach ($IntProperty in $PropertyColl.Int) + { + $Name = $IntProperty + if ($APIObject.($IntProperty)) + { + $Value = [Int]$APIObject.($IntProperty) + $CastedPropertyColl.Add($Name, $Value) + } + } + foreach ($BoolProperty in $PropertyColl.Bool) + { + $Name = $BoolProperty + $Value = [System.Convert]::ToBoolean($APIObject.($BoolProperty)) + $CastedPropertyColl.Add($Name, $Value) + } + foreach ($DatetimeProperty in $PropertyColl.Datetime) + { + $Name = $DatetimeProperty + if ($APIObject.($DatetimeProperty)) + { + $Value = [System.Convert]::ToDateTime($APIObject.($DatetimeProperty)) + $CastedPropertyColl.Add($Name, $Value) + } + } + foreach ($ArrayProperty in $PropertyColl.Array) + { + $Name = $ArrayProperty + if ($APIObject.($ArrayProperty)) + { + $Value = [array]$APIObject.($ArrayProperty) + $CastedPropertyColl.Add($Name, $Value) + } + } + foreach ($XmlProperty in $PropertyColl.Xml) + { + $Name = $XmlProperty + if ($APIObject.($XmlProperty)) + { + $Value = [xml]$APIObject.($XmlProperty) + $CastedPropertyColl.Add($Name, $Value) + } + } + foreach ($ObjectProperty in $PropertyColl.Object) + { + $Name = $ObjectProperty + if ($APIObject.($ObjectProperty)) + { + $Value = [pscustomobject]$APIObject.($ObjectProperty) + $CastedPropertyColl.Add($Name, $Value) + } + } + New-Object psobject -Property $CastedPropertyColl + } + $Result + } + end + { + } +} \ No newline at end of file From dd5ca4374ea2b30a9263a57c17c1529f3aa58c60 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 16 Apr 2020 15:03:42 +0200 Subject: [PATCH 088/145] deleted Get-UMSPropertyCast.ps1 --- PSIGEL/Private/Get-UMSPropertyCast.ps1 | 93 -------------------------- 1 file changed, 93 deletions(-) delete mode 100644 PSIGEL/Private/Get-UMSPropertyCast.ps1 diff --git a/PSIGEL/Private/Get-UMSPropertyCast.ps1 b/PSIGEL/Private/Get-UMSPropertyCast.ps1 deleted file mode 100644 index b8e12f6..0000000 --- a/PSIGEL/Private/Get-UMSPropertyCast.ps1 +++ /dev/null @@ -1,93 +0,0 @@ -function Get-UMSPropertyCast -{ - <# - .EXAMPLE - Get-UMSPropertyCast -APIObjectColl $APIObjectColl -CastedPropertyColl $CastedPropertyColl - - #> - - [CmdletBinding()] - param ( - [Parameter(Mandatory)] - $APIObjectColl, - - [Parameter(Mandatory)] - $PropertyColl - ) - - begin - { - } - process - { - $Result = foreach ($APIObject in $APIObjectColl) - { - $CastedPropertyColl = @{ } - foreach ($StringProperty in $PropertyColl.String) - { - $Name = $StringProperty - if ($APIObject.($StringProperty)) - { - $Value = [String]$APIObject.($StringProperty) - $CastedPropertyColl.Add($Name, $Value) - } - } - foreach ($IntProperty in $PropertyColl.Int) - { - $Name = $IntProperty - if ($APIObject.($IntProperty)) - { - $Value = [Int]$APIObject.($IntProperty) - $CastedPropertyColl.Add($Name, $Value) - } - } - foreach ($BoolProperty in $PropertyColl.Bool) - { - $Name = $BoolProperty - $Value = [System.Convert]::ToBoolean($APIObject.($BoolProperty)) - $CastedPropertyColl.Add($Name, $Value) - } - foreach ($DatetimeProperty in $PropertyColl.Datetime) - { - $Name = $DatetimeProperty - if ($APIObject.($DatetimeProperty)) - { - $Value = [System.Convert]::ToDateTime($APIObject.($DatetimeProperty)) - $CastedPropertyColl.Add($Name, $Value) - } - } - foreach ($ArrayProperty in $PropertyColl.Array) - { - $Name = $ArrayProperty - if ($APIObject.($ArrayProperty)) - { - $Value = [array]$APIObject.($ArrayProperty) - $CastedPropertyColl.Add($Name, $Value) - } - } - foreach ($XmlProperty in $PropertyColl.Xml) - { - $Name = $XmlProperty - if ($APIObject.($XmlProperty)) - { - $Value = [xml]$APIObject.($XmlProperty) - $CastedPropertyColl.Add($Name, $Value) - } - } - foreach ($ObjectProperty in $PropertyColl.Object) - { - $Name = $ObjectProperty - if ($APIObject.($ObjectProperty)) - { - $Value = [pscustomobject]$APIObject.($ObjectProperty) - $CastedPropertyColl.Add($Name, $Value) - } - } - New-Object psobject -Property $CastedPropertyColl - } - $Result - } - end - { - } -} \ No newline at end of file From 1f63fd0994ee24cee73ef36adbe1283a5c1cb723 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 16 Apr 2020 17:02:23 +0200 Subject: [PATCH 089/145] Update Test.ps1 --- Scripts/Test.ps1 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 5b25e3b..97f99a5 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -8,19 +8,14 @@ $PSDefaultParameterValues = @{ '*-UMS*:Confirm' = $False #'*-UMS*:SecurityProtocol' = 'Tls' } - -$WebSession = New-UMSAPICookie - - -$WebSession.Cookies.GetCookies('https://igelrmserver').Name - - - -<# $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession + '*-UMS*:WebSession' = New-UMSAPICookie } -#> + +$Result = '' +$Result = Get-UMSDeviceAssignment -Id 505 +$Result + <# From 0810a8deadeb6dc0f35757b28e829285fef81d47 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 16 Apr 2020 17:02:49 +0200 Subject: [PATCH 090/145] added PSCore Support --- .../Invoke-UMSRestMethodWebSession.ps1 | 22 ++++------ PSIGEL/Public/New-UMSAPICookie.ps1 | 40 +++++++++++++------ 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 b/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 index f4fdae5..94cedb7 100644 --- a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 +++ b/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 @@ -62,21 +62,15 @@ function Invoke-UMSRestMethodWebSession begin { - Add-Type -AssemblyName Microsoft.PowerShell.Commands.Utility - Add-Type -TypeDefinition @' - using System.Net; - using System.Security.Cryptography.X509Certificates; - public class TrustAllCertsPolicy : ICertificatePolicy { - public bool CheckValidationResult( - ServicePoint srvPoint, X509Certificate certificate, - WebRequest request, int certificateProblem) { - return true; - } - } -'@ - [Net.ServicePointManager]::CertificatePolicy = New-Object -TypeName TrustAllCertsPolicy - [Net.ServicePointManager]::SecurityProtocol = $SecurityProtocol -join ',' $null = $PSBoundParameters.Remove('SecurityProtocol') + switch ($PSEdition) + { + 'Core' + { + $PSBoundParameters.Add('SkipCertificateCheck', $true) + $PSBoundParameters.Add('SslProtocol', $SecurityProtocol) + } + } } process { diff --git a/PSIGEL/Public/New-UMSAPICookie.ps1 b/PSIGEL/Public/New-UMSAPICookie.ps1 index 529f735..20bce7c 100644 --- a/PSIGEL/Public/New-UMSAPICookie.ps1 +++ b/PSIGEL/Public/New-UMSAPICookie.ps1 @@ -27,20 +27,26 @@ Begin { - Add-Type -AssemblyName Microsoft.PowerShell.Commands.Utility - Add-Type -TypeDefinition @' - using System.Net; - using System.Security.Cryptography.X509Certificates; - public class TrustAllCertsPolicy : ICertificatePolicy { - public bool CheckValidationResult( - ServicePoint srvPoint, X509Certificate certificate, - WebRequest request, int certificateProblem) { - return true; - } - } + switch ($PSEdition) + { + 'Desktop' + { + Add-Type -AssemblyName Microsoft.PowerShell.Commands.Utility + Add-Type -TypeDefinition @' + using System.Net; + using System.Security.Cryptography.X509Certificates; + public class TrustAllCertsPolicy : ICertificatePolicy { + public bool CheckValidationResult( + ServicePoint srvPoint, X509Certificate certificate, + WebRequest request, int certificateProblem) { + return true; + } + } '@ - [Net.ServicePointManager]::CertificatePolicy = New-Object -TypeName TrustAllCertsPolicy - [Net.ServicePointManager]::SecurityProtocol = $SecurityProtocol -join ',' + [Net.ServicePointManager]::CertificatePolicy = New-Object -TypeName TrustAllCertsPolicy + [Net.ServicePointManager]::SecurityProtocol = $SecurityProtocol -join ',' + } + } } Process { @@ -61,6 +67,14 @@ ContentType = 'application/json' ErrorAction = 'Stop' } + switch ($PSEdition) + { + 'Core' + { + $Params.Add('SkipCertificateCheck', $true) + $Params.Add('SslProtocol', $SecurityProtocol) + } + } Try { From 163e26e0a26506238bf5c698114a39641993693f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 17 Apr 2020 11:12:45 +0200 Subject: [PATCH 091/145] added .gitattributes --- .gitattributes | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a62f23b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +#*.c text +#*.h text + +# Declare files that will always have CRLF line endings on checkout. +#*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary From 6ecf09da868a67407933f1daaf0c4ae7d3ac6885 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 17 Apr 2020 15:00:49 +0200 Subject: [PATCH 092/145] added PSCore Support --- .../Invoke-UMSRestMethodWebSession.ps1 | 84 +++++++++++++++---- 1 file changed, 66 insertions(+), 18 deletions(-) diff --git a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 b/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 index 94cedb7..527a442 100644 --- a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 +++ b/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 @@ -74,33 +74,81 @@ function Invoke-UMSRestMethodWebSession } process { - try - { - Invoke-RestMethod @PSBoundParameters -ErrorAction Stop - } - catch [System.Net.WebException] + switch ($PSEdition) { - switch ($($PSItem.Exception.Response.StatusCode.value__)) + 'Desktop' { - 400 - { - Write-Warning -Message ('Error executing IMI RestAPI request. Uri: {0} Method: {1}' -f $Uri, $Method) - } - 401 + try { - Write-Warning -Message ('Error logging in, it seems as you have entered invalid credentials. Uri: {0} Method: {1}' -f $Uri, $Method) + Invoke-RestMethod @PSBoundParameters -ErrorAction Stop } - 403 + catch [System.Net.WebException] { - Write-Warning -Message ('Error logging in, it seems as you have not subscripted this version of IMI. Uri: {0} Method: {1}' -f $Uri, $Method) + switch ($($PSItem.Exception.Response.StatusCode.value__)) + { + 400 + { + Write-Warning -Message ('Bad Request: The request does not match the API, e.g. it uses the wrong HTTP method. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 401 + { + Write-Warning -Message ('Unauthorized: The client has not logged in or has sent the wrong credentials. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 404 + { + Write-Warning -Message ('Not Found: The endpoint does not exist, it may be misspelled. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 415 + { + Write-Warning -Message ('Unsupported Media Type: The body content, e.g. JSON, does not match the Content-Type header or is not well-formed. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 500 + { + Write-Warning -Message ('Internal Server Error: The server has encountered an error, check the server logfiles catalina.log and stderr. Uri: {0} Method: {1}' -f $Uri, $Method) + } + default + { + Write-Warning -Message ('Some error occured see HTTP status code {0} for further details. Uri: {1} Method: {2}' -f $PSItem.Exception.Response.StatusCode, $Uri, $Method) + } + } + } - 415 + } + 'Core' + { + try { - Write-Warning -Message ('Unsupported Media Type. Uri: {0} Method: {1}' -f $Uri, $Method) + Invoke-RestMethod @PSBoundParameters -ErrorAction Stop } - default + catch [Microsoft.PowerShell.Commands.HttpResponseException] { - Write-Warning -Message ('Some error occured see HTTP status code for further details. Uri: {0} Method: {1}' -f $Uri, $Method) + switch ($($PSItem.Exception.Response.StatusCode.value__)) + { + 400 + { + Write-Warning -Message ('Bad Request: The request does not match the API, e.g. it uses the wrong HTTP method. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 401 + { + Write-Warning -Message ('Unauthorized: The client has not logged in or has sent the wrong credentials. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 404 + { + Write-Warning -Message ('Not Found: The endpoint does not exist, it may be misspelled. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 415 + { + Write-Warning -Message ('Unsupported Media Type: The body content, e.g. JSON, does not match the Content-Type header or is not well-formed. Uri: {0} Method: {1}' -f $Uri, $Method) + } + 500 + { + Write-Warning -Message ('Internal Server Error: The server has encountered an error, check the server logfiles catalina.log and stderr. Uri: {0} Method: {1}' -f $Uri, $Method) + } + default + { + Write-Warning -Message ('Some error occured see HTTP status code {0} for further details. Uri: {1} Method: {2}' -f $PSItem.Exception.Response.StatusCode, $Uri, $Method) + } + } } } } From a668e2fef60cab6cf41959c937b0439ac85478b1 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 17 Apr 2020 15:00:52 +0200 Subject: [PATCH 093/145] Update Test.ps1 --- Scripts/Test.ps1 | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 97f99a5..42abb21 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -1,19 +1,35 @@ -Import-Module C:\GitHub\PSIGEL\PSIGEL\PSIGEL.psd1 -Force -$UMSCredPath = 'C:\Credentials\UmsRmdb.cred' +$DSC = [IO.Path]::DirectorySeparatorChar +$PSIGELPath = 'GitHub{0}PSIGEL{0}PSIGEL{0}PSIGEL.psd1' -f $DSC $PSDefaultParameterValues = @{ - 'New-UMSAPICookie:Credential' = Import-Clixml -Path $UMSCredPath - '*-UMS*:Computername' = 'igelrmserver' - '*-UMS*:TCPPort' = 9443 - '*-UMS*:Confirm' = $False + '*-UMS*:Computername' = 'igelrmserver' + '*-UMS*:TCPPort' = 9443 + '*-UMS*:Confirm' = $False #'*-UMS*:SecurityProtocol' = 'Tls' } + +if (($PSEdition -eq 'Core' -and $IsWindows) -or ($PSEdition -eq 'Desktop' -and ($PSVersionTable.PSVersion.Major -eq 5 -and $PSVersionTable.PSVersion.Minor -eq 1))) +{ + # PS7 on Windows or Windows PowerShell 5.1 + Import-Module -FullyQualifiedName ('C:\{0}' -f $PSIGELPath) -Force + $PSDefaultParameterValues.Add('New-UMSAPICookie:Credential', (Import-Clixml -Path 'C:\Credentials\UmsRmdb.cred')) +} +elseif ($PSEdition -eq 'core' -and (-Not $IsWindows) ) +{ + # PS7 on Linux OR MacOS + Import-Module -FullyQualifiedName ('/mnt/c/{0}' -f $PSIGELPath) -Force + $Credential = Get-Credential + $PSDefaultParameterValues.Add('New-UMSAPICookie:Credential', $Credential) +} + $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = New-UMSAPICookie } $Result = '' -$Result = Get-UMSDeviceAssignment -Id 505 +#$Result = Get-UMSDeviceAssignment -Id 505 +#$Result = Get-UMSDevice +$Result = Get-UMSFirmware $Result From 01a1bec822ef3da1d0e572b02808c9370adef244 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 13:47:57 +0200 Subject: [PATCH 094/145] Update Test.ps1 --- Scripts/Test.ps1 | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 42abb21..5249188 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -18,19 +18,25 @@ elseif ($PSEdition -eq 'core' -and (-Not $IsWindows) ) { # PS7 on Linux OR MacOS Import-Module -FullyQualifiedName ('/mnt/c/{0}' -f $PSIGELPath) -Force - $Credential = Get-Credential - $PSDefaultParameterValues.Add('New-UMSAPICookie:Credential', $Credential) + # Dont use the following method in production, since on linux the clixml file is not encrypted + $PSDefaultParameterValues.Add('New-UMSAPICookie:Credential', (Import-Clixml -Path '/mnt/c/Credentials/UmsRmdbWsl.cred')) } -$PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = New-UMSAPICookie -} +$WebSession = New-UMSAPICookie -$Result = '' -#$Result = Get-UMSDeviceAssignment -Id 505 -#$Result = Get-UMSDevice -$Result = Get-UMSFirmware -$Result +if ($WebSession) +{ + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + #<# + $Result = '' + #$Result = Get-UMSDeviceAssignment -Id 505 + #$Result = Get-UMSDevice + $Result = Get-UMSFirmware + $Result +} +#> From d0aff36f43ab4d0515e90fe5fcbf38c31527101a Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 13:48:28 +0200 Subject: [PATCH 095/145] Update Invoke-UMSRestMethodWebSession.ps1 --- .../Invoke-UMSRestMethodWebSession.ps1 | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 b/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 index 527a442..3c263ce 100644 --- a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 +++ b/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 @@ -32,29 +32,38 @@ function Invoke-UMSRestMethodWebSession #> - [CmdletBinding()] + [CmdletBinding(DefaultParameterSetName = 'Login')] param ( - [Parameter(Mandatory)] + [Parameter(Mandatory, ParameterSetName = 'Function')] $WebSession, - [Parameter(Mandatory)] + [Parameter(Mandatory, ParameterSetName = 'Function')] + [Parameter(Mandatory, ParameterSetName = 'Login')] [ValidateSet('Tls12', 'Tls11', 'Tls', 'Ssl3')] [String[]] $SecurityProtocol, - [Parameter(Mandatory)] + [Parameter(Mandatory, ParameterSetName = 'Function')] + [Parameter(Mandatory, ParameterSetName = 'Login')] [String] $Uri, + [Parameter(ParameterSetName = 'Function')] + [Parameter(ParameterSetName = 'Login')] [String] $Body, + [Parameter(ParameterSetName = 'Function')] + [Parameter(ParameterSetName = 'Login')] [String] $ContentType, + [Parameter(ParameterSetName = 'Function')] + [Parameter(Mandatory, ParameterSetName = 'Login')] $Headers, - [Parameter(Mandatory)] + [Parameter(Mandatory, ParameterSetName = 'Function')] + [Parameter(Mandatory, ParameterSetName = 'Login')] [ValidateSet('Get', 'Post', 'Put', 'Delete')] [String] $Method @@ -62,25 +71,18 @@ function Invoke-UMSRestMethodWebSession begin { - $null = $PSBoundParameters.Remove('SecurityProtocol') - switch ($PSEdition) - { - 'Core' - { - $PSBoundParameters.Add('SkipCertificateCheck', $true) - $PSBoundParameters.Add('SslProtocol', $SecurityProtocol) - } - } } process { - switch ($PSEdition) + $null = $PSBoundParameters.Remove('SecurityProtocol') + $null = $PSBoundParameters.Add('ErrorAction', 'Stop') + Switch ($PSEdition) { 'Desktop' { try { - Invoke-RestMethod @PSBoundParameters -ErrorAction Stop + Invoke-RestMethod @PSBoundParameters } catch [System.Net.WebException] { @@ -111,14 +113,16 @@ function Invoke-UMSRestMethodWebSession Write-Warning -Message ('Some error occured see HTTP status code {0} for further details. Uri: {1} Method: {2}' -f $PSItem.Exception.Response.StatusCode, $Uri, $Method) } } - + } } 'Core' { try { - Invoke-RestMethod @PSBoundParameters -ErrorAction Stop + $null = $PSBoundParameters.Add('SslProtocol', $SecurityProtocol) + $null = $PSBoundParameters.Add('SkipCertificateCheck', $true) + Invoke-RestMethod @PSBoundParameters } catch [Microsoft.PowerShell.Commands.HttpResponseException] { From a00951f338c26e75d30d4df121d38bab13f41c05 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 13:48:31 +0200 Subject: [PATCH 096/145] Update New-UMSAPICookie.ps1 --- PSIGEL/Public/New-UMSAPICookie.ps1 | 67 ++++++++++++------------------ 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/PSIGEL/Public/New-UMSAPICookie.ps1 b/PSIGEL/Public/New-UMSAPICookie.ps1 index 20bce7c..753435a 100644 --- a/PSIGEL/Public/New-UMSAPICookie.ps1 +++ b/PSIGEL/Public/New-UMSAPICookie.ps1 @@ -27,6 +27,23 @@ Begin { + } + Process + { + $Username = $Credential.Username + $Password = $Credential.GetNetworkCredential().password + $BUArray = @($Computername, $TCPPort, $ApiVersion) + $BaseURL = 'https://{0}:{1}/umsapi/v{2}/' -f $BUArray + $Header = @{ + 'Authorization' = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($Username + ':' + $Password)) + } + $Params = @{ + Uri = '{0}login' -f $BaseURL + Headers = $Header + Method = 'Post' + ContentType = 'application/json' + SecurityProtocol = $SecurityProtocol + } switch ($PSEdition) { 'Desktop' @@ -47,55 +64,23 @@ [Net.ServicePointManager]::SecurityProtocol = $SecurityProtocol -join ',' } } - } - Process - { - $Username = $Credential.Username - $Password = $Credential.GetNetworkCredential().password - - - $BUArray = @($Computername, $TCPPort, $ApiVersion) - $BaseURL = 'https://{0}:{1}/umsapi/v{2}/' -f $BUArray - $Header = @{ - 'Authorization' = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($Username + ':' + $Password)) - } - - $Params = @{ - Uri = '{0}login' -f $BaseURL - Headers = $Header - Method = 'Post' - ContentType = 'application/json' - ErrorAction = 'Stop' - } - switch ($PSEdition) - { - 'Core' - { - $Params.Add('SkipCertificateCheck', $true) - $Params.Add('SslProtocol', $SecurityProtocol) - } - } + $SessionResponse = Invoke-UMSRestMethodWebsession @Params - Try + if ($SessionResponse) { - $SessionResponse = Invoke-RestMethod @Params $Cookie = New-Object -TypeName System.Net.Cookie $Cookie.Name = ($SessionResponse.Message).Split('=')[0] $Cookie.Path = '/' $Cookie.Value = ($SessionResponse.Message).Split('=')[1] $Cookie.Domain = $Computername - } - Catch - { - $_.Exception.Message - } - if ($PSCmdlet.ShouldProcess($Computername)) - { - $WebSession = New-Object -TypeName Microsoft.Powershell.Commands.Webrequestsession - $WebSession.Cookies.Add($Cookie) - $Result = $WebSession - $Result + if ($PSCmdlet.ShouldProcess($Computername)) + { + $WebSession = New-Object -TypeName Microsoft.Powershell.Commands.Webrequestsession + $WebSession.Cookies.Add($Cookie) + $Result = $WebSession + $Result + } } } End From 7e4aec9fd08c0fa74487673cf3848f4df7bac942 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 14:49:30 +0200 Subject: [PATCH 097/145] added Remove-UMSAPICookie --- PSIGEL/PSIGEL.psd1 | 1 + PSIGEL/Public/Remove-UMSAPICookie.ps1 | 63 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 PSIGEL/Public/Remove-UMSAPICookie.ps1 diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 1639df1..f04f462 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -88,6 +88,7 @@ 'New-UMSDeviceDirectory' 'New-UMSProfileAssignment' 'New-UMSProfileDirectory' + 'Remove-UMSAPICookie' 'Remove-UMSDevice' 'Remove-UMSDeviceDirectory' 'Remove-UMSProfile' diff --git a/PSIGEL/Public/Remove-UMSAPICookie.ps1 b/PSIGEL/Public/Remove-UMSAPICookie.ps1 new file mode 100644 index 0000000..d25affb --- /dev/null +++ b/PSIGEL/Public/Remove-UMSAPICookie.ps1 @@ -0,0 +1,63 @@ +function Remove-UMSAPICookie +{ + [cmdletbinding(SupportsShouldProcess, ConfirmImpact = 'Low')] + param + ( + [Parameter(Mandatory)] + [String] + $Computername, + + [ValidateRange(0, 65535)] + [Int] + $TCPPort = 8443, + + [ValidateSet(3)] + [Int] + $ApiVersion = 3, + + [ValidateSet('Tls12', 'Tls11', 'Tls', 'Ssl3')] + [String[]] + $SecurityProtocol = 'Tls12', + + [Parameter(Mandatory)] + $WebSession + ) + + Begin + { + } + Process + { + $BUArray = @($Computername, $TCPPort, $ApiVersion) + $BaseURL = 'https://{0}:{1}/umsapi/v{2}/' -f $BUArray + $Cookie = $WebSession.Cookies.GetCookies('https://{0}' -f $Computername) + $Header = @{ + 'Cookie' = ('{0}={1}' -f $Cookie.Name, $Cookie.Value) + } + $Params = @{ + Uri = '{0}logout' -f $BaseURL + WebSession = $WebSession + Headers = $Header + Method = 'Post' + ContentType = 'application/json' + SecurityProtocol = $SecurityProtocol + } + $Result = (Invoke-UMSRestMethodWebsession @Params).Message + + switch ($Result) + { + $null + { + Write-Verbose $Cookie.Value + } + Default + { + Write-Warning ('Could not remove Cookie {0}={1}!' -f $Cookie.Name, $Cookie.Value) + } + } + + } + End + { + } +} \ No newline at end of file From ae986f3de2e30d9ef5cfa5fdbbf29ad910848ac7 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 14:49:32 +0200 Subject: [PATCH 098/145] Update Test.ps1 --- Scripts/Test.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 5249188..ae174d8 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -35,6 +35,9 @@ if ($WebSession) #$Result = Get-UMSDevice $Result = Get-UMSFirmware $Result + + Remove-UMSAPICookie #-Verbose + } #> From a6d9faadb12d238debf7faf7f82ab8932a63397b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 14:59:28 +0200 Subject: [PATCH 099/145] Update Test.ps1 --- Scripts/Test.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index ae174d8..f044a25 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -31,9 +31,9 @@ if ($WebSession) } #<# $Result = '' - #$Result = Get-UMSDeviceAssignment -Id 505 + $Result = Get-UMSDeviceAssignment -Id 505 #$Result = Get-UMSDevice - $Result = Get-UMSFirmware + #$Result = Get-UMSFirmware $Result Remove-UMSAPICookie #-Verbose From e223307954317a3ccd8ec2b7de5fa5a73f409c38 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 14:59:43 +0200 Subject: [PATCH 100/145] Update Remove-UMSAPICookie.ps1 added ShouldProcess --- PSIGEL/Public/Remove-UMSAPICookie.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PSIGEL/Public/Remove-UMSAPICookie.ps1 b/PSIGEL/Public/Remove-UMSAPICookie.ps1 index d25affb..85feb58 100644 --- a/PSIGEL/Public/Remove-UMSAPICookie.ps1 +++ b/PSIGEL/Public/Remove-UMSAPICookie.ps1 @@ -42,8 +42,10 @@ function Remove-UMSAPICookie ContentType = 'application/json' SecurityProtocol = $SecurityProtocol } - $Result = (Invoke-UMSRestMethodWebsession @Params).Message - + if ($PSCmdlet.ShouldProcess($Cookie.Value)) + { + $Result = (Invoke-UMSRestMethodWebsession @Params).Message + } switch ($Result) { $null From e43ea150eb2fe30a241b078a080b1580b5c97083 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 20 Apr 2020 15:08:02 +0200 Subject: [PATCH 101/145] Update PSIGEL.psd1 --- PSIGEL/PSIGEL.psd1 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index f04f462..d8e22a6 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSIGEL.psm1' # Die Versionsnummer dieses Moduls - ModuleVersion = '0.9.0' + ModuleVersion = '0.10.0' # Unterstuetzte PSEditions # CompatiblePSEditions = @() @@ -29,7 +29,7 @@ Copyright = '(c) 2018 Falk Heiland. Alle Rechte vorbehalten.' # Beschreibung der von diesem Modul bereitgestellten Funktionen - Description = 'Tools for use with device products of IGEL Technology GmbH' + Description = 'API functions for use with UMS of IGEL TECHNOLOGY' # Die fuer dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls PowerShellVersion = '5.1' @@ -129,7 +129,7 @@ PSData = @{ # 'Tags' wurde auf das Modul angewendet und unterstuetzt die Modulermittlung in Onlinekatalogen. - Tags = @('IGEL') + Tags = @('IGEL', 'UMS', 'IMI') # Eine URL zur Lizenz fuer dieses Modul. LicenseUri = 'https://github.com/IGEL-Community/PSIGEL/blob/master/LICENSE' @@ -142,12 +142,15 @@ # 'ReleaseNotes' des Moduls ReleaseNotes = @' -0.9.1 2019xxxx -* set minimum Powershell Requirement for the module to 5.1 (Core not supported) +0.10.0 20200420 +* added cross platform support +* added Remove-UMSAPICookie +* set minimum Powershell Requirement for the module to 5.1 * added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter detail -* support for Datatype Version in Get-OSFirmware, Get-UMSFirmware, Get-UMSStatus +* support for Datatype Version in Get-UMSFirmware, Get-UMSStatus * added Get-UMSDirectoryRecursive * edited SerialNumber Length to 18 +* remove *-OS* functions '@ } # Ende der PSData-Hashtabelle From 9577a2f22742962916b3b3feb2394c42b1e2f459 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 22 Apr 2020 09:36:36 +0200 Subject: [PATCH 102/145] renamed Invoke-UMSRestMethodWebSession to Invoke-UMSRestMethod --- ...ebSession.ps1 => Invoke-UMSRestMethod.ps1} | 6 +-- PSIGEL/Public/Get-UMSDevice.ps1 | 4 +- PSIGEL/Public/Get-UMSDeviceAssignment.ps1 | 4 +- PSIGEL/Public/Get-UMSDeviceDirectory.ps1 | 6 +-- .../Get-UMSDeviceDirectoryAssignment.ps1 | 4 +- PSIGEL/Public/Get-UMSFirmware.ps1 | 4 +- PSIGEL/Public/Get-UMSProfile.ps1 | 6 +-- PSIGEL/Public/Get-UMSProfileAssignment.ps1 | 4 +- PSIGEL/Public/Get-UMSProfileDirectory.ps1 | 6 +-- PSIGEL/Public/Get-UMSStatus.ps1 | 2 +- PSIGEL/Public/Move-UMSDevice.ps1 | 2 +- PSIGEL/Public/Move-UMSDeviceDirectory.ps1 | 4 +- PSIGEL/Public/Move-UMSProfile.ps1 | 2 +- PSIGEL/Public/Move-UMSProfileDirectory.ps1 | 4 +- PSIGEL/Public/New-UMSAPICookie.ps1 | 2 +- PSIGEL/Public/New-UMSDevice.ps1 | 6 +-- PSIGEL/Public/New-UMSDeviceDirectory.ps1 | 4 +- PSIGEL/Public/New-UMSProfileAssignment.ps1 | 4 +- PSIGEL/Public/New-UMSProfileDirectory.ps1 | 4 +- PSIGEL/Public/Remove-UMSAPICookie.ps1 | 2 +- PSIGEL/Public/Remove-UMSDevice.ps1 | 4 +- PSIGEL/Public/Remove-UMSDeviceDirectory.ps1 | 4 +- PSIGEL/Public/Remove-UMSProfile.ps1 | 4 +- PSIGEL/Public/Remove-UMSProfileAssignment.ps1 | 2 +- PSIGEL/Public/Remove-UMSProfileDirectory.ps1 | 4 +- PSIGEL/Public/Reset-UMSDevice.ps1 | 4 +- PSIGEL/Public/Restart-UMSDevice.ps1 | 4 +- PSIGEL/Public/Send-UMSDeviceSetting.ps1 | 4 +- PSIGEL/Public/Start-UMSDevice.ps1 | 4 +- PSIGEL/Public/Stop-UMSDevice.ps1 | 4 +- PSIGEL/Public/Update-UMSDevice.ps1 | 8 ++-- PSIGEL/Public/Update-UMSDeviceDirectory.ps1 | 4 +- PSIGEL/Public/Update-UMSProfile.ps1 | 4 +- PSIGEL/Public/Update-UMSProfileDirectory.ps1 | 4 +- Tests/Config.psd1 | 4 +- Tests/Get-UMSDevice.Tests.ps1 | 40 +++++++++---------- Tests/Get-UMSDeviceAssignment.Tests.ps1 | 10 ++--- Tests/Get-UMSDeviceDirectory.Tests.ps1 | 22 +++++----- ...Get-UMSDeviceDirectoryAssignment.Tests.ps1 | 10 ++--- Tests/Get-UMSFirmware.Tests.ps1 | 16 ++++---- Tests/Get-UMSProfile.Tests.ps1 | 16 ++++---- Tests/Get-UMSProfileAssignment.Tests.ps1 | 16 ++++---- Tests/Get-UMSProfileDirectory.Tests.ps1 | 22 +++++----- Tests/Get-UMSStatus.Tests.ps1 | 10 ++--- ...sts.ps1 => Invoke-UMSRestMethod.Tests.ps1} | 16 ++++---- Tests/Move-UMSDevice.Tests.ps1 | 16 ++++---- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 16 ++++---- Tests/Move-UMSProfile.Tests.ps1 | 16 ++++---- Tests/Move-UMSProfileDirectory.Tests.ps1 | 16 ++++---- Tests/New-UMSAPICookie.Tests.ps1 | 6 +-- Tests/New-UMSDevice.Tests.ps1 | 16 ++++---- Tests/New-UMSDeviceDirectory.Tests.ps1 | 16 ++++---- Tests/New-UMSProfileAssignment.Tests.ps1 | 22 +++++----- Tests/New-UMSProfileDirectory.Tests.ps1 | 16 ++++---- Tests/Pester.ps1 | 15 +++++-- Tests/Remove-UMSDevice.Tests.ps1 | 22 +++++----- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 16 ++++---- Tests/Remove-UMSProfile.Tests.ps1 | 16 ++++---- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 22 +++++----- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 16 ++++---- Tests/Reset-UMSDevice.Tests.ps1 | 16 ++++---- Tests/Restart-UMSDevice.Tests.ps1 | 16 ++++---- Tests/Send-UMSDeviceSetting.Tests.ps1 | 16 ++++---- Tests/Start-UMSDevice.Tests.ps1 | 16 ++++---- Tests/Stop-UMSDevice.Tests.ps1 | 16 ++++---- Tests/Update-UMSDevice.Tests.ps1 | 16 ++++---- Tests/Update-UMSDeviceDirectory.Tests.ps1 | 16 ++++---- Tests/Update-UMSProfile.Tests.ps1 | 16 ++++---- Tests/Update-UMSProfileDirectory.Tests.ps1 | 16 ++++---- 69 files changed, 360 insertions(+), 351 deletions(-) rename PSIGEL/Private/{Invoke-UMSRestMethodWebSession.ps1 => Invoke-UMSRestMethod.ps1} (97%) rename Tests/{Invoke-UMSRestMethodWebSession.Tests.ps1 => Invoke-UMSRestMethod.Tests.ps1} (85%) diff --git a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 b/PSIGEL/Private/Invoke-UMSRestMethod.ps1 similarity index 97% rename from PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 rename to PSIGEL/Private/Invoke-UMSRestMethod.ps1 index 3c263ce..bc2d40f 100644 --- a/PSIGEL/Private/Invoke-UMSRestMethodWebSession.ps1 +++ b/PSIGEL/Private/Invoke-UMSRestMethod.ps1 @@ -1,4 +1,4 @@ -function Invoke-UMSRestMethodWebSession +function Invoke-UMSRestMethod { <# .SYNOPSIS @@ -16,7 +16,7 @@ function Invoke-UMSRestMethodWebSession Headers = @{} SecurityProtocol = ($SecurityProtocol -join ',') } - Invoke-UMSRestMethodWebSession @Params + Invoke-UMSRestMethod @Params .EXAMPLE $Params = @{ @@ -28,7 +28,7 @@ function Invoke-UMSRestMethodWebSession Headers = @{} SecurityProtocol = ($SecurityProtocol -join ',') } - Invoke-UMSRestMethodWebSession @Params + Invoke-UMSRestMethod @Params #> diff --git a/PSIGEL/Public/Get-UMSDevice.ps1 b/PSIGEL/Public/Get-UMSDevice.ps1 index 9ae9e5f..193b2cc 100644 --- a/PSIGEL/Public/Get-UMSDevice.ps1 +++ b/PSIGEL/Public/Get-UMSDevice.ps1 @@ -50,12 +50,12 @@ 'All' { $Params.Add('Uri', ('{0}{1}' -f $BaseURL, $FilterString)) - $APIObjectColl = (Invoke-UMSRestMethodWebSession @Params).SyncRoot + $APIObjectColl = (Invoke-UMSRestMethod @Params).SyncRoot } 'Id' { $Params.Add('Uri', ('{0}/{1}{2}' -f $BaseURL, $Id, $FilterString)) - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } } diff --git a/PSIGEL/Public/Get-UMSDeviceAssignment.ps1 b/PSIGEL/Public/Get-UMSDeviceAssignment.ps1 index df55525..3272d98 100644 --- a/PSIGEL/Public/Get-UMSDeviceAssignment.ps1 +++ b/PSIGEL/Public/Get-UMSDeviceAssignment.ps1 @@ -39,10 +39,10 @@ Uri = '{0}/{1}/assignments/profiles' -f $BaseURL, $Id Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params $Result = foreach ($APIObject in $APIObjectColl) { $ProfileColl = foreach ($child in $APIObject) diff --git a/PSIGEL/Public/Get-UMSDeviceDirectory.ps1 b/PSIGEL/Public/Get-UMSDeviceDirectory.ps1 index 2ca08c9..1cb576b 100644 --- a/PSIGEL/Public/Get-UMSDeviceDirectory.ps1 +++ b/PSIGEL/Public/Get-UMSDeviceDirectory.ps1 @@ -46,7 +46,7 @@ WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } Switch ($PSCmdlet.ParameterSetName) @@ -54,12 +54,12 @@ 'All' { $Params.Add('Uri', ('{0}{1}' -f $BaseURL, $FilterString)) - $APIObjectColl = (Invoke-UMSRestMethodWebSession @Params).SyncRoot + $APIObjectColl = (Invoke-UMSRestMethod @Params).SyncRoot } 'Id' { $Params.Add('Uri', ('{0}/{1}{2}' -f $BaseURL, $Id, $FilterString)) - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } } $Result = foreach ($APIObject in $APIObjectColl) diff --git a/PSIGEL/Public/Get-UMSDeviceDirectoryAssignment.ps1 b/PSIGEL/Public/Get-UMSDeviceDirectoryAssignment.ps1 index 942cf2f..56e534b 100644 --- a/PSIGEL/Public/Get-UMSDeviceDirectoryAssignment.ps1 +++ b/PSIGEL/Public/Get-UMSDeviceDirectoryAssignment.ps1 @@ -39,10 +39,10 @@ function Get-UMSDeviceDirectoryAssignment Uri = ('{0}/{1}/assignments/profiles' -f $BaseURL, $Id) Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params $Result = foreach ($APIObject in $APIObjectColl) { $ProfileColl = foreach ($child in $APIObject) diff --git a/PSIGEL/Public/Get-UMSFirmware.ps1 b/PSIGEL/Public/Get-UMSFirmware.ps1 index 0b303a6..c339434 100644 --- a/PSIGEL/Public/Get-UMSFirmware.ps1 +++ b/PSIGEL/Public/Get-UMSFirmware.ps1 @@ -46,12 +46,12 @@ 'All' { $Params.Add('Uri', ('{0}' -f $BaseURL)) - $APIObjectColl = (Invoke-UMSRestMethodWebSession @Params).FwResource + $APIObjectColl = (Invoke-UMSRestMethod @Params).FwResource } 'Id' { $Params.Add('Uri', ('{0}/{1}' -f $BaseURL, $Id)) - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } } $Result = foreach ($APIObject in $APIObjectColl) diff --git a/PSIGEL/Public/Get-UMSProfile.ps1 b/PSIGEL/Public/Get-UMSProfile.ps1 index d98e661..1141040 100644 --- a/PSIGEL/Public/Get-UMSProfile.ps1 +++ b/PSIGEL/Public/Get-UMSProfile.ps1 @@ -38,7 +38,7 @@ WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } Switch ($PsCmdlet.ParameterSetName) @@ -46,12 +46,12 @@ 'All' { $Params.Add('Uri', ('{0}' -f $BaseURL)) - $APIObjectColl = (Invoke-UMSRestMethodWebSession @Params).SyncRoot + $APIObjectColl = (Invoke-UMSRestMethod @Params).SyncRoot } 'Id' { $Params.Add('Uri', ('{0}/{1}' -f $BaseURL, $Id)) - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } } $Result = foreach ($APIObject in $APIObjectColl) diff --git a/PSIGEL/Public/Get-UMSProfileAssignment.ps1 b/PSIGEL/Public/Get-UMSProfileAssignment.ps1 index 51507ff..25ef2df 100644 --- a/PSIGEL/Public/Get-UMSProfileAssignment.ps1 +++ b/PSIGEL/Public/Get-UMSProfileAssignment.ps1 @@ -41,7 +41,7 @@ WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } @@ -56,7 +56,7 @@ $Params.Add('Uri', ('{0}/{1}/assignments/tcdirectories' -f $BaseURL, $Id)) } } - $APIObjectColl = (Invoke-UMSRestMethodWebSession @Params).SyncRoot + $APIObjectColl = (Invoke-UMSRestMethod @Params).SyncRoot $Result = foreach ($APIObject in $APIObjectColl) { $ProfileColl = foreach ($child in $APIObject) diff --git a/PSIGEL/Public/Get-UMSProfileDirectory.ps1 b/PSIGEL/Public/Get-UMSProfileDirectory.ps1 index 4629822..e2d5730 100644 --- a/PSIGEL/Public/Get-UMSProfileDirectory.ps1 +++ b/PSIGEL/Public/Get-UMSProfileDirectory.ps1 @@ -46,7 +46,7 @@ function Get-UMSProfileDirectory WebSession = $WebSession Method = 'Get' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } Switch ($PSCmdlet.ParameterSetName) @@ -54,12 +54,12 @@ function Get-UMSProfileDirectory 'All' { $Params.Add('Uri', ('{0}{1}' -f $BaseURL, $FilterString)) - $APIObjectColl = (Invoke-UMSRestMethodWebSession @Params).SyncRoot + $APIObjectColl = (Invoke-UMSRestMethod @Params).SyncRoot } 'Id' { $Params.Add('Uri', ('{0}/{1}{2}' -f $BaseURL, $Id, $FilterString)) - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } } $Result = foreach ($APIObject in $APIObjectColl) diff --git a/PSIGEL/Public/Get-UMSStatus.ps1 b/PSIGEL/Public/Get-UMSStatus.ps1 index eb0a91a..1e84f3a 100644 --- a/PSIGEL/Public/Get-UMSStatus.ps1 +++ b/PSIGEL/Public/Get-UMSStatus.ps1 @@ -38,7 +38,7 @@ Uri = $BaseURL SecurityProtocol = ($SecurityProtocol -join ',') } - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Move-UMSDevice.ps1 b/PSIGEL/Public/Move-UMSDevice.ps1 index a179f9c..ec14d26 100644 --- a/PSIGEL/Public/Move-UMSDevice.ps1 +++ b/PSIGEL/Public/Move-UMSDevice.ps1 @@ -55,7 +55,7 @@ function Move-UMSDevice } if ($PSCmdlet.ShouldProcess(('Id: {0} to DestId: {1}' -f $Id, $DestId))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Move-UMSDeviceDirectory.ps1 b/PSIGEL/Public/Move-UMSDeviceDirectory.ps1 index eef592d..b3d7747 100644 --- a/PSIGEL/Public/Move-UMSDeviceDirectory.ps1 +++ b/PSIGEL/Public/Move-UMSDeviceDirectory.ps1 @@ -50,12 +50,12 @@ function Move-UMSDeviceDirectory Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0} to DestID: {1}' -f $Id, $DestId))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Move-UMSProfile.ps1 b/PSIGEL/Public/Move-UMSProfile.ps1 index 4545123..644a226 100644 --- a/PSIGEL/Public/Move-UMSProfile.ps1 +++ b/PSIGEL/Public/Move-UMSProfile.ps1 @@ -55,7 +55,7 @@ function Move-UMSProfile } if ($PSCmdlet.ShouldProcess(('Id: {0} to DestID: {1}' -f $Id, $DestId))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Move-UMSProfileDirectory.ps1 b/PSIGEL/Public/Move-UMSProfileDirectory.ps1 index 449a0d4..510cee2 100644 --- a/PSIGEL/Public/Move-UMSProfileDirectory.ps1 +++ b/PSIGEL/Public/Move-UMSProfileDirectory.ps1 @@ -50,12 +50,12 @@ function Move-UMSProfileDirectory Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0} to DestId: {1}' -f $Id, $DestId))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/New-UMSAPICookie.ps1 b/PSIGEL/Public/New-UMSAPICookie.ps1 index 753435a..0742616 100644 --- a/PSIGEL/Public/New-UMSAPICookie.ps1 +++ b/PSIGEL/Public/New-UMSAPICookie.ps1 @@ -64,7 +64,7 @@ [Net.ServicePointManager]::SecurityProtocol = $SecurityProtocol -join ',' } } - $SessionResponse = Invoke-UMSRestMethodWebsession @Params + $SessionResponse = Invoke-UMSRestMethod @Params if ($SessionResponse) { diff --git a/PSIGEL/Public/New-UMSDevice.ps1 b/PSIGEL/Public/New-UMSDevice.ps1 index dcf1c65..617d15d 100644 --- a/PSIGEL/Public/New-UMSDevice.ps1 +++ b/PSIGEL/Public/New-UMSDevice.ps1 @@ -53,7 +53,7 @@ $CostCenter, [Parameter(ValueFromPipelineByPropertyName)] - [ValidateScript( {$_ -match [IPAddress]$_})] + [ValidateScript( { $_ -match [IPAddress]$_ })] [String] $LastIP, @@ -102,12 +102,12 @@ Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('MAC: {0}' -f $Mac)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/New-UMSDeviceDirectory.ps1 b/PSIGEL/Public/New-UMSDeviceDirectory.ps1 index d0409e5..7ed907a 100644 --- a/PSIGEL/Public/New-UMSDeviceDirectory.ps1 +++ b/PSIGEL/Public/New-UMSDeviceDirectory.ps1 @@ -43,12 +43,12 @@ function New-UMSDeviceDirectory Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Name: {0}' -f $Name)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/New-UMSProfileAssignment.ps1 b/PSIGEL/Public/New-UMSProfileAssignment.ps1 index eaeab15..aa7da27 100644 --- a/PSIGEL/Public/New-UMSProfileAssignment.ps1 +++ b/PSIGEL/Public/New-UMSProfileAssignment.ps1 @@ -72,14 +72,14 @@ Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } $SPArray = @($Id, $ReceiverId, $ReceiverType) if ($PSCmdlet.ShouldProcess(('Id: {0}, ReceiverId: {1}, ReceiverType: {2}' -f $SPArray))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/New-UMSProfileDirectory.ps1 b/PSIGEL/Public/New-UMSProfileDirectory.ps1 index 37bc795..04d789f 100644 --- a/PSIGEL/Public/New-UMSProfileDirectory.ps1 +++ b/PSIGEL/Public/New-UMSProfileDirectory.ps1 @@ -43,12 +43,12 @@ function New-UMSProfileDirectory Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Name: {0}' -f $Name)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Remove-UMSAPICookie.ps1 b/PSIGEL/Public/Remove-UMSAPICookie.ps1 index 85feb58..3133599 100644 --- a/PSIGEL/Public/Remove-UMSAPICookie.ps1 +++ b/PSIGEL/Public/Remove-UMSAPICookie.ps1 @@ -44,7 +44,7 @@ function Remove-UMSAPICookie } if ($PSCmdlet.ShouldProcess($Cookie.Value)) { - $Result = (Invoke-UMSRestMethodWebsession @Params).Message + $Result = (Invoke-UMSRestMethod @Params).Message } switch ($Result) { diff --git a/PSIGEL/Public/Remove-UMSDevice.ps1 b/PSIGEL/Public/Remove-UMSDevice.ps1 index 438c9fe..e605ea4 100644 --- a/PSIGEL/Public/Remove-UMSDevice.ps1 +++ b/PSIGEL/Public/Remove-UMSDevice.ps1 @@ -42,7 +42,7 @@ WebSession = $WebSession Method = 'Delete' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } Switch ($PsCmdlet.ParameterSetName) @@ -58,7 +58,7 @@ } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $ID)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Remove-UMSDeviceDirectory.ps1 b/PSIGEL/Public/Remove-UMSDeviceDirectory.ps1 index 63931fb..1bf2bae 100644 --- a/PSIGEL/Public/Remove-UMSDeviceDirectory.ps1 +++ b/PSIGEL/Public/Remove-UMSDeviceDirectory.ps1 @@ -39,12 +39,12 @@ function Remove-UMSDeviceDirectory Uri = ('{0}/{1}' -f $BaseURL, $Id) Method = 'Delete' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Remove-UMSProfile.ps1 b/PSIGEL/Public/Remove-UMSProfile.ps1 index 75d0c14..23446bc 100644 --- a/PSIGEL/Public/Remove-UMSProfile.ps1 +++ b/PSIGEL/Public/Remove-UMSProfile.ps1 @@ -39,12 +39,12 @@ Uri = ('{0}/{1}' -f $BaseURL, $Id) Method = 'Delete' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 b/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 index 28977d7..c3fe505 100644 --- a/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 +++ b/PSIGEL/Public/Remove-UMSProfileAssignment.ps1 @@ -65,7 +65,7 @@ $SPArray = @($Id, $ReceiverId, $ReceiverType) if ($PSCmdlet.ShouldProcess(('Id: {0}, ReceiverID {1}, ReceiverType: {2}' -f $SPArray))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Remove-UMSProfileDirectory.ps1 b/PSIGEL/Public/Remove-UMSProfileDirectory.ps1 index 711a549..4ef92ee 100644 --- a/PSIGEL/Public/Remove-UMSProfileDirectory.ps1 +++ b/PSIGEL/Public/Remove-UMSProfileDirectory.ps1 @@ -39,12 +39,12 @@ function Remove-UMSProfileDirectory Uri = ('{0}/{1}' -f $BaseURL, $Id) Method = 'Delete' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Reset-UMSDevice.ps1 b/PSIGEL/Public/Reset-UMSDevice.ps1 index 9cd546b..53c3457 100644 --- a/PSIGEL/Public/Reset-UMSDevice.ps1 +++ b/PSIGEL/Public/Reset-UMSDevice.ps1 @@ -46,12 +46,12 @@ Body = $Body Method = 'Post' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Restart-UMSDevice.ps1 b/PSIGEL/Public/Restart-UMSDevice.ps1 index 154e87a..1f84618 100644 --- a/PSIGEL/Public/Restart-UMSDevice.ps1 +++ b/PSIGEL/Public/Restart-UMSDevice.ps1 @@ -46,12 +46,12 @@ Body = $Body Method = 'Post' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Send-UMSDeviceSetting.ps1 b/PSIGEL/Public/Send-UMSDeviceSetting.ps1 index 5cb485d..675f0de 100644 --- a/PSIGEL/Public/Send-UMSDeviceSetting.ps1 +++ b/PSIGEL/Public/Send-UMSDeviceSetting.ps1 @@ -46,12 +46,12 @@ Body = $Body Method = 'Post' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Start-UMSDevice.ps1 b/PSIGEL/Public/Start-UMSDevice.ps1 index e3860e9..4bb631c 100644 --- a/PSIGEL/Public/Start-UMSDevice.ps1 +++ b/PSIGEL/Public/Start-UMSDevice.ps1 @@ -46,12 +46,12 @@ Body = $Body Method = 'Post' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Stop-UMSDevice.ps1 b/PSIGEL/Public/Stop-UMSDevice.ps1 index 9a9d761..4706b6d 100644 --- a/PSIGEL/Public/Stop-UMSDevice.ps1 +++ b/PSIGEL/Public/Stop-UMSDevice.ps1 @@ -46,12 +46,12 @@ Body = $Body Method = 'Post' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess('Id: {0}' -f $Id)) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Update-UMSDevice.ps1 b/PSIGEL/Public/Update-UMSDevice.ps1 index cebe126..646f35d 100644 --- a/PSIGEL/Public/Update-UMSDevice.ps1 +++ b/PSIGEL/Public/Update-UMSDevice.ps1 @@ -44,7 +44,7 @@ $CostCenter, [Parameter(ParameterSetName = 'Set')] - [ValidateScript( {$_ -match [IPAddress]$_})] + [ValidateScript( { $_ -match [IPAddress]$_ })] [String] $LastIP, @@ -77,7 +77,7 @@ { 'Set' { - $BodyHashTable = @{} + $BodyHashTable = @{ } if ($Name) { $BodyHashTable.Add('name', $Name) @@ -121,12 +121,12 @@ Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0}' -f $Id))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Update-UMSDeviceDirectory.ps1 b/PSIGEL/Public/Update-UMSDeviceDirectory.ps1 index a239003..97f0bcc 100644 --- a/PSIGEL/Public/Update-UMSDeviceDirectory.ps1 +++ b/PSIGEL/Public/Update-UMSDeviceDirectory.ps1 @@ -47,12 +47,12 @@ function Update-UMSDeviceDirectory Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0}' -f $Id))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Update-UMSProfile.ps1 b/PSIGEL/Public/Update-UMSProfile.ps1 index 6645102..1678444 100644 --- a/PSIGEL/Public/Update-UMSProfile.ps1 +++ b/PSIGEL/Public/Update-UMSProfile.ps1 @@ -47,12 +47,12 @@ Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0}' -f $Id))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/PSIGEL/Public/Update-UMSProfileDirectory.ps1 b/PSIGEL/Public/Update-UMSProfileDirectory.ps1 index 76d8a5d..a9b74a7 100644 --- a/PSIGEL/Public/Update-UMSProfileDirectory.ps1 +++ b/PSIGEL/Public/Update-UMSProfileDirectory.ps1 @@ -47,12 +47,12 @@ function Update-UMSProfileDirectory Body = $Body Method = 'Put' ContentType = 'application/json' - Headers = @{} + Headers = @{ } SecurityProtocol = ($SecurityProtocol -join ',') } if ($PSCmdlet.ShouldProcess(('Id: {0}' -f $Id))) { - $APIObjectColl = Invoke-UMSRestMethodWebSession @Params + $APIObjectColl = Invoke-UMSRestMethod @Params } $Result = foreach ($APIObject in $APIObjectColl) { diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index cec2185..ba2a60f 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -16,9 +16,9 @@ Tests Config @{ General = 'PSIGEL' } - # Invoke-UMSRestMethodWebSession + # Invoke-UMSRestMethod @{ - PrivateUnitTests = 'Invoke-UMSRestMethodWebSession' + PrivateUnitTests = 'Invoke-UMSRestMethod' } # New-UMSFilterString @{ diff --git a/Tests/Get-UMSDevice.Tests.ps1 b/Tests/Get-UMSDevice.Tests.ps1 index b70024d..f096ac2 100644 --- a/Tests/Get-UMSDevice.Tests.ps1 +++ b/Tests/Get-UMSDevice.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSDevice Should not throw' { { Get-UMSDevice } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ SyncRoot = @{ mac = '0123456789AB' @@ -76,9 +76,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -104,7 +104,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName ID" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ mac = '0123456789AB' firmwareID = '1' @@ -130,9 +130,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -158,7 +158,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Filter online" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ mac = '0123456789AB' firmwareID = '1' @@ -184,9 +184,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -212,7 +212,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Filter shadow" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ mac = '0123456789AB' firmwareID = '1' @@ -241,9 +241,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -265,7 +265,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Filter details" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ mac = '0123456789AB' firmwareID = '1' @@ -322,9 +322,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -350,7 +350,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Filter details no datetime" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ mac = '0123456789AB' firmwareID = '1' @@ -407,9 +407,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -434,7 +434,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSDevice } | Should throw 'Error' diff --git a/Tests/Get-UMSDeviceAssignment.Tests.ps1 b/Tests/Get-UMSDeviceAssignment.Tests.ps1 index a90b5d7..d52f7ff 100644 --- a/Tests/Get-UMSDeviceAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceAssignment.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSDeviceAssignment Should not throw' { { Get-UMSDeviceAssignment } | Should -Not -Throw @@ -49,7 +49,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ assignee = @{ @@ -67,9 +67,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSDeviceAssignment -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -99,7 +99,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSDeviceAssignment } | Should throw 'Error' diff --git a/Tests/Get-UMSDeviceDirectory.Tests.ps1 b/Tests/Get-UMSDeviceDirectory.Tests.ps1 index 8972d7a..96a0802 100644 --- a/Tests/Get-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSDeviceDirectory Should not throw' { { Get-UMSDeviceDirectory } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ SyncRoot = @{ id = '2' @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSDeviceDirectory - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -90,7 +90,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName ID" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ id = '2' name = 'ProfileName' @@ -102,9 +102,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSDeviceDirectory -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -130,7 +130,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Filter children" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ DirectoryChildren = @( @{ @@ -162,9 +162,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -189,7 +189,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSDeviceDirectory } | Should throw 'Error' diff --git a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 index 5575123..d5cd608 100644 --- a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSDeviceDirectoryAssignment Should not throw' { { Get-UMSDeviceDirectoryAssignment } | Should -Not -Throw @@ -49,7 +49,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ assignee = @{ @@ -67,9 +67,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSDeviceDirectoryAssignment -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -99,7 +99,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSDeviceDirectoryAssignment } | Should throw 'Error' diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index 2de8cab..73e8594 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSFirmware Should not throw' { { Get-UMSFirmware } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ FwResource = @{ id = '2' @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSFirmware - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -90,7 +90,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName ID" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ id = '2' product = 'IGEL OS 11' @@ -102,9 +102,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSFirmware -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -129,7 +129,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSFirmware } | Should throw 'Error' diff --git a/Tests/Get-UMSProfile.Tests.ps1 b/Tests/Get-UMSProfile.Tests.ps1 index 37903d0..b32e19d 100644 --- a/Tests/Get-UMSProfile.Tests.ps1 +++ b/Tests/Get-UMSProfile.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSProfile Should not throw' { { Get-UMSProfile } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ SyncRoot = @{ firmwareID = '2' @@ -65,9 +65,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSProfile - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -97,7 +97,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName ID" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ firmwareID = '2' isMasterProfile = 'false' @@ -112,9 +112,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSProfile -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -143,7 +143,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSProfile } | Should throw 'Error' diff --git a/Tests/Get-UMSProfileAssignment.Tests.ps1 b/Tests/Get-UMSProfileAssignment.Tests.ps1 index b2f7cc3..bd68090 100644 --- a/Tests/Get-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Get-UMSProfileAssignment.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSProfileAssignment Should not throw' { { Get-UMSProfileAssignment } | Should -Not -Throw @@ -49,7 +49,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName Device" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ SyncRoot = @{ @@ -69,9 +69,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSProfileAssignment -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -97,7 +97,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName Directory" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ SyncRoot = @{ @@ -117,9 +117,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSProfileAssignment -Id 2 -Directory - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -144,7 +144,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSProfileAssignment } | Should throw 'Error' diff --git a/Tests/Get-UMSProfileDirectory.Tests.ps1 b/Tests/Get-UMSProfileDirectory.Tests.ps1 index c4c01bd..49bc746 100644 --- a/Tests/Get-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Get-UMSProfileDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSProfileDirectory Should not throw' { { Get-UMSProfileDirectory } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ SyncRoot = @{ id = '2' @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSProfileDirectory - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -90,7 +90,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSetName ID" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ id = '2' name = 'ProfileName' @@ -102,9 +102,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSProfileDirectory -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -130,7 +130,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Filter children" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ DirectoryChildren = @( @{ @@ -162,9 +162,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Assert-MockCalled @AMCParams } - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -189,7 +189,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSProfileDirectory } | Should throw 'Error' diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index 8ab1bb0..fe52ab4 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Get-UMSStatus Should not throw' { { Get-UMSStatus } | Should -Not -Throw @@ -47,7 +47,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { [pscustomobject]@{ rmGuiServerVersion = '6.01.100' buildNumber = '40023' @@ -60,9 +60,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Get-UMSStatus - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -87,7 +87,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Get-UMSStatus } | Should throw 'Error' diff --git a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 b/Tests/Invoke-UMSRestMethod.Tests.ps1 similarity index 85% rename from Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 rename to Tests/Invoke-UMSRestMethod.Tests.ps1 index 522c296..4b3d805 100644 --- a/Tests/Invoke-UMSRestMethodWebSession.Tests.ps1 +++ b/Tests/Invoke-UMSRestMethod.Tests.ps1 @@ -50,12 +50,12 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { [pscustomobject]@{ } } - It "Invoke-UMSRestMethodWebSession Should not throw" { - { Invoke-UMSRestMethodWebSession } | Should -Not -Throw + It "Invoke-UMSRestMethod Should not throw" { + { Invoke-UMSRestMethod } | Should -Not -Throw } - It "Invoke-UMSRestMethodWebSession -Method 'nonexisting' -ErrorAction Stop Should throw" { - { Invoke-UMSRestMethodWebSession -Method 'nonexisting' -ErrorAction Stop } | Should -Throw + It "Invoke-UMSRestMethod -Method 'nonexisting' -ErrorAction Stop Should throw" { + { Invoke-UMSRestMethod -Method 'nonexisting' -ErrorAction Stop } | Should -Throw } } @@ -66,7 +66,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { [pscustomobject]@{ Test = 'Test' } } - $Result = Invoke-UMSRestMethodWebSession + $Result = Invoke-UMSRestMethod It 'Assert Invoke-RestMethod is called exactly 1 time' { $AMCParams = @{ @@ -92,15 +92,15 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Mock an exception" { - Mock 'Invoke-RestMethod' -Skip { + Mock 'Invoke-RestMethod' { [System.Net.WebException]::new('400') | Add-Member -NotePropertyName Response -PassThru -Force -NotePropertyValue ( [PSCustomObject]@{ StatusCode = [System.Net.HttpStatusCode]::BadRequest } ) # work in progress } - It Invoke-UMSRestMethodWebSession' should throw' -Skip { - { Invoke-UMSRestMethodWebSession } | Should Throw 'some error' + It Invoke-UMSRestMethod' should throw' -Skip { + { Invoke-UMSRestMethod } | Should Throw 'some error' } # makes no sense without above } diff --git a/Tests/Move-UMSDevice.Tests.ps1 b/Tests/Move-UMSDevice.Tests.ps1 index 170d372..edb5733 100644 --- a/Tests/Move-UMSDevice.Tests.ps1 +++ b/Tests/Move-UMSDevice.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Move-UMSDevice -Id 2 -DestId 2 Should not throw' { { Move-UMSDevice -Id 2 -DestId 2 } | Should -Not -Throw @@ -45,7 +45,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ id = '2' @@ -56,9 +56,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Move-UMSDevice -Id 2 -DestId 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -84,13 +84,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Move-UMSDevice -Id 2 -DestId 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -103,7 +103,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'Move-UMSDevice -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSDevice -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index 13a2892..1b1cafa 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Move-UMSDeviceDirectory -Id 2 -DestId 2 Should not throw' { { Move-UMSDeviceDirectory -Id 2 -DestId 2 } | Should -Not -Throw @@ -45,7 +45,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ id = '2' @@ -56,9 +56,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Move-UMSDeviceDirectory -Id 2 -DestId 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -84,13 +84,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Move-UMSDeviceDirectory -Id 2 -DestId 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -103,7 +103,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'Move-UMSDeviceDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSDeviceDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Move-UMSProfile.Tests.ps1 b/Tests/Move-UMSProfile.Tests.ps1 index ee645e6..ff1dd51 100644 --- a/Tests/Move-UMSProfile.Tests.ps1 +++ b/Tests/Move-UMSProfile.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Move-UMSProfile -Id 2 -DestId 2 Should not throw' { { Move-UMSProfile -Id 2 -DestId 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ id = '2' @@ -55,9 +55,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Move-UMSProfile -Id 2 -DestId 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -83,13 +83,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Move-UMSProfile -Id 2 -DestId 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -102,7 +102,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'Move-UMSProfile -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSProfile -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index 09cc1d7..5925dcf 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It 'Move-UMSProfileDirectory -Id 2 -DestId 2 Should not throw' { { Move-UMSProfileDirectory -Id 2 -DestId 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ id = '2' @@ -55,9 +55,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Move-UMSProfileDirectory -Id 2 -DestId 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -83,13 +83,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Move-UMSProfileDirectory -Id 2 -DestId 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -102,7 +102,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'Move-UMSProfileDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop Should throw' { { Move-UMSProfileDirectory -Id 2 -DestId 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index 32cdfa1..b074398 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -57,7 +57,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-RestMethod' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'JSESSIONID=3FB2F3F6A089FE9029DFD6DAFEF146DC' @@ -67,9 +67,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = New-UMSAPICookie - It 'Assert Invoke-RestMethod is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-RestMethod' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index 9dbf52c..d0649a2 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -36,7 +36,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' Should not throw" { { New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' } | Should -Not -Throw @@ -45,7 +45,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Thin client successfully inserted.' @@ -58,9 +58,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -86,13 +86,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -105,7 +105,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' -ApiVersion 10 -ErrorAction Stop Should throw" { { New-UMSDevice -Mac '001122334455' -FirmwareId 2 -LastIP '192.168.0.1' -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index bba52e2..5050735 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "New-UMSDeviceDirectory -Name 'NameNew' Should not throw" { { New-UMSDeviceDirectory -Name 'NameNew' } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Directory successfully inserted.' @@ -56,9 +56,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = New-UMSDeviceDirectory -Name 'NameNew' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -84,13 +84,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = New-UMSDeviceDirectory -Name 'NameNew' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -103,7 +103,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "New-UMSDeviceDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop Should throw" { { New-UMSDeviceDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 4a83a42..9eb4d3c 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc'" { { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "tc" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = '1 asssignments successfully assigned' @@ -58,9 +58,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,7 +94,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "tcdirectory" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = '1 asssignments successfully assigned' @@ -104,9 +104,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = $Result = New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tcdirectory' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -140,13 +140,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -159,7 +159,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should throw 'Error' diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index c5842c0..e399a75 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "New-UMSProfileDirectory -Name 'NameNew' Should not throw" { { New-UMSProfileDirectory -Name 'NameNew' } | Should -Not -Throw @@ -43,7 +43,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Directory successfully inserted.' @@ -55,9 +55,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = New-UMSProfileDirectory -Name 'NameNew' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -83,13 +83,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = New-UMSProfileDirectory -Name 'NameNew' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -102,7 +102,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "New-UMSProfileDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop Should throw" { { New-UMSProfileDirectory -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 16f2f52..c551d5e 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -4,9 +4,9 @@ param [String] $Tags = 'UnitTests', - [ValidateSet('Default', 'Passed', 'Failed', 'Pending', 'Skipped', 'Inconclusive', 'Describe', 'Context', 'Summary')] - [String] - $Show = 'Summary', + #[ValidateSet('Default', 'Passed', 'Failed', 'Pending', 'Skipped', 'Inconclusive', 'Describe', 'Context', 'Summary')] + [String[]] + $Show = 'Summary, Failed', [Switch] $EnableExit = $false @@ -15,10 +15,14 @@ $ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) $ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) $ModuleName = Split-Path $ModuleRoot -Leaf $OutputPath = '{0}\Tests\Data' -f $ProjectRoot +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) $Credential = Import-Clixml -Path $Cfg.CredPath +# PS7 on Windows +#Import-Module 'C:\Program Files\PowerShell\7\Modules\CimCmdlets\CimCmdlets.psd1' + if ($Tags -contains { 'IntegrationTest ' -or 'All' }) { @@ -48,6 +52,7 @@ foreach ($Test in $Cfg.Tests) { ( { $PSItem.All } ) { + Write-Host $Test.All $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.All $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.All switch ($Tags) @@ -72,6 +77,7 @@ foreach ($Test in $Cfg.Tests) } ( { $PSItem.IntegrationTests } ) { + Write-Host $Test.IntegrationTests $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.IntegrationTests $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.IntegrationTests switch ($Tags) @@ -90,6 +96,7 @@ foreach ($Test in $Cfg.Tests) } ( { $PSItem.UnitTests } ) { + Write-Host $Test.UnitTests $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.UnitTests $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.UnitTests switch ($Tags) @@ -108,6 +115,7 @@ foreach ($Test in $Cfg.Tests) } ( { $PSItem.PrivateUnitTests } ) { + Write-Host $Test.PrivateUnitTests $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.PrivateUnitTests $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.PrivateUnitTests switch ($Tags) @@ -126,6 +134,7 @@ foreach ($Test in $Cfg.Tests) } ( { $PSItem.General } ) { + Write-Host $Test.General $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.General $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.General switch ($Tags) diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index 30ace6c..2c075f5 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Remove-UMSDevice -Id 2 Should not throw" { { Remove-UMSDevice -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParmeterSet Offline" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Offline deletion successful' @@ -54,9 +54,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSDevice -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -86,7 +86,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSet Online" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ CommandExecList = ( @@ -104,9 +104,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSDevice -Id 2 -Online - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -136,13 +136,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Remove-UMSDevice -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -155,7 +155,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Remove-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 1b1eaac..55b5d71 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Remove-UMSDeviceDirectory -Id 2 Should not throw" { { Remove-UMSDeviceDirectory -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Deletion successful.' @@ -54,9 +54,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSDeviceDirectory -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -86,13 +86,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Remove-UMSDeviceDirectory -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -105,7 +105,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Remove-UMSDeviceDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSDeviceDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index f7a9bb0..2ebc379 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Remove-UMSProfile -Id 2 Should not throw" { { Remove-UMSProfile -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Deleted profile with id 2' @@ -54,9 +54,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSProfile -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -86,13 +86,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Remove-UMSProfile -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -105,7 +105,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Remove-UMSProfile -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSProfile -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index 3f69b63..b9e8381 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' Should not throw" { { Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "tc" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'deleted profile assignment' @@ -54,9 +54,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -90,7 +90,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "tcdirectory" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'deleted profile assignment' @@ -100,9 +100,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tcdirectory' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -136,13 +136,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tcdirectory' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -155,7 +155,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index 9084326..ed815af 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Remove-UMSProfileDirectory -Id 2 Should not throw" { { Remove-UMSProfileDirectory -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Deletion successful.' @@ -54,9 +54,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Remove-UMSProfileDirectory -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -86,13 +86,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Remove-UMSProfileDirectory -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -105,7 +105,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Remove-UMSProfileDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Remove-UMSProfileDirectory -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Reset-UMSDevice.Tests.ps1 b/Tests/Reset-UMSDevice.Tests.ps1 index 544a0be..85fd7f7 100644 --- a/Tests/Reset-UMSDevice.Tests.ps1 +++ b/Tests/Reset-UMSDevice.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Reset-UMSDevice -Id 2 Should not throw" { { Reset-UMSDevice -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ CommandExecList = ( @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Reset-UMSDevice -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Reset-UMSDevice -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Reset-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Reset-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Restart-UMSDevice.Tests.ps1 b/Tests/Restart-UMSDevice.Tests.ps1 index c8901d2..12263dd 100644 --- a/Tests/Restart-UMSDevice.Tests.ps1 +++ b/Tests/Restart-UMSDevice.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Restart-UMSDevice -Id 2 Should not throw" { { Restart-UMSDevice -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ CommandExecList = ( @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Restart-UMSDevice -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Restart-UMSDevice -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Restart-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Restart-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Send-UMSDeviceSetting.Tests.ps1 b/Tests/Send-UMSDeviceSetting.Tests.ps1 index 2838a92..62c090a 100644 --- a/Tests/Send-UMSDeviceSetting.Tests.ps1 +++ b/Tests/Send-UMSDeviceSetting.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Send-UMSDeviceSetting -Id 2 Should not throw" { { Send-UMSDeviceSetting -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ CommandExecList = ( @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Send-UMSDeviceSetting -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Send-UMSDeviceSetting -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Send-UMSDeviceSetting -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Send-UMSDeviceSetting -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Start-UMSDevice.Tests.ps1 b/Tests/Start-UMSDevice.Tests.ps1 index d6e703e..e61068a 100644 --- a/Tests/Start-UMSDevice.Tests.ps1 +++ b/Tests/Start-UMSDevice.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Start-UMSDevice -Id 2 Should not throw" { { Start-UMSDevice -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ CommandExecList = ( @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Start-UMSDevice -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Start-UMSDevice -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Start-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Start-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Stop-UMSDevice.Tests.ps1 b/Tests/Stop-UMSDevice.Tests.ps1 index cce00f8..64b758d 100644 --- a/Tests/Stop-UMSDevice.Tests.ps1 +++ b/Tests/Stop-UMSDevice.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Stop-UMSDevice -Id 2 Should not throw" { { Stop-UMSDevice -Id 2 } | Should -Not -Throw @@ -44,7 +44,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ CommandExecList = ( @@ -62,9 +62,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Stop-UMSDevice -Id 2 - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Stop-UMSDevice -Id 2 -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Stop-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop Should throw" { { Stop-UMSDevice -Id 2 -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index 19b8d28..c16286b 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -35,7 +35,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Update-UMSDevice -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSDevice -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -53,7 +53,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "ParameterSet Set" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Update successful' @@ -75,9 +75,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } $Result = Update-UMSDevice @Params - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -111,13 +111,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Update-UMSDevice -Id 2 -Name 'NameNew' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -130,7 +130,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It "Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop should throw Error" { { Update-UMSDevice -Id 2 -Name 'NameNew' -ApiVersion 10 -ErrorAction Stop } | Should -Throw diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index 50eb41c..f7b7614 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Updated directory successfully.' @@ -58,9 +58,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Update-UMSDeviceDirectory -Id 2 -Name 'NameNew' } | Should throw 'Error' diff --git a/Tests/Update-UMSProfile.Tests.ps1 b/Tests/Update-UMSProfile.Tests.ps1 index cd24117..236efb8 100644 --- a/Tests/Update-UMSProfile.Tests.ps1 +++ b/Tests/Update-UMSProfile.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Update-UMSProfile -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSProfile -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Update successful' @@ -58,9 +58,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Update-UMSProfile -Id 2 -Name 'NameNew' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Update-UMSProfile -Id 2 -Name 'NameNew' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { New-UMSProfileAssignment -Id 2 -ReceiverId 2 -ReceiverType 'tc' } | Should throw 'Error' diff --git a/Tests/Update-UMSProfileDirectory.Tests.ps1 b/Tests/Update-UMSProfileDirectory.Tests.ps1 index f9d16c5..f4cdda0 100644 --- a/Tests/Update-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Update-UMSProfileDirectory.Tests.ps1 @@ -34,7 +34,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } It "Update-UMSProfileDirectory -Id 2 -Name 'NameNew' Should not throw" { { Update-UMSProfileDirectory -Id 2 -Name 'NameNew' } | Should -Not -Throw @@ -48,7 +48,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "All" { - Mock 'Invoke-UMSRestMethodWebSession' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'Updated directory successfully.' @@ -58,9 +58,9 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { $Result = Update-UMSProfileDirectory -Id 2 -Name 'NameNew' - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 1 time' { + It 'Assert Invoke-UMSRestMethod is called exactly 1 time' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 1 Exactly = $true } @@ -94,13 +94,13 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "Whatif" { - Mock 'Invoke-UMSRestMethodWebSession' { } + Mock 'Invoke-UMSRestMethod' { } $Result = Update-UMSProfileDirectory -Id 2 -Name 'NameNew' -WhatIf - It 'Assert Invoke-UMSRestMethodWebSession is called exactly 0 times' { + It 'Assert Invoke-UMSRestMethod is called exactly 0 times' { $AMCParams = @{ - CommandName = 'Invoke-UMSRestMethodWebSession' + CommandName = 'Invoke-UMSRestMethod' Times = 0 Exactly = $true } @@ -113,7 +113,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } Context "Error Handling" { - Mock 'Invoke-UMSRestMethodWebSession' { throw 'Error' } + Mock 'Invoke-UMSRestMethod' { throw 'Error' } It 'should throw Error' { { Update-UMSProfileDirectory -Id 2 -Name 'NameNew' } | Should throw 'Error' From 2e3541292c47cd73847bdfa2a4db033ba0cb054f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 22 Apr 2020 18:25:00 +0200 Subject: [PATCH 103/145] edited Tests --- PSIGEL/Private/Invoke-UMSRestMethod.ps1 | 3 +- PSIGEL/Public/New-UMSAPICookie.ps1 | 2 +- Tests/Config.psd1 | 232 ++++++++++++++++-------- Tests/Invoke-UMSRestMethod.Tests.ps1 | 95 +++++++--- Tests/Pester.ps1 | 139 +++----------- 5 files changed, 254 insertions(+), 217 deletions(-) diff --git a/PSIGEL/Private/Invoke-UMSRestMethod.ps1 b/PSIGEL/Private/Invoke-UMSRestMethod.ps1 index bc2d40f..ccc59f2 100644 --- a/PSIGEL/Private/Invoke-UMSRestMethod.ps1 +++ b/PSIGEL/Private/Invoke-UMSRestMethod.ps1 @@ -76,7 +76,7 @@ function Invoke-UMSRestMethod { $null = $PSBoundParameters.Remove('SecurityProtocol') $null = $PSBoundParameters.Add('ErrorAction', 'Stop') - Switch ($PSEdition) + Switch (Get-Variable -Name PSEdition -ValueOnly) { 'Desktop' { @@ -113,7 +113,6 @@ function Invoke-UMSRestMethod Write-Warning -Message ('Some error occured see HTTP status code {0} for further details. Uri: {1} Method: {2}' -f $PSItem.Exception.Response.StatusCode, $Uri, $Method) } } - } } 'Core' diff --git a/PSIGEL/Public/New-UMSAPICookie.ps1 b/PSIGEL/Public/New-UMSAPICookie.ps1 index 0742616..f241baa 100644 --- a/PSIGEL/Public/New-UMSAPICookie.ps1 +++ b/PSIGEL/Public/New-UMSAPICookie.ps1 @@ -44,7 +44,7 @@ ContentType = 'application/json' SecurityProtocol = $SecurityProtocol } - switch ($PSEdition) + switch (Get-Variable -Name PSEdition -ValueOnly) { 'Desktop' { diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index ba2a60f..16ad4c6 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -7,6 +7,7 @@ Tests Config Computername = 'igelrmserver' TCPPort = 9443 CredPath = 'C:\Credentials\UMSRmdb.cred' + CredPathWsl = '/mnt/c/Credentials/UmsRmdbWsl.cred' SecurityProtocol = 'Tls12' ProfileRootDirId = 527 # Profiles/PSIGEL DeviceRootDirId = 502 # Devices/PSIGEL @@ -14,27 +15,35 @@ Tests Config Tests = @( # PSIGEL @{ - General = 'PSIGEL' + Name = 'PSIGEL' } # Invoke-UMSRestMethod @{ - PrivateUnitTests = 'Invoke-UMSRestMethod' + Name = 'Invoke-UMSRestMethod' + Tags = 'UnitTests' + #CodeCoveragePath = 'Private' } # New-UMSFilterString @{ - PrivateUnitTests = 'New-UMSFilterString' + Name = 'New-UMSFilterString' + Tags = 'UnitTests' + CodeCoveragePath = 'Private' } # New-UMSAPICookie @{ - All = 'New-UMSAPICookie' + Name = 'New-UMSAPICookie' + Tags = 'UnitTests, IntegrationTests' + #CodeCoveragePath = 'Public' ParameterSets = @{ Default = @{ } } } # Get-UMSStatus @{ - All = 'Get-UMSStatus' - ParameterSets = @{ + Name = 'Get-UMSStatus' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Expected = @{ RmGuiServerVersion = '6.3.130' @@ -52,8 +61,10 @@ Tests Config } # New-UMSDeviceDirectory @{ - All = 'New-UMSDeviceDirectory' - ParameterSets = @{ + Name = 'New-UMSDeviceDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Name = 'QA' @@ -71,8 +82,10 @@ Tests Config } # New-UMSDevice @{ - All = 'New-UMSDevice' - ParameterSets = @{ + Name = 'New-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Mac = '0A0000000007' @@ -110,8 +123,10 @@ Tests Config } # New-UMSProfileDirectory @{ - All = 'New-UMSProfileDirectory' - ParameterSets = @{ + Name = 'New-UMSProfileDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Name = 'Devices' @@ -129,8 +144,10 @@ Tests Config } # New-UMSProfileAssignment @{ - All = 'New-UMSProfileAssignment' - ParameterSets = @{ + Name = 'New-UMSProfileAssignment' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 538 # NW_WLAN @@ -164,8 +181,10 @@ Tests Config } # Remove-UMSDevice @{ - All = 'Remove-UMSDevice' - ParameterSets = @{ + Name = 'Remove-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 572 # L-DIS-011 @@ -191,8 +210,10 @@ Tests Config } # Remove-UMSDeviceDirectory @{ - All = 'Remove-UMSDeviceDirectory' - ParameterSets = @{ + Name = 'Remove-UMSDeviceDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 520 # L_Distribution @@ -211,8 +232,10 @@ Tests Config } # Remove-UMSProfile @{ - All = 'Remove-UMSProfile' - ParameterSets = @{ + Name = 'Remove-UMSProfile' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 542 # SYS_TZ_CET @@ -229,8 +252,10 @@ Tests Config } # Remove-UMSProfileDirectory @{ - All = 'Remove-UMSProfileDirectory' - ParameterSets = @{ + Name = 'Remove-UMSProfileDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 541 # System @@ -247,8 +272,10 @@ Tests Config } # Remove-UMSProfileAssignment @{ - All = 'Remove-UMSProfileAssignment' - ParameterSets = @{ + Name = 'Remove-UMSProfileAssignment' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 538 # NW_WLAN @@ -282,8 +309,10 @@ Tests Config } # Move-UMSDevice @{ - All = 'Move-UMSDevice' - ParameterSets = @{ + Name = 'Move-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 518 # L-DEV-009 @@ -327,8 +356,10 @@ Tests Config } # Move-UMSDeviceDirectory @{ - All = 'Move-UMSDeviceDirectory' - ParameterSets = @{ + Name = 'Move-UMSDeviceDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 597 # QA @@ -356,8 +387,10 @@ Tests Config } # Move-UMSProfileDirectory @{ - All = 'Move-UMSProfileDirectory' - ParameterSets = @{ + Name = 'Move-UMSProfileDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 534 # Network User Interface @@ -377,8 +410,10 @@ Tests Config } # Move-UMSProfile @{ - All = 'Move-UMSProfile' - ParameterSets = @{ + Name = 'Move-UMSProfile' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 535 # NW_LNG_DE @@ -398,8 +433,10 @@ Tests Config } # Update-UMSDeviceDirectory @{ - All = 'Update-UMSDeviceDirectory' - ParameterSets = @{ + Name = 'Update-UMSDeviceDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 517 # L_Develpoment @@ -427,8 +464,10 @@ Tests Config } #Update-UMSDevice @{ - All = 'Update-UMSDevice' - ParameterSets = @{ + Name = 'Update-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 518 # L-DEV-009 @@ -472,8 +511,10 @@ Tests Config } # Update-UMSProfileDirectory @{ - All = 'Update-UMSProfileDirectory' - ParameterSets = @{ + Name = 'Update-UMSProfileDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 534 # Network user Interface @@ -493,8 +534,10 @@ Tests Config } # Update-UMSProfile @{ - All = 'Update-UMSProfile' - ParameterSets = @{ + Name = 'Update-UMSProfile' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 535 # NW_LNG_DE @@ -514,8 +557,10 @@ Tests Config } # Start-UMSDevice @{ - All = 'Start-UMSDevice' - ParameterSets = @{ + Name = 'Start-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 576 # BR-MKT-004 @@ -538,8 +583,10 @@ Tests Config } # Send-UMSDeviceSetting @{ - All = 'Send-UMSDeviceSetting' - ParameterSets = @{ + Name = 'Send-UMSDeviceSetting' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 576 # BR-MKT-004 @@ -562,8 +609,10 @@ Tests Config } # Restart-UMSDevice @{ - All = 'Restart-UMSDevice' - ParameterSets = @{ + Name = 'Restart-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 576 # BR-MKT-004 @@ -586,8 +635,10 @@ Tests Config } # Stop-UMSDevice @{ - All = 'Stop-UMSDevice' - ParameterSets = @{ + Name = 'Stop-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 576 # BR-MKT-004 @@ -610,8 +661,10 @@ Tests Config } # Reset-UMSDevice @{ - All = 'Reset-UMSDevice' - ParameterSets = @{ + Name = 'Reset-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 576 # BR-MKT-004 @@ -634,8 +687,9 @@ Tests Config } # Pipeline.UMSProfileAssignment @{ - IntegrationTests = 'Pipeline.UMSProfileAssignment' - ParameterSets = @{ + Name = 'Pipeline.UMSProfileAssignment' + Tags = 'IntegrationTests' + ParameterSets = @{ ValueFromPipeline = @{ NewAssignmentParams = @{ Id = 595 # SES_RDP_Session02 @@ -699,8 +753,9 @@ Tests Config } # Pipeline.UMSDevice @{ - IntegrationTests = 'Pipeline.UMSDevice' - ParameterSets = @{ + Name = 'Pipeline.UMSDevice' + Tags = 'IntegrationTests' + ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ Mac = '0A00000000AA' @@ -852,8 +907,9 @@ Tests Config } # Pipeline.UMSDeviceDirectory @{ - IntegrationTests = 'Pipeline.UMSDeviceDirectory' - ParameterSets = @{ + Name = 'Pipeline.UMSDeviceDirectory' + Tags = 'IntegrationTests' + ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ Name = 'NewDeviceDirectory01' @@ -924,8 +980,9 @@ Tests Config } # Pipeline.UMSProfile @{ - IntegrationTests = 'Pipeline.UMSProfile' - ParameterSets = @{ + Name = 'Pipeline.UMSProfile' + Tags = 'IntegrationTests' + ParameterSets = @{ ValueFromPipeline = @{ MoveParams = @{ Id = 595 # SES_RDP_Session02 @@ -983,8 +1040,9 @@ Tests Config } # Pipeline.UMSProfileDirectory @{ - IntegrationTests = 'Pipeline.UMSProfileDirectory' - ParameterSets = @{ + Name = 'Pipeline.UMSProfileDirectory' + Tags = 'IntegrationTests' + ParameterSets = @{ ValueFromPipeline = @{ NewParams = @{ Name = 'NewProfileDirectory01' @@ -1055,8 +1113,10 @@ Tests Config } # Get-UMSFirmware @{ - All = 'Get-UMSFirmware' - ParameterSets = @{ + Name = 'Get-UMSFirmware' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Expected = @( @{ @@ -1080,8 +1140,10 @@ Tests Config } # Get-UMSDevice @{ - All = 'Get-UMSDevice' - ParameterSets = @{ + Name = 'Get-UMSDevice' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ } @@ -1290,8 +1352,10 @@ Tests Config } # Get-UMSDeviceDirectory @{ - All = 'Get-UMSDeviceDirectory' - ParameterSets = @{ + Name = 'Get-UMSDeviceDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ } @@ -1404,8 +1468,10 @@ Tests Config } # Get-UMSProfile @{ - All = 'Get-UMSProfile' - ParameterSets = @{ + Name = 'Get-UMSProfile' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ } @@ -1479,8 +1545,10 @@ Tests Config } # Get-UMSProfileDirectory @{ - All = 'Get-UMSProfileDirectory' - ParameterSets = @{ + Name = 'Get-UMSProfileDirectory' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ } @@ -1571,8 +1639,10 @@ Tests Config } # Get-UMSProfileAssignment @{ - All = 'Get-UMSProfileAssignment' - ParameterSets = @{ + Name = 'Get-UMSProfileAssignment' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 538 # NW_LAN @@ -1619,8 +1689,10 @@ Tests Config } # Get-UMSDeviceAssignment @{ - All = 'Get-UMSDeviceAssignment' - ParameterSets = @{ + Name = 'Get-UMSDeviceAssignment' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 577 # BR-MKT-003 @@ -1667,8 +1739,10 @@ Tests Config } # Get-UMSDeviceDirectoryAssignment @{ - All = 'Get-UMSDeviceDirectoryAssignment' - ParameterSets = @{ + Name = 'Get-UMSDeviceDirectoryAssignment' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ Id = 504 # BR_HR @@ -1715,8 +1789,10 @@ Tests Config } # Get-UMSDirectoryRecursive @{ - All = 'Get-UMSDirectoryRecursive' - ParameterSets = @{ + Name = 'Get-UMSDirectoryRecursive' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ Params1 = @{ #DirectoryColl = 'Get-UMSDeviceDirectory' diff --git a/Tests/Invoke-UMSRestMethod.Tests.ps1 b/Tests/Invoke-UMSRestMethod.Tests.ps1 index 4b3d805..aebf4b8 100644 --- a/Tests/Invoke-UMSRestMethod.Tests.ps1 +++ b/Tests/Invoke-UMSRestMethod.Tests.ps1 @@ -7,7 +7,6 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { - <# Context "Basics" { It "Is valid Powershell (Has no script errors)" { @@ -28,7 +27,6 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } } } - #> InModuleScope $Script:ModuleName { @@ -44,7 +42,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { '*:Method' = 'Get' } - Context "General Execution" { + Context "Desktop General Execution" { Mock 'Invoke-RestMethod' { [pscustomobject]@{ } @@ -60,33 +58,82 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { } - Context "Method Get" { + Switch (Get-Variable -Name PSEdition -ValueOnly) + { + 'Desktop' + { - Mock 'Invoke-RestMethod' { - [pscustomobject]@{ Test = 'Test' } - } + Context "Desktop Desktop:Invoke-UMSRestMethod" { - $Result = Invoke-UMSRestMethod + Mock 'Get-Variable' { + 'Desktop' + } - It 'Assert Invoke-RestMethod is called exactly 1 time' { - $AMCParams = @{ - CommandName = 'Invoke-RestMethod' - Times = 1 - Exactly = $true - } - Assert-MockCalled @AMCParams - } + Mock 'Invoke-RestMethod' { + [pscustomobject]@{ Test = 'Test' } + } - It 'Result should have type PSCustomObject' { - $Result | Should -HaveType ([PSCustomObject]) - } + $Result = Invoke-UMSRestMethod - It 'Result should have 1 element' { - @($Result).Count | Should BeExactly 1 - } + It 'Assert Invoke-RestMethod is called exactly 1 time' { + $AMCParams = @{ + CommandName = 'Invoke-RestMethod' + Times = 1 + Exactly = $true + } + Assert-MockCalled @AMCParams + } + + It 'Result should have type PSCustomObject' { + $Result | Should -HaveType ([PSCustomObject]) + } - It "Result.Test should be exactly 'Test'" { - $Result.Test | Should BeExactly 'Test' + It 'Result should have 1 element' { + @($Result).Count | Should BeExactly 1 + } + + It "Result.Test should be exactly 'Test'" { + $Result.Test | Should BeExactly 'Test' + } + } + Mock 'Get-Variable' { + 'Desktop' + } + } + 'Core' + { + Mock 'Get-Variable' { + 'Core' + } + Context "Core Invoke-RestMethod" { + + Mock 'Invoke-RestMethod' { + [pscustomobject]@{ Test = 'Test' } + } + + $Result = Invoke-UMSRestMethod + + It 'Assert Invoke-RestMethod is called exactly 1 time' { + $AMCParams = @{ + CommandName = 'Invoke-RestMethod' + Times = 1 + Exactly = $true + } + Assert-MockCalled @AMCParams + } + + It 'Result should have type PSCustomObject' { + $Result | Should -HaveType ([PSCustomObject]) + } + + It 'Result should have 1 element' { + @($Result).Count | Should BeExactly 1 + } + + It "Result.Test should be exactly 'Test'" { + $Result.Test | Should BeExactly 'Test' + } + } } } diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index c551d5e..1362cc1 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -4,28 +4,37 @@ param [String] $Tags = 'UnitTests', - #[ValidateSet('Default', 'Passed', 'Failed', 'Pending', 'Skipped', 'Inconclusive', 'Describe', 'Context', 'Summary')] [String[]] - $Show = 'Summary, Failed', + $Show = ('Header', 'Summary', 'Failed'), [Switch] $EnableExit = $false ) -$ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) -$ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $ProjectRoot)) +$DSC = [IO.Path]::DirectorySeparatorChar +$ProjectRoot = Resolve-Path ('{1}{0}..' -f $DSC, $PSScriptRoot) +$ModuleRoot = Split-Path (Resolve-Path ('{1}{0}*{0}*.psm1' -f $DSC, $ProjectRoot)) $ModuleName = Split-Path $ModuleRoot -Leaf -$OutputPath = '{0}\Tests\Data' -f $ProjectRoot -Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force +$OutputPath = '{1}{0}Tests{0}Data' -f $DSC, $ProjectRoot +Import-Module ( '{1}{0}{2}.psm1' -f $DSC, $Script:ModuleRoot, $Script:ModuleName) -Force -$Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) -$Credential = Import-Clixml -Path $Cfg.CredPath +$Cfg = Import-PowerShellDataFile -Path ('{1}{0}Tests{0}Config.psd1' -f $DSC, $Script:ProjectRoot) # PS7 on Windows -#Import-Module 'C:\Program Files\PowerShell\7\Modules\CimCmdlets\CimCmdlets.psd1' +if (($PSEdition -eq 'Desktop') -and ($PSVersionTable.PSVersion.Major -eq 7)) +{ + Import-Module ('{0}\7\Modules\CimCmdlets\CimCmdlets.psd1' -f [Environment]::GetEnvironmentVariable('ProgramFiles')) -Force +} if ($Tags -contains { 'IntegrationTest ' -or 'All' }) { - + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential '*-UMS*:Computername' = $Cfg.Computername @@ -40,114 +49,20 @@ if ($Tags -contains { 'IntegrationTest ' -or 'All' }) } -$PSDefaultParameterValues += @{ - 'Invoke-Pester:Show' = $Show - 'Invoke-Pester:EnableExit' = $EnableExit -} - foreach ($Test in $Cfg.Tests) { $IVPParams = @{ } + $IVPParams.Add('Tags', $Tags) + $IVPParams.Add('Show', $Show) + $IVPParams.Add('EnableExit', $EnableExit) + $IVPParams.Add('Script', ('{1}{0}Tests{0}{2}.Tests.ps1' -f $DSC, $ProjectRoot, $Test.Name)) switch ($Test) { - ( { $PSItem.All } ) - { - Write-Host $Test.All - $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.All - $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.All - switch ($Tags) - { - 'All' - { - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.All - Invoke-Pester @IVPParams - } - 'UnitTests' - { - $IVPParams.Tag = 'UnitTests' - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.All - Invoke-Pester @IVPParams - } - 'IntegrationTests' - { - $IVPParams.Tag = 'IntegrationTests' - Invoke-Pester @IVPParams - } - } - } - ( { $PSItem.IntegrationTests } ) - { - Write-Host $Test.IntegrationTests - $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.IntegrationTests - $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.IntegrationTests - switch ($Tags) - { - 'All' - { - $IVPParams.Tag = 'IntegrationTests' - Invoke-Pester @IVPParams - } - 'IntegrationTests' - { - $IVPParams.Tag = 'IntegrationTests' - Invoke-Pester @IVPParams - } - } - } - ( { $PSItem.UnitTests } ) - { - Write-Host $Test.UnitTests - $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.UnitTests - $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.UnitTests - switch ($Tags) - { - 'All' - { - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.UnitTests - Invoke-Pester @IVPParams - } - 'UnitTests' - { - $IVPParams.CodeCoverage = '{0}\{1}\Public\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.UnitTests - Invoke-Pester @IVPParams - } - } - } - ( { $PSItem.PrivateUnitTests } ) - { - Write-Host $Test.PrivateUnitTests - $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.PrivateUnitTests - $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.PrivateUnitTests - switch ($Tags) - { - 'All' - { - $IVPParams.CodeCoverage = '{0}\{1}\Private\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.PrivateUnitTests - Invoke-Pester @IVPParams - } - 'UnitTests' - { - $IVPParams.CodeCoverage = '{0}\{1}\Private\{2}.ps1' -f $ProjectRoot, $ModuleName, $Test.PrivateUnitTests - Invoke-Pester @IVPParams - } - } - } - ( { $PSItem.General } ) + ( { $PSItem.CodeCoveragePath } ) { - Write-Host $Test.General - $IVPParams.Script = '{0}\Tests\{1}.Tests.ps1' -f $ProjectRoot, $Test.General - $IVPParams.OutputFile = '{0}\{1}.Tests.xml' -f $OutputPath, $Test.General - switch ($Tags) - { - 'All' - { - Invoke-Pester @IVPParams - } - 'UnitTests' - { - Invoke-Pester @IVPParams - } - } + $IVPParams.Add('CodeCoverage', ('{1}{0}{2}{0}{3}{0}{4}.ps1' -f $DSC, $ProjectRoot, $ModuleName, $PSItem.CodeCoveragePath, $Test.Name)) + $IVPParams.Add('Outputfile', ('{1}{0}{2}.Tests.xml' -f $DSC, $OutputPath, $Test.Name)) } } + Invoke-Pester @IVPParams } From 3ec07e68fd8079bae894d64a8932de69915bd280 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 12:10:23 +0200 Subject: [PATCH 104/145] Update New-UMSAPICookie.Tests.ps1 --- Tests/New-UMSAPICookie.Tests.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index b074398..ed39929 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -27,7 +27,6 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { InModuleScope $Script:ModuleName { - $User = "User" $PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force $PSDefaultParameterValues = @{ @@ -37,7 +36,7 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Context "General Execution" { - Mock 'Invoke-RestMethod' { + Mock 'Invoke-UMSRestMethod' { ( [pscustomobject]@{ message = 'JSESSIONID=3FB2F3F6A089FE9029DFD6DAFEF146DC' From a0bea4e24e2a6cf1b5c40a19e3f29078e5b680d6 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 12:10:28 +0200 Subject: [PATCH 105/145] Update Pester.ps1 --- Tests/Pester.ps1 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 1362cc1..8fce92f 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -14,17 +14,28 @@ $DSC = [IO.Path]::DirectorySeparatorChar $ProjectRoot = Resolve-Path ('{1}{0}..' -f $DSC, $PSScriptRoot) $ModuleRoot = Split-Path (Resolve-Path ('{1}{0}*{0}*.psm1' -f $DSC, $ProjectRoot)) $ModuleName = Split-Path $ModuleRoot -Leaf -$OutputPath = '{1}{0}Tests{0}Data' -f $DSC, $ProjectRoot Import-Module ( '{1}{0}{2}.psm1' -f $DSC, $Script:ModuleRoot, $Script:ModuleName) -Force $Cfg = Import-PowerShellDataFile -Path ('{1}{0}Tests{0}Config.psd1' -f $DSC, $Script:ProjectRoot) -# PS7 on Windows -if (($PSEdition -eq 'Desktop') -and ($PSVersionTable.PSVersion.Major -eq 7)) +if ($PSEdition -eq 'Desktop') { - Import-Module ('{0}\7\Modules\CimCmdlets\CimCmdlets.psd1' -f [Environment]::GetEnvironmentVariable('ProgramFiles')) -Force + $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot, $Cfg.OutputPath.Desktop +} +elseif ($IsWindows -and $PSEdition -eq 'Core') +{ + $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot, $Cfg.OutputPath.CoreW10 + Import-Module ('{0}\PowerShell\7\Modules\CimCmdlets\CimCmdlets.psd1' -f [Environment]::GetEnvironmentVariable('ProgramFiles')) -Force + Import-Module -Name Pester -Force +} +elseif ($IsLinux) +{ + $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot, $Cfg.OutputPath.CoreWSL +} +else +{ + $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot } - if ($Tags -contains { 'IntegrationTest ' -or 'All' }) { if ($IsLinux) @@ -56,12 +67,12 @@ foreach ($Test in $Cfg.Tests) $IVPParams.Add('Show', $Show) $IVPParams.Add('EnableExit', $EnableExit) $IVPParams.Add('Script', ('{1}{0}Tests{0}{2}.Tests.ps1' -f $DSC, $ProjectRoot, $Test.Name)) + $IVPParams.Add('Outputfile', ('{1}{0}{2}.Tests.xml' -f $DSC, $OutputPath, $Test.Name)) switch ($Test) { ( { $PSItem.CodeCoveragePath } ) { $IVPParams.Add('CodeCoverage', ('{1}{0}{2}{0}{3}{0}{4}.ps1' -f $DSC, $ProjectRoot, $ModuleName, $PSItem.CodeCoveragePath, $Test.Name)) - $IVPParams.Add('Outputfile', ('{1}{0}{2}.Tests.xml' -f $DSC, $OutputPath, $Test.Name)) } } Invoke-Pester @IVPParams From 3d8ae926ae039e27458608f5d91ac1689f556722 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 12:11:02 +0200 Subject: [PATCH 106/145] added Remove-UMSAPICookie.Tests.ps --- PSIGEL/Public/Remove-UMSAPICookie.ps1 | 7 +-- Scripts/Test.ps1 | 29 +++++------ Tests/Config.psd1 | 14 ++++++ Tests/Remove-UMSAPICookie.Tests.ps1 | 69 +++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 17 deletions(-) create mode 100644 Tests/Remove-UMSAPICookie.Tests.ps1 diff --git a/PSIGEL/Public/Remove-UMSAPICookie.ps1 b/PSIGEL/Public/Remove-UMSAPICookie.ps1 index 3133599..8ba8702 100644 --- a/PSIGEL/Public/Remove-UMSAPICookie.ps1 +++ b/PSIGEL/Public/Remove-UMSAPICookie.ps1 @@ -44,19 +44,20 @@ function Remove-UMSAPICookie } if ($PSCmdlet.ShouldProcess($Cookie.Value)) { - $Result = (Invoke-UMSRestMethod @Params).Message + $Result = (Invoke-UMSRestMethod @Params) } switch ($Result) { - $null + 'null' { - Write-Verbose $Cookie.Value + $Cookie.Value } Default { Write-Warning ('Could not remove Cookie {0}={1}!' -f $Cookie.Name, $Cookie.Value) } } + #> } End diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index f044a25..c0ab9c4 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -24,21 +24,22 @@ elseif ($PSEdition -eq 'core' -and (-Not $IsWindows) ) $WebSession = New-UMSAPICookie -if ($WebSession) -{ - $PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession - } - #<# - $Result = '' - $Result = Get-UMSDeviceAssignment -Id 505 - #$Result = Get-UMSDevice - #$Result = Get-UMSFirmware - $Result - - Remove-UMSAPICookie #-Verbose - +$PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession } +#<# +#$Result = '' +$Result = Get-UMSDeviceAssignment -Id 505 +#$Result = Get-UMSDevice +#$Result = Get-UMSFirmware +#$Result + +$Result2 = Remove-UMSAPICookie +#$Result2.Gettype() +$Result2 | Get-Member +$Result2.Length + + #> diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index 16ad4c6..9d8947c 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -11,6 +11,11 @@ Tests Config SecurityProtocol = 'Tls12' ProfileRootDirId = 527 # Profiles/PSIGEL DeviceRootDirId = 502 # Devices/PSIGEL + OutputPath = @{ + Desktop = 'Desktop' + CoreW10 = 'CoreW10' + CoreWSL = 'CoreWSL' + } Tests = @( # PSIGEL @@ -1905,5 +1910,14 @@ Tests Config } } } + # Remove-UMSAPICookie + @{ + Name = 'Remove-UMSAPICookie' + Tags = 'UnitTests, IntegrationTests' + CodeCoveragePath = 'Public' + ParameterSets = @{ + Default = @{ } + } + } ) } diff --git a/Tests/Remove-UMSAPICookie.Tests.ps1 b/Tests/Remove-UMSAPICookie.Tests.ps1 new file mode 100644 index 0000000..cf7d232 --- /dev/null +++ b/Tests/Remove-UMSAPICookie.Tests.ps1 @@ -0,0 +1,69 @@ +$Script:ProjectRoot = Resolve-Path ('{0}\..' -f $PSScriptRoot) +$Script:ModuleRoot = Split-Path (Resolve-Path ('{0}\*\*.psm1' -f $Script:ProjectRoot)) +$Script:ModuleName = Split-Path $Script:ModuleRoot -Leaf +$Script:ModuleManifest = Resolve-Path ('{0}/{1}.psd1' -f $Script:ModuleRoot, $Script:ModuleName) +$Script:ScriptName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "") +Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force + +Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { + + Context "Basics" { + + It "Is valid Powershell (Has no script errors)" { + $Content = Get-Content -Path ( '{0}\Public\{1}.ps1' -f $Script:ModuleRoot, $Script:ScriptName) -ErrorAction Stop + $ErrorColl = $Null + $Null = [System.Management.Automation.PSParser]::Tokenize($Content, [ref]$ErrorColl) + $ErrorColl | Should -HaveCount 0 + } + + [object[]]$params = (Get-ChildItem function:\$Script:ScriptName).Parameters.Keys + $KnownParameters = 'Computername', 'TCPPort', 'ApiVersion', 'SecurityProtocol', 'WebSession' + + It "Should contain our specific parameters" { + (@(Compare-Object -ReferenceObject $KnownParameters -DifferenceObject $params -IncludeEqual | + Where-Object SideIndicator -eq "==").Count) | Should Be $KnownParameters.Count + } + } + + <# + No further UnitTesting atm: + https://github.com/pester/Pester/issues/706 - Mocking Classes not supported in Pester + #> +} + +#<# +Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { + $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) + $Credential = Import-Clixml -Path $Cfg.CredPath + + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = $Credential + '*-UMS*:Computername' = $Cfg.Computername + '*-UMS*:TCPPort' = $Cfg.TCPPort + '*-UMS*:SecurityProtocol' = $Cfg.SecurityProtocol + } + + $WebSession = New-UMSAPICookie -Credential $Credential + $PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = $WebSession + } + + Context "ParameterSetName Default" { + + It "doesn't throw" { + { $Script:Result = Remove-UMSAPICookie } | Should Not Throw + } + + It 'Result should not be null or empty' { + $Result | Should not BeNullOrEmpty + } + + It 'Result should have type [String]' { + $Result | Should -HaveType [String] + } + + It "Result.Length should be 32" { + $Result.Length | Should -BeExactly 32 + } + } +} \ No newline at end of file From dbf4059fbe7a6efa3c10c332e144b36f437f5edb Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 12:36:33 +0200 Subject: [PATCH 107/145] Update Test.ps1 --- Scripts/Test.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index c0ab9c4..63b0168 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -38,6 +38,9 @@ $Result2 = Remove-UMSAPICookie #$Result2.Gettype() $Result2 | Get-Member $Result2.Length +#[String] +($WebSession.Cookies.GetCookies('https://igelrmserver').Value) + #> From 56140c844432b0139c5f241775ed3f2c20bab41d Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 16:05:13 +0200 Subject: [PATCH 108/145] edited Testung --- PSIGEL/PSIGEL.psd1 | 26 ++++++++--------- Tests/Config.psd1 | 14 ++++----- Tests/Get-UMSDevice.Tests.ps1 | 29 ++++++++++++++++--- Tests/Get-UMSDeviceAssignment.Tests.ps1 | 11 +++++-- Tests/Get-UMSDeviceDirectory.Tests.ps1 | 13 +++++++-- ...Get-UMSDeviceDirectoryAssignment.Tests.ps1 | 11 +++++-- Tests/Get-UMSDirectoryRecursive.Tests.ps1 | 13 +++++++-- Tests/Get-UMSFirmware.Tests.ps1 | 11 +++++-- Tests/Get-UMSProfile.Tests.ps1 | 11 +++++-- Tests/Get-UMSProfileAssignment.Tests.ps1 | 13 +++++++-- Tests/Get-UMSProfileDirectory.Tests.ps1 | 13 +++++++-- Tests/Get-UMSStatus.Tests.ps1 | 11 +++++-- Tests/Move-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Move-UMSDeviceDirectory.Tests.ps1 | 11 +++++-- Tests/Move-UMSProfile.Tests.ps1 | 11 +++++-- Tests/Move-UMSProfileDirectory.Tests.ps1 | 11 +++++-- Tests/New-UMSAPICookie.Tests.ps1 | 9 +++++- Tests/New-UMSDevice.Tests.ps1 | 11 +++++-- Tests/New-UMSDeviceDirectory.Tests.ps1 | 11 +++++-- Tests/New-UMSProfileAssignment.Tests.ps1 | 11 +++++-- Tests/New-UMSProfileDirectory.Tests.ps1 | 11 +++++-- Tests/Pester.ps1 | 10 +++---- Tests/Pipeline.UMSDevice.Tests.ps1 | 13 +++++++-- Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 | 13 +++++++-- Tests/Pipeline.UMSProfile.Tests.ps1 | 13 +++++++-- Tests/Pipeline.UMSProfileAssignment.Tests.ps1 | 13 +++++++-- Tests/Pipeline.UMSProfileDirectory.Tests.ps1 | 13 +++++++-- Tests/Remove-UMSAPICookie.Tests.ps1 | 9 +++++- Tests/Remove-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Remove-UMSDeviceDirectory.Tests.ps1 | 11 +++++-- Tests/Remove-UMSProfile.Tests.ps1 | 11 +++++-- Tests/Remove-UMSProfileAssignment.Tests.ps1 | 11 +++++-- Tests/Remove-UMSProfileDirectory.Tests.ps1 | 11 +++++-- Tests/Reset-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Restart-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Send-UMSDeviceSetting.Tests.ps1 | 11 +++++-- Tests/Start-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Stop-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Update-UMSDevice.Tests.ps1 | 11 +++++-- Tests/Update-UMSDeviceDirectory.Tests.ps1 | 11 +++++-- Tests/Update-UMSProfile.Tests.ps1 | 11 +++++-- Tests/Update-UMSProfileDirectory.Tests.ps1 | 11 +++++-- 42 files changed, 398 insertions(+), 113 deletions(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index d8e22a6..0cbb2e4 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -9,30 +9,30 @@ @{ # Die diesem Manifest zugeordnete Skript- oder Binaermoduldatei. - RootModule = 'PSIGEL.psm1' + RootModule = 'PSIGEL.psm1' # Die Versionsnummer dieses Moduls - ModuleVersion = '0.10.0' + ModuleVersion = '0.10.0' # Unterstuetzte PSEditions - # CompatiblePSEditions = @() + CompatiblePSEditions = @('Desktop', 'Core') # ID zur eindeutigen Kennzeichnung dieses Moduls - GUID = '4834fbc2-faf6-469c-b685-0195954fd878' + GUID = '4834fbc2-faf6-469c-b685-0195954fd878' # Autor dieses Moduls - Author = 'Falk Heiland' + Author = 'Falk Heiland' # Company or vendor of this module # Urheberrechtserklaerung fuer dieses Modul - Copyright = '(c) 2018 Falk Heiland. Alle Rechte vorbehalten.' + Copyright = '(c) 2018 Falk Heiland. Alle Rechte vorbehalten.' # Beschreibung der von diesem Modul bereitgestellten Funktionen - Description = 'API functions for use with UMS of IGEL TECHNOLOGY' + Description = 'API functions for use with UMS of IGEL TECHNOLOGY' # Die fuer dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls - PowerShellVersion = '5.1' + PowerShellVersion = '5.1' # Der Name des fuer dieses Modul erforderlichen Windows PowerShell-Hosts # PowerShellHostName = '' @@ -68,7 +68,7 @@ # NestedModules = @() # Aus diesem Modul zu exportierende Funktionen. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und loeschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Funktionen vorhanden sind. - FunctionsToExport = @( + FunctionsToExport = @( 'Get-UMSDevice' 'Get-UMSDeviceAssignment' 'Get-UMSDeviceDirectory' @@ -106,13 +106,13 @@ ) # Aus diesem Modul zu exportierende Cmdlets. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und loeschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Cmdlets vorhanden sind. - CmdletsToExport = @() + CmdletsToExport = @() # Die aus diesem Modul zu exportierenden Variablen - VariablesToExport = @() + VariablesToExport = @() # Aus diesem Modul zu exportierende Aliase. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und loeschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Aliase vorhanden sind. - AliasesToExport = @() + AliasesToExport = @() # Aus diesem Modul zu exportierende DSC-Ressourcen # DscResourcesToExport = @() @@ -124,7 +124,7 @@ # FileList = @() # Die privaten Daten, die an das in "RootModule/ModuleToProcess" angegebene Modul uebergeben werden sollen. Diese koennen auch eine PSData-Hashtabelle mit zusaetzlichen von PowerShell verwendeten Modulmetadaten enthalten. - PrivateData = @{ + PrivateData = @{ PSData = @{ diff --git a/Tests/Config.psd1 b/Tests/Config.psd1 index 9d8947c..ee8f82e 100644 --- a/Tests/Config.psd1 +++ b/Tests/Config.psd1 @@ -30,9 +30,9 @@ Tests Config } # New-UMSFilterString @{ - Name = 'New-UMSFilterString' - Tags = 'UnitTests' - CodeCoveragePath = 'Private' + Name = 'New-UMSFilterString' + Tags = 'UnitTests' + #CodeCoveragePath = 'Private' } # New-UMSAPICookie @{ @@ -1912,10 +1912,10 @@ Tests Config } # Remove-UMSAPICookie @{ - Name = 'Remove-UMSAPICookie' - Tags = 'UnitTests, IntegrationTests' - CodeCoveragePath = 'Public' - ParameterSets = @{ + Name = 'Remove-UMSAPICookie' + Tags = 'UnitTests, IntegrationTests' + #CodeCoveragePath = 'Public' + ParameterSets = @{ Default = @{ } } } diff --git a/Tests/Get-UMSDevice.Tests.ps1 b/Tests/Get-UMSDevice.Tests.ps1 index f096ac2..1110bea 100644 --- a/Tests/Get-UMSDevice.Tests.ps1 +++ b/Tests/Get-UMSDevice.Tests.ps1 @@ -449,7 +449,28 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } + } + else + { + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -466,7 +487,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( @@ -504,7 +525,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Details" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Details + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Details It "doesn't throw" { $Params1 = $TestCfg.Params1 @@ -543,7 +564,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Online" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Online + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Online It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDeviceAssignment.Tests.ps1 b/Tests/Get-UMSDeviceAssignment.Tests.ps1 index d52f7ff..00077f4 100644 --- a/Tests/Get-UMSDeviceAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceAssignment.Tests.ps1 @@ -114,7 +114,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -131,7 +138,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDeviceDirectory.Tests.ps1 b/Tests/Get-UMSDeviceDirectory.Tests.ps1 index 96a0802..844bbb1 100644 --- a/Tests/Get-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectory.Tests.ps1 @@ -204,7 +204,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -221,7 +228,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( @@ -259,7 +266,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Children" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Children + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Children It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 index d5cd608..c873fa8 100644 --- a/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 +++ b/Tests/Get-UMSDeviceDirectoryAssignment.Tests.ps1 @@ -114,7 +114,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -131,7 +138,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 index b036762..0e42c84 100644 --- a/Tests/Get-UMSDirectoryRecursive.Tests.ps1 +++ b/Tests/Get-UMSDirectoryRecursive.Tests.ps1 @@ -293,7 +293,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -310,7 +317,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 @@ -346,7 +353,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Element" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Element + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Element It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSFirmware.Tests.ps1 b/Tests/Get-UMSFirmware.Tests.ps1 index 73e8594..9c9531b 100644 --- a/Tests/Get-UMSFirmware.Tests.ps1 +++ b/Tests/Get-UMSFirmware.Tests.ps1 @@ -144,7 +144,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -160,7 +167,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = Get-UMSFirmware } | Should Not Throw diff --git a/Tests/Get-UMSProfile.Tests.ps1 b/Tests/Get-UMSProfile.Tests.ps1 index b32e19d..2469b8d 100644 --- a/Tests/Get-UMSProfile.Tests.ps1 +++ b/Tests/Get-UMSProfile.Tests.ps1 @@ -158,7 +158,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -175,7 +182,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( diff --git a/Tests/Get-UMSProfileAssignment.Tests.ps1 b/Tests/Get-UMSProfileAssignment.Tests.ps1 index bd68090..4d6ab94 100644 --- a/Tests/Get-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Get-UMSProfileAssignment.Tests.ps1 @@ -159,7 +159,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -176,7 +183,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 @@ -211,7 +218,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Directory" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Directory + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Directory It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSProfileDirectory.Tests.ps1 b/Tests/Get-UMSProfileDirectory.Tests.ps1 index 49bc746..64d228f 100644 --- a/Tests/Get-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Get-UMSProfileDirectory.Tests.ps1 @@ -204,7 +204,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -221,7 +228,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = @( @@ -259,7 +266,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Children" { $Script:Result = '' - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Children + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Children It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Get-UMSStatus.Tests.ps1 b/Tests/Get-UMSStatus.Tests.ps1 index fe52ab4..7e7fd74 100644 --- a/Tests/Get-UMSStatus.Tests.ps1 +++ b/Tests/Get-UMSStatus.Tests.ps1 @@ -102,7 +102,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -117,7 +124,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { { $Script:Result = Get-UMSStatus } | Should Not Throw diff --git a/Tests/Move-UMSDevice.Tests.ps1 b/Tests/Move-UMSDevice.Tests.ps1 index edb5733..9788336 100644 --- a/Tests/Move-UMSDevice.Tests.ps1 +++ b/Tests/Move-UMSDevice.Tests.ps1 @@ -118,7 +118,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -134,7 +141,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Move-UMSDeviceDirectory.Tests.ps1 b/Tests/Move-UMSDeviceDirectory.Tests.ps1 index 1b1cafa..1555c7b 100644 --- a/Tests/Move-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Move-UMSDeviceDirectory.Tests.ps1 @@ -118,7 +118,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -135,7 +142,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Move-UMSProfile.Tests.ps1 b/Tests/Move-UMSProfile.Tests.ps1 index ff1dd51..86d2765 100644 --- a/Tests/Move-UMSProfile.Tests.ps1 +++ b/Tests/Move-UMSProfile.Tests.ps1 @@ -117,7 +117,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -134,7 +141,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Move-UMSProfileDirectory.Tests.ps1 b/Tests/Move-UMSProfileDirectory.Tests.ps1 index 5925dcf..815e89d 100644 --- a/Tests/Move-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Move-UMSProfileDirectory.Tests.ps1 @@ -117,7 +117,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -134,7 +141,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSAPICookie.Tests.ps1 b/Tests/New-UMSAPICookie.Tests.ps1 index ed39929..8ef6ce3 100644 --- a/Tests/New-UMSAPICookie.Tests.ps1 +++ b/Tests/New-UMSAPICookie.Tests.ps1 @@ -111,7 +111,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential diff --git a/Tests/New-UMSDevice.Tests.ps1 b/Tests/New-UMSDevice.Tests.ps1 index d0649a2..d2462c9 100644 --- a/Tests/New-UMSDevice.Tests.ps1 +++ b/Tests/New-UMSDevice.Tests.ps1 @@ -120,7 +120,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -136,7 +143,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSDeviceDirectory.Tests.ps1 b/Tests/New-UMSDeviceDirectory.Tests.ps1 index 5050735..58c0698 100644 --- a/Tests/New-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/New-UMSDeviceDirectory.Tests.ps1 @@ -118,7 +118,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -133,7 +140,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSProfileAssignment.Tests.ps1 b/Tests/New-UMSProfileAssignment.Tests.ps1 index 9eb4d3c..782c701 100644 --- a/Tests/New-UMSProfileAssignment.Tests.ps1 +++ b/Tests/New-UMSProfileAssignment.Tests.ps1 @@ -174,7 +174,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -190,7 +197,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/New-UMSProfileDirectory.Tests.ps1 b/Tests/New-UMSProfileDirectory.Tests.ps1 index e399a75..46c09cc 100644 --- a/Tests/New-UMSProfileDirectory.Tests.ps1 +++ b/Tests/New-UMSProfileDirectory.Tests.ps1 @@ -117,7 +117,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -133,7 +140,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 8fce92f..245f971 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -27,6 +27,7 @@ elseif ($IsWindows -and $PSEdition -eq 'Core') $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot, $Cfg.OutputPath.CoreW10 Import-Module ('{0}\PowerShell\7\Modules\CimCmdlets\CimCmdlets.psd1' -f [Environment]::GetEnvironmentVariable('ProgramFiles')) -Force Import-Module -Name Pester -Force + #Import-Module C:\Users\fheiland\Documents\WindowsPowerShell\Modules\Assert\Assert.psd1 } elseif ($IsLinux) { @@ -36,7 +37,7 @@ else { $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot } -if ($Tags -contains { 'IntegrationTest ' -or 'All' }) +if (($Tags -eq 'IntegrationTests') -or ($Tags -eq 'All')) { if ($IsLinux) { @@ -68,12 +69,9 @@ foreach ($Test in $Cfg.Tests) $IVPParams.Add('EnableExit', $EnableExit) $IVPParams.Add('Script', ('{1}{0}Tests{0}{2}.Tests.ps1' -f $DSC, $ProjectRoot, $Test.Name)) $IVPParams.Add('Outputfile', ('{1}{0}{2}.Tests.xml' -f $DSC, $OutputPath, $Test.Name)) - switch ($Test) + if (($Test.CodeCoveragePath) -and ($Tags -ne 'IntegrationTests')) { - ( { $PSItem.CodeCoveragePath } ) - { - $IVPParams.Add('CodeCoverage', ('{1}{0}{2}{0}{3}{0}{4}.ps1' -f $DSC, $ProjectRoot, $ModuleName, $PSItem.CodeCoveragePath, $Test.Name)) - } + $IVPParams.Add('CodeCoverage', ('{1}{0}{2}{0}{3}{0}{4}.ps1' -f $DSC, $ProjectRoot, $ModuleName, $PSItem.CodeCoveragePath, $Test.Name)) } Invoke-Pester @IVPParams } diff --git a/Tests/Pipeline.UMSDevice.Tests.ps1 b/Tests/Pipeline.UMSDevice.Tests.ps1 index f6fd652..a6267c5 100644 --- a/Tests/Pipeline.UMSDevice.Tests.ps1 +++ b/Tests/Pipeline.UMSDevice.Tests.ps1 @@ -7,7 +7,14 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -24,7 +31,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -84,7 +91,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 index 4ce4d0e..cee7fb9 100644 --- a/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Pipeline.UMSDeviceDirectory.Tests.ps1 @@ -7,7 +7,14 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -24,7 +31,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -71,7 +78,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Pipeline.UMSProfile.Tests.ps1 b/Tests/Pipeline.UMSProfile.Tests.ps1 index c746d5e..572b4ec 100644 --- a/Tests/Pipeline.UMSProfile.Tests.ps1 +++ b/Tests/Pipeline.UMSProfile.Tests.ps1 @@ -7,7 +7,14 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -24,7 +31,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $MoveParams = $TestCfg.MoveParams @@ -67,7 +74,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { $Script:Result - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $MoveParams = $TestCfg.MoveParams diff --git a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 index aa094c6..dacde0c 100644 --- a/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 +++ b/Tests/Pipeline.UMSProfileAssignment.Tests.ps1 @@ -7,7 +7,14 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -24,7 +31,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewAssignmentParams = $TestCfg.NewAssignmentParams @@ -65,7 +72,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewAssignmentParams = $TestCfg.NewAssignmentParams diff --git a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 index 7d475b1..160abbb 100644 --- a/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 +++ b/Tests/Pipeline.UMSProfileDirectory.Tests.ps1 @@ -7,7 +7,14 @@ Import-Module ( '{0}/{1}.psm1' -f $Script:ModuleRoot, $Script:ModuleName) -Force Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -24,7 +31,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipeline" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipeline + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipeline It "doesn't throw" { $NewParams = $TestCfg.NewParams @@ -70,7 +77,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ValueFromPipelineByPropertyName" { - $TestCfg = (($Cfg.Tests).where{ $_.IntegrationTests -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.ValueFromPipelineByPropertyName It "doesn't throw" { $NewParams = $TestCfg.NewParams diff --git a/Tests/Remove-UMSAPICookie.Tests.ps1 b/Tests/Remove-UMSAPICookie.Tests.ps1 index cf7d232..17a2821 100644 --- a/Tests/Remove-UMSAPICookie.Tests.ps1 +++ b/Tests/Remove-UMSAPICookie.Tests.ps1 @@ -34,7 +34,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { #<# Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential diff --git a/Tests/Remove-UMSDevice.Tests.ps1 b/Tests/Remove-UMSDevice.Tests.ps1 index 2c075f5..cd780e4 100644 --- a/Tests/Remove-UMSDevice.Tests.ps1 +++ b/Tests/Remove-UMSDevice.Tests.ps1 @@ -170,7 +170,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -187,7 +194,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 index 55b5d71..40b43b2 100644 --- a/Tests/Remove-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Remove-UMSDeviceDirectory.Tests.ps1 @@ -120,7 +120,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -137,7 +144,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfile.Tests.ps1 b/Tests/Remove-UMSProfile.Tests.ps1 index 2ebc379..a70fe05 100644 --- a/Tests/Remove-UMSProfile.Tests.ps1 +++ b/Tests/Remove-UMSProfile.Tests.ps1 @@ -120,7 +120,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -137,7 +144,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfileAssignment.Tests.ps1 b/Tests/Remove-UMSProfileAssignment.Tests.ps1 index b9e8381..93f53a3 100644 --- a/Tests/Remove-UMSProfileAssignment.Tests.ps1 +++ b/Tests/Remove-UMSProfileAssignment.Tests.ps1 @@ -170,7 +170,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -187,7 +194,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Remove-UMSProfileDirectory.Tests.ps1 b/Tests/Remove-UMSProfileDirectory.Tests.ps1 index ed815af..9f2c9b9 100644 --- a/Tests/Remove-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Remove-UMSProfileDirectory.Tests.ps1 @@ -120,7 +120,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -137,7 +144,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Reset-UMSDevice.Tests.ps1 b/Tests/Reset-UMSDevice.Tests.ps1 index 85fd7f7..41dae4c 100644 --- a/Tests/Reset-UMSDevice.Tests.ps1 +++ b/Tests/Reset-UMSDevice.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Restart-UMSDevice.Tests.ps1 b/Tests/Restart-UMSDevice.Tests.ps1 index 12263dd..54f537c 100644 --- a/Tests/Restart-UMSDevice.Tests.ps1 +++ b/Tests/Restart-UMSDevice.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Send-UMSDeviceSetting.Tests.ps1 b/Tests/Send-UMSDeviceSetting.Tests.ps1 index 62c090a..6e4c57b 100644 --- a/Tests/Send-UMSDeviceSetting.Tests.ps1 +++ b/Tests/Send-UMSDeviceSetting.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Start-UMSDevice.Tests.ps1 b/Tests/Start-UMSDevice.Tests.ps1 index e61068a..7d031d7 100644 --- a/Tests/Start-UMSDevice.Tests.ps1 +++ b/Tests/Start-UMSDevice.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Stop-UMSDevice.Tests.ps1 b/Tests/Stop-UMSDevice.Tests.ps1 index 64b758d..aa4f633 100644 --- a/Tests/Stop-UMSDevice.Tests.ps1 +++ b/Tests/Stop-UMSDevice.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSDevice.Tests.ps1 b/Tests/Update-UMSDevice.Tests.ps1 index c16286b..0e89959 100644 --- a/Tests/Update-UMSDevice.Tests.ps1 +++ b/Tests/Update-UMSDevice.Tests.ps1 @@ -146,7 +146,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -163,7 +170,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSDeviceDirectory.Tests.ps1 b/Tests/Update-UMSDeviceDirectory.Tests.ps1 index f7b7614..f30b74b 100644 --- a/Tests/Update-UMSDeviceDirectory.Tests.ps1 +++ b/Tests/Update-UMSDeviceDirectory.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSProfile.Tests.ps1 b/Tests/Update-UMSProfile.Tests.ps1 index 236efb8..9653463 100644 --- a/Tests/Update-UMSProfile.Tests.ps1 +++ b/Tests/Update-UMSProfile.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 diff --git a/Tests/Update-UMSProfileDirectory.Tests.ps1 b/Tests/Update-UMSProfileDirectory.Tests.ps1 index f4cdda0..aa7ed6e 100644 --- a/Tests/Update-UMSProfileDirectory.Tests.ps1 +++ b/Tests/Update-UMSProfileDirectory.Tests.ps1 @@ -128,7 +128,14 @@ Describe "$Script:ScriptName Unit Tests" -Tag 'UnitTests' { Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { $Cfg = Import-PowerShellDataFile -Path ('{0}\Tests\Config.psd1' -f $Script:ProjectRoot) - $Credential = Import-Clixml -Path $Cfg.CredPath + if ($IsLinux) + { + $Credential = Import-Clixml -Path $Cfg.CredPathWsl + } + else + { + $Credential = Import-Clixml -Path $Cfg.CredPath + } $PSDefaultParameterValues = @{ '*-UMS*:Credential' = $Credential @@ -145,7 +152,7 @@ Describe "$Script:ScriptName Integration Tests" -Tag "IntegrationTests" { Context "ParameterSetName Default" { - $TestCfg = (($Cfg.Tests).where{ $_.All -eq $ScriptName }).ParameterSets.Default + $TestCfg = (($Cfg.Tests).where{ $_.Name -eq $ScriptName }).ParameterSets.Default It "doesn't throw" { $Params1 = $TestCfg.Params1 From d87718b7314894fbf46e60f0314905286fe58871 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 16:05:16 +0200 Subject: [PATCH 109/145] Update Test.ps1 --- Scripts/Test.ps1 | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 63b0168..55b6e4c 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -32,22 +32,16 @@ $PSDefaultParameterValues += @{ $Result = Get-UMSDeviceAssignment -Id 505 #$Result = Get-UMSDevice #$Result = Get-UMSFirmware -#$Result - -$Result2 = Remove-UMSAPICookie -#$Result2.Gettype() -$Result2 | Get-Member -$Result2.Length -#[String] -($WebSession.Cookies.GetCookies('https://igelrmserver').Value) - +$Result +$null = Remove-UMSAPICookie #> <# +($WebSession.Cookies.GetCookies('https://igelrmserver').Value) $NewParams = @{ Mac = '0A00000000AA' From 378ea01f2c4622c91c834a0b0c8148c5b2dd25d4 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Thu, 23 Apr 2020 16:05:31 +0200 Subject: [PATCH 110/145] Update Remove-UMSAPICookie.ps1 edited Output handling --- PSIGEL/Public/Remove-UMSAPICookie.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSIGEL/Public/Remove-UMSAPICookie.ps1 b/PSIGEL/Public/Remove-UMSAPICookie.ps1 index 8ba8702..0954eff 100644 --- a/PSIGEL/Public/Remove-UMSAPICookie.ps1 +++ b/PSIGEL/Public/Remove-UMSAPICookie.ps1 @@ -48,7 +48,7 @@ function Remove-UMSAPICookie } switch ($Result) { - 'null' + { 'null' -or $null } { $Cookie.Value } From 98a5374c749a50010ee601e63bf22c33582d9d0d Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 10:08:00 +0200 Subject: [PATCH 111/145] Update Pester.ps1 all test dektop, core w10, core wsl OK --- Tests/Pester.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/Pester.ps1 b/Tests/Pester.ps1 index 245f971..3c743b8 100644 --- a/Tests/Pester.ps1 +++ b/Tests/Pester.ps1 @@ -1,8 +1,8 @@ param ( - [ValidateSet('All', 'UnitTests', 'IntegrationTests')] + [ValidateSet('UnitTests', 'IntegrationTests')] [String] - $Tags = 'UnitTests', + $Tags, [String[]] $Show = ('Header', 'Summary', 'Failed'), @@ -37,7 +37,7 @@ else { $OutputPath = '{1}{0}Tests{0}Data{0}{2}{0}' -f $DSC, $ProjectRoot } -if (($Tags -eq 'IntegrationTests') -or ($Tags -eq 'All')) +if ($Tags -eq 'IntegrationTests') { if ($IsLinux) { @@ -71,7 +71,7 @@ foreach ($Test in $Cfg.Tests) $IVPParams.Add('Outputfile', ('{1}{0}{2}.Tests.xml' -f $DSC, $OutputPath, $Test.Name)) if (($Test.CodeCoveragePath) -and ($Tags -ne 'IntegrationTests')) { - $IVPParams.Add('CodeCoverage', ('{1}{0}{2}{0}{3}{0}{4}.ps1' -f $DSC, $ProjectRoot, $ModuleName, $PSItem.CodeCoveragePath, $Test.Name)) + $IVPParams.Add('CodeCoverage', ('{1}{0}{2}{0}{3}{0}{4}.ps1' -f $DSC, $ProjectRoot, $ModuleName, $Test.CodeCoveragePath, $Test.Name)) } Invoke-Pester @IVPParams } From 7f42920d8ad6de75a31954d84b472c3970470d1b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 13:16:27 +0200 Subject: [PATCH 112/145] Delete IntTestAfter.wsd --- Docs/IntTestAfter.wsd | 324 ------------------------------------------ 1 file changed, 324 deletions(-) delete mode 100644 Docs/IntTestAfter.wsd diff --git a/Docs/IntTestAfter.wsd b/Docs/IntTestAfter.wsd deleted file mode 100644 index 5cb6e31..0000000 --- a/Docs/IntTestAfter.wsd +++ /dev/null @@ -1,324 +0,0 @@ -@startuml before -allow_mixing - -skinparam sequence { - ArrowColor DarkRed -} - -frame Profiles as PRO #LightGrey { - - package PRO_PI as "PSIGEL" #SlateGrey { - - package PRO_PI_Session as "Sessions" #LightGrey { - object PRO_RDP_Session01 { - id = 529 - } - } - - package PRO_PI_Accessories as "Accessories" #LightGrey { - object PRO_Terminal_LocalTerminal { - id = 532 - } - } - - package PRO_PI_UserInterface as "User Interface" #Yellow { - object PRO_LNG_DE #Yellow { - id = 535 - } - } - - package PRO_PI_Network as "Network" #LightGrey { - object PRO_NW_LAN { - id = 537 - } - object PRO_NW_WLAN { - id = 538 - } - } - - package PRO_PI_Devices as "Devices" #Green { - } - - package PRO_PI_Security as "Security" #LightGrey { - object PRO_PW_Root { - id = 540 - } - } - - package PRO_PI_System as "System" #Red { - object PRO_TZ_CET #Red { - id = 542 - } - } - - } - - PRO_RDP_Session01 -down. PRO_Terminal_LocalTerminal - PRO_Terminal_LocalTerminal -down. PRO_LNG_DE - PRO_LNG_DE -down. PRO_NW_LAN - PRO_NW_LAN -down. PRO_NW_WLAN - PRO_NW_WLAN -down. PRO_PW_Root - PRO_PW_Root -down. PRO_TZ_CET - PRO_PI_System -down. PRO_PI_Devices - -} - -frame Devices as DEV #LightGrey { - - package DEV_PI as "PSIGEL" #SlateGrey { - - package DEV_PI_BR as "Bremen" #LightGrey { - - package DEV_PI_BR_HR as "HR" #SlateGrey { - - object 0A0000000001 { - id = 505 - name = BR-HR-001 - mac = 0A0000000001 - } - - object 0A0000000002 { - id = 507 - name = BR-HR-002 - mac = 0A0000000002 - } - - } - - package DEV_PI_BR_MKT as "Marketing" #SlateGrey { - - object 0A0000000003 { - id = 577 - name = BR-MKT-003 - mac = 0A0000000003 - } - - object 0A0000000004 { - id = 576 - name = BR-MKT-004 - mac = 0A0000000004 - } - - } - - package DEV_PI_BR_DEV as "Development" #Yellow { - - object 0A0000000010 #Yellow { - id = - name = DEV_PI_BR_DEV_001 - mac = 0A0000000010 - } - - } - - } - - package DEV_PI_A as "Augsburg" #LightGrey { - - package DEV_PI_A_DEV as "Development" #SlateGrey { - - object 0A0000000005 { - id = 512 - name = A-DEV-005 - mac = 0A0000000005 - } - - object 0A0000000006 { - id = 513 - name = A-DEV-006 - mac = 0A0000000006 - } - - object 0A0000000009 #Yellow { - id = 518 - name = A-DEV-009 - mac = 0A0000000009 - } - - } - - package DEV_PI_A_QA as "QandA" #Green { - - object 0A0000000007 #Green { - id = - name = A-QA-007 - mac = 0A0000000007 - } - - object 0A0000000008 #Green { - id = - name = A-QA-008 - mac = 0A0000000008 - } - - } - - } - - package DEV_PI_L as "Leipzig" #LightGrey { - - package DEV_PI_L_DIS as "Distribution" #Red { - - object 0A0000000011 #Red { - id = 521 - name = L-DIS-011 - mac = 0A0000000011 - } - - object 0A0000000012 #Red { - id = 522 - name = L-DIS-012 - mac = 0A0000000012 - } - - } - - } - } - - 0A0000000001 -down. 0A0000000002 - 0A0000000002 -down. 0A0000000003 - 0A0000000003 -down. 0A0000000004 - 0A0000000004 -down. 0A0000000010 - 0A0000000010 -down. 0A0000000005 - 0A0000000005 -down. 0A0000000006 - 0A0000000006 -down. 0A0000000009 - 0A0000000009 -down. 0A0000000007 - 0A0000000007 -down. 0A0000000008 - 0A0000000008 -down. 0A0000000011 - 0A0000000011 -down. 0A0000000012 - -} - -frame Functions as FUN #LightGrey { - - package FUN_DEV as "Device" #SlateGrey { - - node [NewUMSDevice] - node [RemoveUMSDevice] - node [MoveUMSDevice] - node [UpdateUMSDevice] - node [GetUMSDevice] - - } - - package FUN_DEVDIR as "DeviceDir" #SlateGrey { - - node [NewUMSDeviceDirectory] - node [RemoveUMSDeviceDirectory] - node [MoveUMSDeviceDirectory] - node [UpdateUMSDeviceDirectory] - node [GetUMSDeviceDirectory] - - } - - package FUN_PRO as "Profile" #SlateGrey { - - node [RemoveUMSProfile] - node [MoveUMSProfile] - node [UpdateUMSProfile] - node [GetUMSProfile] - - } - - package FUN_PRODIR as "ProfileDir" #SlateGrey { - - node [NewUMSProfileDirectory] - node [RemoveUMSProfileDirectory] - node [MoveUMSProfileDirectory] - node [UpdateUMSProfileDirectory] - node [GetUMSProfileDirectory] - - } - - package FUN_PROASS as "ProfileAss" #SlateGrey { - - node [NewUMSProfileAssignment] - node [RemoveUMSProfileAssignment] - node [GetUMSProfileAssignment] - node [GetUMSDeviceAssignment] - node [GetUMSDeviceDirectoryAssignment] - - } - - NewUMSDevice -down. RemoveUMSDevice - RemoveUMSDevice -down. MoveUMSDevice - MoveUMSDevice -down. UpdateUMSDevice - UpdateUMSDevice -down. GetUMSDevice - GetUMSDevice -down. NewUMSDeviceDirectory - NewUMSDeviceDirectory -down. RemoveUMSDeviceDirectory - RemoveUMSDeviceDirectory -down. MoveUMSDeviceDirectory - MoveUMSDeviceDirectory -down. UpdateUMSDeviceDirectory - UpdateUMSDeviceDirectory -down. GetUMSDeviceDirectory - GetUMSDeviceDirectory -down. RemoveUMSProfile - RemoveUMSProfile -down. MoveUMSProfile - MoveUMSProfile -down. UpdateUMSProfile - UpdateUMSProfile -down. GetUMSProfile - GetUMSProfile -down. NewUMSProfileDirectory - NewUMSProfileDirectory -down. RemoveUMSProfileDirectory - RemoveUMSProfileDirectory -down. MoveUMSProfileDirectory - MoveUMSProfileDirectory -down. UpdateUMSProfileDirectory - UpdateUMSProfileDirectory -down. GetUMSProfileDirectory - GetUMSProfileDirectory -down. NewUMSProfileAssignment - NewUMSProfileAssignment -down. RemoveUMSProfileAssignment - RemoveUMSProfileAssignment -down. GetUMSProfileAssignment - GetUMSProfileAssignment -down. GetUMSDeviceAssignment - GetUMSDeviceAssignment -down. GetUMSDeviceDirectoryAssignment - -} - -PRO_RDP_Session01 -right-+ DEV_PI -PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV -PRO_Terminal_LocalTerminal -right-+ DEV_PI_BR_DEV -PRO_LNG_DE -right-+ DEV_PI -PRO_NW_LAN -right-+ DEV_PI_BR -PRO_NW_WLAN -right-+ DEV_PI_BR_DEV -PRO_PW_Root -right-+ DEV_PI - -'New -NewUMSDeviceDirectory -right-> DEV_PI_A_QA : 01 - New-UMSDeviceDirectory -NewUMSDevice -right-> 0A0000000007 : 02 - New-UMSDevice -NewUMSDevice -right-> 0A0000000008 : 03 - New-UMSDevice -NewUMSProfileDirectory -right-> PRO_PI_Devices : 04 - New-UMSProfileDirectory -PRO_NW_WLAN -right-> NewUMSProfileAssignment : 05 - NewUMSProfileAssignment tc -NewUMSProfileAssignment -right-+ 0A0000000003 : 05 - NewUMSProfileAssignment tc -PRO_NW_WLAN -right-> NewUMSProfileAssignment : 06 - NewUMSProfileAssignment tcdir -NewUMSProfileAssignment -right-+ DEV_PI_BR_HR : 06 - NewUMSProfileAssignment tcdir - -'Remove -RemoveUMSDevice -right-> 0A0000000011 : 07 - Remove-UMSDevice -RemoveUMSDevice -right-> 0A0000000012 : 08 - Remove-UMSDevice -RemoveUMSDeviceDirectory -right-> DEV_PI_L_DIS : 09 - Remove-UMSDeviceDirectory -RemoveUMSProfile -right-> PRO_TZ_CET : 10 - Remove-UMSProfile -RemoveUMSProfileDirectory -right-> PRO_PI_System : 11 - Remove-UMSProfileDirectory -DEV_PI -right-> RemoveUMSProfileAssignment : 12 - Remove-UMSProfileAssignment tcdir -RemoveUMSProfileAssignment -right-> PRO_TZ_CET : 12 - Remove-UMSProfileAssignment tcdir -0A0000000001 -right-> RemoveUMSProfileAssignment : 13 - Remove-UMSProfileAssignment tc -RemoveUMSProfileAssignment -right-> PRO_PW_Root : 13 - Remove-UMSProfileAssignment tc - -'Move -MoveUMSDevice -right-> 0A0000000009 : 14 - Move-UMSDevice -MoveUMSDeviceDirectory -right-> DEV_PI_A_QA: 15 - Move-UMSDeviceDirectory DEV_PI_A_QA -MoveUMSDeviceDirectory -right-> DEV_PI_BR_DEV: 15 - Move-UMSDeviceDirectory DEV_PI_L_DEV -MoveUMSProfile -right-> PRO_LNG_DE : 16 - Move-UMSProfile -MoveUMSProfileDirectory -right-> PRO_PI_UserInterface : 17 - Move-UMSProfileDirectory - -'Update -UpdateUMSDeviceDirectory -right-> DEV_PI_BR_DEV : 18 - Update-UMSDeviceDirectory -UpdateUMSDevice -right-> 0A0000000010 : 19 - Update-UMSDevice -UpdateUMSDevice -right-> 0A0000000009 : 20 - Update-UMSDevice -UpdateUMSProfile -right-> PRO_LNG_DE : 21 - Update- UMSProfile PRO_NW_LNG_DE -UpdateUMSProfileDirectory -right-> PRO_PI_UserInterface : 22 - PRO_PI_Network_UserInterface - -'Get -GetUMSDevice -right-> DEV : 23 - Get-UMSDevice -GetUMSDevice -right-> 0A0000000001 : 24 - Get-UMSDevice -GetUMSDeviceDirectory -right-> DEV : 25 - Get-UMSDeviceDirectory -GetUMSProfile -right-> PRO : 26 - GetUMSProfile -GetUMSProfileDirectory -right-> PRO : 27 - Get-UMSProfileDirectory -GetUMSProfileAssignment -right-> PRO_RDP_Session01 : 28 - Get-UMSProfileAssignment Device -GetUMSProfileAssignment -right-> PRO_RDP_Session01 : 29 - Get-UMSProfileAssignment Directory -GetUMSDeviceAssignment -right-> 0A0000000001 : 30 - Get-UMSDeviceAssignment -GetUMSDeviceDirectoryAssignment -right-> DEV_PI_BR : 31 - Get-UMSDeviceDirectoryAssignment - -@enduml \ No newline at end of file From 42f18f1634a4325665c887f33cf0d9c968547ce5 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 13:16:29 +0200 Subject: [PATCH 113/145] Delete IntTestBefore.wsd --- Docs/IntTestBefore.wsd | 186 ----------------------------------------- 1 file changed, 186 deletions(-) delete mode 100644 Docs/IntTestBefore.wsd diff --git a/Docs/IntTestBefore.wsd b/Docs/IntTestBefore.wsd deleted file mode 100644 index c51ea56..0000000 --- a/Docs/IntTestBefore.wsd +++ /dev/null @@ -1,186 +0,0 @@ -@startuml before -allow_mixing - -skinparam sequence { - ArrowColor DarkRed -} - -frame Profiles as PRO #LightGrey { - - package PRO_PI as "PSIGEL" #SlateGrey { - - package PRO_PI_Session as "Sessions" #LightGrey { - object PRO_RDP_Session01 { - id = 529 - } - } - - package PRO_PI_Accessories as "Accessories" #LightGrey { - object PRO_Terminal_LocalTerminal { - id = 532 - } - } - - package PRO_PI_Network as "Network" #LightGrey { - package PRO_PI_Network_UserInterface as "Network User Interface" #SlateGrey { - } - object PRO_LNG_DE { - id = 535 - } - object PRO_NW_LAN { - id = 537 - } - object PRO_NW_WLAN { - id = 538 - } - } - - package PRO_PI_Security as "Security" #LightGrey { - object PRO_PW_Root { - id = 540 - } - } - - package PRO_PI_System as "System" #LightGrey { - object PRO_TZ_CET { - id = 542 - } - } - - } - - PRO_RDP_Session01 -down. PRO_Terminal_LocalTerminal - PRO_Terminal_LocalTerminal -down. PRO_PI_Network_UserInterface - PRO_PI_Network_UserInterface -down. PRO_LNG_DE - PRO_LNG_DE -down. PRO_NW_LAN - PRO_NW_LAN -down. PRO_NW_WLAN - PRO_NW_WLAN -down. PRO_PW_Root - PRO_PW_Root -down. PRO_TZ_CET - -} - -frame Devices as DEV #LightGrey { - - package DEV_PI as "PSIGEL" #SlateGrey { - - package DEV_PI_BR as "Bremen" #LightGrey { - - package DEV_PI_BR_HR as "HR" #SlateGrey { - - object 0A0000000001 { - id = 505 - name = BR-HR-001 - mac = 0A0000000001 - } - - object 0A0000000002 { - id = 507 - name = BR-HR-002 - mac = 0A0000000002 - } - - } - - package DEV_PI_BR_MKT as "Marketing" #SlateGrey { - - object 0A0000000003 { - id = 509 - name = BR-MKT-003 - mac = 0A0000000003 - } - - object 0A0000000004 { - id = 510 - name = BR-MKT-004 - mac = 0A0000000004 - } - - } - - } - - package DEV_PI_A as "Augsburg" #LightGrey { - - package DEV_PI_A_DEV as "Development" #SlateGrey { - - object 0A0000000005 { - id = 512 - name = A-DEV-005 - mac = 0A0000000005 - } - - object 0A0000000006 { - id = 513 - name = A-DEV-006 - mac = 0A0000000006 - } - - } - - } - - package DEV_PI_L as "Leipzig" #LightGrey { - - package DEV_PI_L_DEV as "Development" #SlateGrey { - - object 0A0000000009 { - id = 518 - name = L-DEV-009 - mac = 0A0000000009 - } - - object 0A0000000010 { - id = 519 - name = L-DEV-010 - mac = 0A0000000010 - } - - } - - package DEV_PI_L_DIS as "Distribution" #SlateGrey { - - object 0A0000000011 { - id = 521 - name = L-DIS-011 - mac = 0A0000000011 - } - - object 0A0000000012 { - id = 522 - name = L-DIS-012 - mac = 0A0000000012 - } - - } - - } - } - - 0A0000000001 -down. 0A0000000002 - 0A0000000002 -down. 0A0000000003 - 0A0000000003 -down. 0A0000000004 - 0A0000000004 -down. 0A0000000005 - 0A0000000005 -down. 0A0000000006 - 0A0000000006 -down. 0A0000000009 - 0A0000000009 -down. 0A0000000010 - 0A0000000010 -down. 0A0000000011 - 0A0000000011 -down. 0A0000000012 - -} - - -PRO -right. DEV - -PRO_RDP_Session01 -right-+ DEV_PI -PRO_Terminal_LocalTerminal -right-+ DEV_PI_A_DEV -PRO_Terminal_LocalTerminal -right-+ DEV_PI_L_DEV -PRO_LNG_DE -right-+ DEV_PI -PRO_NW_LAN -right-+ DEV_PI_BR -PRO_NW_WLAN -right-+ 0A0000000001 -PRO_NW_WLAN -right-+ DEV_PI_L_DEV -PRO_PW_Root -right-+ DEV_PI -PRO_TZ_CET -right-+ DEV_PI - - - -@enduml \ No newline at end of file From 786bff59667b3cba3e5fe54695f92431d6e18735 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 13:16:31 +0200 Subject: [PATCH 114/145] Delete Untitled-1.wsd --- Docs/Untitled-1.wsd | 249 -------------------------------------------- 1 file changed, 249 deletions(-) delete mode 100644 Docs/Untitled-1.wsd diff --git a/Docs/Untitled-1.wsd b/Docs/Untitled-1.wsd deleted file mode 100644 index cf50500..0000000 --- a/Docs/Untitled-1.wsd +++ /dev/null @@ -1,249 +0,0 @@ -@startuml before -allow_mixing - -frame Profiles as PRO { - - package PRO_PI as "PSIGEL" { - - package PRO_PI_Session as "Sessions" { - - folder PRO_PI_Session_RDP as "RDP" { - node [PRO_RDP_Session01] - } - } - - package PRO_PI_Accessories as "Accessories" { - } - - package PRO_PI_UserInterface as "User Interface" { - - folder PRO_PI_UserInterface_Language as "Language" { - node [PRO_LNG_DE] - node [PRO_LNG_US] - node [PRO_LNG_JP] - - } - - } - - package PRO_PI_Network as "Network" { - - package PRO_PI_Network_LANInterfaces as "LAN Interfaces" { - node [PRO_NW_LAN] - node [PRO_NW_WLAN] - } - - } - - package PRO_PI_Devices as "Devices" { - } - - package PRO_PI_Security as "Security" { - } - - package PRO_PI_System as "System" { - - package PRO_PI_System_TimeAndDate as "Time and Date" { - node [PRO_TZ_CET] - node [PRO_TZ_EST] - node [PRO_TZ_PST] - node [PRO_TZ_JST] - } - - } - - } - -} - -frame Devices as DEV { - - package DEV_PI as "PSIGEL" { - - package DEV_PI_BR as "Bremen" { - - package DEV_PI_BR_HR as "HR" { - - object 0A0000000001 { - id = - name = DEV_PI_B_HR_001 - mac = 0A0000000001 - } - - object 0A0000000002 { - id = - name = DEV_PI_B_HR_002 - mac = 0A0000000002 - } - - } - - package DEV_PI_BR_MKT as "Marketing" { - - object 0A0000000003 { - id = - name = DEV_PI_BR_MKT_001 - mac = 0A0000000003 - } - - object 0A0000000004 { - id = - name = DEV_PI_BR_MKT_002 - mac = 0A0000000004 - } - - } - - } - - package DEV_PI_A as "Augsburg" { - - package DEV_PI_A_DEV as "DEV" { - - object 0A0000000005 { - id = - name = DEV_PI_A_DEV_001 - mac = 0A0000000005 - } - - object 0A0000000006 { - id = - name = DEV_PI_A_DEV_002 - mac = 0A0000000006 - } - - } - - package DEV_PI_A_QA as "QandA" { - - object 0A0000000007 { - id = - name = DEV_PI_A_QA_001 - mac = 0A0000000007 - } - - object 0A0000000008 { - id = - name = DEV_PI_A_QA_002 - mac = 0A0000000008 - } - - } - - } - - package DEV_PI_L as "Leipzig" { - - package DEV_PI_L_DEV as "DEV" { - - object 0A0000000009 { - id = - name = DEV_PI_L_DEV_001 - mac = 0A0000000009 - } - - object 0A0000000010 { - id = - name = DEV_PI_L_DEV_002 - mac = 0A0000000010 - } - - } - - package DEV_PI_L_DIS as "Distribution" { - - object 0A0000000011 { - id = - name = DEV_PI_L_DIS_001 - mac = 0A0000000011 - } - - object 0A0000000012 { - id = - name = DEV_PI_L_DIS_002 - mac = 0A0000000012 - } - - } - - } - } - -} - -frame Function as FUN { - - package FUN_Get as "Get" { - node [Get-UMSDevice] as FUN_Get_UD - node [Get-UMSDeviceDirectory] as FUN_Get_UDD - node [Get-UMSProfile] as FUN_Get_UP - node [Get-UMSProfileDirectory] as FUN_Get_UPD - } - - package FUN_New as "New" { - node [New-UMSDevice] as FUN_New_UD - node [New-UMSDeviceDirectory] as FUN_New_UDD - node [New-UMSProfileDirectory] as FUN_New_UPD - } - - package FUN_Move as "Move" { - node [Move-UMSDevice] as FUN_Move_UD - node [Move-UMSDeviceDirectory] as FUN_Move_UDD - node [Move-UMSProfile] as FUN_Move_UP - node [Move-UMSProfileDirectory] as FUN_Move_UPD - } - - package FUN_Update as "Update" { - node [Update-UMSDevice] as FUN_Update_UD - node [Update-UMSDeviceDirectory] as FUN_Update_UDD - node [Update-UMSProfile] as FUN_Update_UP - node [Update-UMSProfileDirectory] as FUN_Update_UPD - } - - package FUN_Remove as "Remove" { - node [Remove-UMSDevice] as FUN_Remove_UD - node [Remove-UMSDeviceDirectory] as FUN_Remove_UDD - node [Remove-UMSProfile] as FUN_Remove_UP - node [Remove-UMSProfileDirectory] as FUN_Remove_UPD - } - -} - -FUN_Get_UD -down. FUN_Get_UDD -FUN_Get_UDD -down. FUN_Get_UP -FUN_Get_UP -down. FUN_Get_UPD -FUN_Get_UPD -down. FUN_New_UD -FUN_New_UD -down. FUN_New_UDD -FUN_New_UDD -down. FUN_New_UPD -FUN_New_UPD -down. FUN_Move_UD -FUN_Move_UD -down. FUN_Move_UDD -FUN_Move_UDD -down. FUN_Move_UP -FUN_Move_UP -down. FUN_Move_UPD -FUN_Move_UPD -down. FUN_Update_UD -FUN_Update_UD -down. FUN_Update_UDD -FUN_Update_UDD -down. FUN_Update_UP -FUN_Update_UP -down. FUN_Update_UPD -FUN_Update_UPD -down. FUN_Remove_UD -FUN_Remove_UD -down. FUN_Remove_UDD -FUN_Remove_UDD -down. FUN_Remove_UP -FUN_Remove_UP -down. FUN_Remove_UPD - -FUN_Remove_UD -down-|> 0A0000000011 : 1. -FUN_Remove_UD -down-|> 0A0000000012 -FUN_Remove_UDD -down-|> DEV_PI_L_DIS - -FUN_Move_UD -down-|> 0A0000000009 -0A0000000009 -right-> DEV_PI_A_DEV - -FUN_Move_UDD -down-|> DEV_PI_L_DEV -DEV_PI_L_DEV -right-> DEV_PI_BR -/' - -FUN_Move_UDD -down-|> -FUN_Remove_UP -down-|> -FUN_Move_UPD -down-|> -FUN_Remove_UP -down-|> PRO_RDP_Session01 -FUN_Remove_UPD -down-|> PRO_PI_Session_RDP -'/ - -@enduml \ No newline at end of file From e25fb3f43cdfa458670b874ad9cac9bd6b243ec7 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 13:16:34 +0200 Subject: [PATCH 115/145] Create workflows.test.yml --- .github/workflows.test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows.test.yml diff --git a/.github/workflows.test.yml b/.github/workflows.test.yml new file mode 100644 index 0000000..da288fd --- /dev/null +++ b/.github/workflows.test.yml @@ -0,0 +1,33 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [master] + pull_request: + branches: [master] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + echo Add other actions to build, + echo test, and deploy your project. From 6a42d2c778424c92c1b9c3db9fa955e5cb90242b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 13:18:44 +0200 Subject: [PATCH 116/145] Delete workflows.test.yml --- .github/workflows.test.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .github/workflows.test.yml diff --git a/.github/workflows.test.yml b/.github/workflows.test.yml deleted file mode 100644 index da288fd..0000000 --- a/.github/workflows.test.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: CI - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [master] - pull_request: - branches: [master] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! - - # Runs a set of commands using the runners shell - - name: Run a multi-line script - run: | - echo Add other actions to build, - echo test, and deploy your project. From 078e980c09dbfba00fd71c1b586995be43507e7f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Fri, 24 Apr 2020 13:18:46 +0200 Subject: [PATCH 117/145] Create test.yml --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..da288fd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [master] + pull_request: + branches: [master] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + echo Add other actions to build, + echo test, and deploy your project. From 8fe15fe3dbff4ef39cad4c501d776803cfd1feda Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sat, 25 Apr 2020 21:12:15 +0200 Subject: [PATCH 118/145] updated documentation --- Docs/Functions.md | 139 ++++++++++++++++++++++++++++++++++++++++ README.MD | 158 +++++++++++++++++++--------------------------- 2 files changed, 203 insertions(+), 94 deletions(-) create mode 100644 Docs/Functions.md diff --git a/Docs/Functions.md b/Docs/Functions.md new file mode 100644 index 0000000..1cad3dd --- /dev/null +++ b/Docs/Functions.md @@ -0,0 +1,139 @@ +# Functions + +Follow the links to get to the documentation of a specific function. + +## [Get-UMSDevice](Get-UMSDevice.md) + +Gets information on a device. + +## [Get-UMSDeviceAssignment](Get-UMSDeviceAssignment.md) + +Gets information on a profile or master profile assignment of a device. + +## [Get-UMSDeviceDirectory](Get-UMSDeviceDirectory.md) + +Gets information on a device directory. + +## [Get-UMSDeviceDirectoryAssignment](Get-UMSDeviceDirectoryAssignment.md) + +Gets information on a profile or master profile assignment of a device directory. + +## [Get-UMSDirectoryRecursive](Get-UMSDirectoryRecursive.md) + +Gets either all directory or element ids from below given directory id. + +## [Get-UMSFirmware](Get-UMSFirmware.md) + +Gets information on a firmware. + +## [Get-UMSProfile](Get-UMSProfile.md) + +Gets information on a profile. + +## [Get-UMSProfileAssignment](Get-UMSProfileAssignment.md) + +Gets information on a device or device directory assignment of a profile. + +## [Get-UMSProfileDirectory](Get-UMSProfileDirectory.md) + +Gets information on a profile directory. + +## [Get-UMSStatus](Get-UMSStatus.md) + +Gets information on the UMS. + +## [Move-UMSDevice](Move-UMSDevice.md) + +Moves a device to a device directory. + +## [Move-UMSDeviceDirectory](Move-UMSDeviceDirectory.md) + +Moves a device directory to a device directory. + +## [Move-UMSProfile](Move-UMSProfile.md) + +Moves a profile to a profile directory. + +## [Move-UMSProfileDirectory](Move-UMSProfileDirectory.md) + +Moves a profile directory to profile directory. + +## [New-UMSAPICookie](New-UMSAPICookie.md) + +Creates a websession cookie. + +## [New-UMSDevice](New-UMSDevice.md) + +Creates a new device. + +## [New-UMSDeviceDirectory](New-UMSDeviceDirectory.md) + +Creates a device directory. + +## [New-UMSProfileAssignment](New-UMSProfileAssignment.md) + +Creates a profile assignment on a device or device directory. + +## [New-UMSProfileDirectory](New-UMSProfileDirectory.md) + +Creates a profile directory. + +## [Remove-UMSAPICookie](Remove-UMSAPICookie.md) + +Removes the active websession cookie. + +## [Remove-UMSDevice](Remove-UMSDevice.md) + +Removes a device. + +## [Remove-UMSDeviceDirectory](Remove-UMSDeviceDirectory.md) + +Removes a device directory. + +## [Remove-UMSProfile](Remove-UMSProfile.md) + +Removes a profile. + +## [Remove-UMSProfileAssignment](Remove-UMSProfileAssignment.md) + +Removes a profile assignment from a device or device directory. + +## [Remove-UMSProfileDirectory](Remove-UMSProfileDirectory.md) + +Removes a profile directory. + +## [Reset-UMSDevice](Reset-UMSDevice.md) + +Resets a device to factory defaults. + +## [Restart-UMSDevice](Restart-UMSDevice.md) + +Restarts a device. + +## [Send-UMSDeviceSetting](Send-UMSDeviceSetting.md) + +Sends settings to a device. + +## [Start-UMSDevice](Start-UMSDevice.md) + +Wakes up a device. + +## [Stop-UMSDevice](Stop-UMSDevice.md) + +Shuts down a device. + +## [Update-UMSDevice](Update-UMSDevice.md) + +Updates properties of a device. + +## [Update-UMSDeviceDirectory](Update-UMSDeviceDirectory.md) + +Updates the name of a device directory. + +## [Update-UMSProfile](Update-UMSProfile.md) + +Updates the name of a profile. + +## [Update-UMSProfileDirectory](Update-UMSProfileDirectory.md) + +Updates the name of a profile directory. \ No newline at end of file diff --git a/README.MD b/README.MD index 1877887..0b48979 100644 --- a/README.MD +++ b/README.MD @@ -1,126 +1,96 @@ +# PSIGEL + +![MIT licensed](https://img.shields.io/github/license/IGEL-Community/PSIGEL?logo=github) +![GitHub last commit](https://img.shields.io/github/last-commit/IGEL-Community/PSIGEL?logo=github) +![GitHub release (latest by date)](https://img.shields.io/github/v/release/IGEL-Community/PSIGEL?logo=github) +![PowerShell Gallery Version](https://img.shields.io/powershellgallery/v/PSIGEL?logo=powershell) +![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/PSIGEL?logo=powershell) +![GitHub stars](https://img.shields.io/github/stars/IGEL-Community/PSIGEL?logo=github) +![IGEL-Community Slack](https://img.shields.io/badge/chat-IGEL%20Community-brightgreen?logo=slack&link=https://igelcommunity.slack.com/archives/C9XFWLXA8&link=https://igelcommunity.slack.com/archives/C9XFWLXA8) ![Logo](PSIGEL_1280_320.png) -**PSIGEL** is a module to interact with the IGEL UMS via API. +Table of contents: -Currently the module only supports PowerShell version **5.1** . +- [Overview](#overview) +- [Prerequisites](#prerequisites) +- [Installation](#installation) +- [Getting Started](#getting-started) +- [Documentation](#documentation) +- [Maintainer](#maintainer) +- [License](#license) -**API** functions got the noun-prefix **UMS** (for Universal Management Server), e.g. Get-**UMS**Something +## Overview -The **API** uses a cookie as authentication. You can create it with [New-UMSAPICookie](/Docs/New-UMSAPICookie.md): +**PSIGEL** is a module to interact with the IGEL UMS via API. -```powershell -$Websession = New-UMSAPICookie -Computername igelrmserver -``` +All functions got the noun-prefix **UMS** (Universal Management Server), e.g. Get-**UMS**Something . -My goal is to support all [API-functionalities](https://kb.igel.com/igelimi-v3/en/imi-api-v3-reference-2723425.html) IGEL provides. Use at own risk! Suggestions are welcome. +## Prerequisites + +|OS|min. PS Version (Edition)| +|-|-| +|Windows|5.1 (Desktop)\*| +|Windows|7 (Core)\*| +|Linux|7 (Core)\*| +|MacOS|7 (Core)| + +\* tested ## Installation If you have the [PowerShellGet](https://github.com/powershell/powershellget) module installed you can enter the following command: ```powershell -Install-Module -Name PSIGEL +C:\> Install-Module -Name PSIGEL ``` Alternatively you can download a ZIP file of the latest version from our [Releases](https://github.com/IGEL-Community/PSIGEL/releases) page. -## PSIGEL Cmdlets - -### [Get-UMSDevice](/Docs/Get-UMSDevice.md) -Gets information on a device. - -### [Get-UMSDeviceAssignment](/Docs/Get-UMSDeviceAssignment.md) -Gets information on a profile or master profile assignment of a device. - -### [Get-UMSDeviceDirectory](/Docs/Get-UMSDeviceDirectory.md) -Gets information on a device directory. - -### [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) -Gets information on a profile or master profile assignment of a device directory. - -### [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md) -Gets either all directory or element ids from below given directory id. - -### [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) -Gets information on a firmware. - -### [Get-UMSProfile](/Docs/Get-UMSProfile.md) -Gets information on a profile. - -### [Get-UMSProfileAssignment](/Docs/Get-UMSProfileAssignment.md) -Gets information on a device or device directory assignment of a profile. - -### [Get-UMSProfileDirectory](/Docs/Get-UMSProfileDirectory.md) -Gets information on a profile directory. - -### [Get-UMSStatus](/Docs/Get-UMSStatus.md) -Gets information on the UMS. +## Getting Started -### [Move-UMSDevice](/Docs/Move-UMSDevice.md) -Moves a device to a device directory. +Import Module: -### [Move-UMSDeviceDirectory](/Docs/Move-UMSDeviceDirectory.md) -Moves a device directory to a device directory. - -### [Move-UMSProfile](/Docs/Move-UMSProfile.md) -Moves a profile to a profile directory. - -### [Move-UMSProfileDirectory](/Docs/Move-UMSProfileDirectory.md) -Moves a profile directory to profile directory. - -### [New-UMSAPICookie](/Docs/New-UMSAPICookie.md) -Creates a websession cookie. - -### [New-UMSDevice](/Docs/New-UMSDevice.md) -Creates a new device. - -### [New-UMSDeviceDirectory](/Docs/New-UMSDeviceDirectory.md) -Creates a device directory. - -### [New-UMSProfileAssignment](/Docs/New-UMSProfileAssignment.md) -Creates a profile assignment on a device or device directory. - -### [New-UMSProfileDirectory](/Docs/New-UMSProfileDirectory.md) -Creates a profile directory. - -### [Remove-UMSDevice](/Docs/Remove-UMSDevice.md) -Removes a device. +```powershell +C:\> Import-Module -Name PSIGEL +``` -### [Remove-UMSDeviceDirectory](/Docs/Remove-UMSDeviceDirectory.md) -Removes a device directory. +Create a WebSession -### [Remove-UMSProfile](/Docs/Remove-UMSProfile.md) -Removes a profile. +```powershell +C:\> $WebSession = New-UMSAPICookie -Computername igelrmserver -Credential (Get-Credential) +``` -### [Remove-UMSProfileAssignment](/Docs/Remove-UMSProfileAssignment.md) -Removes a profile assignment from a device or device directory. +Call a Function - e.g. get status information from the UMS server: -### [Remove-UMSProfileDirectory](/Docs/Remove-UMSProfileDirectory.md) -Removes a profile directory. +```powershell +C:\> Get-UMSStatus -Computername igelrmserver -WebSession $WebSession + +RmGuiServerVersion : 6.3.130 +BuildNumber : 44584 +ActiveMqVersion : 5.7.0 +DerbyVersion : 10.12.1.1 +ServerUuid : f30fb3a2-37d4-4cbb-b884-4f5061d3260e +Server : igelrmserver:8443 +``` -### [Reset-UMSDevice](/Docs/Reset-UMSDevice.md) -Resets a device to factory defaults. +Remove WebSession: -### [Restart-UMSDevice](/Docs/Restart-UMSDevice.md) -Restarts a device. +```powershell +C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSession +``` -### [Send-UMSDeviceSetting](/Docs/Send-UMSDeviceSetting.md) -Sends settings to a device. +## Documentation -### [Start-UMSDevice](/Docs/Start-UMSDevice.md) -Wakes up a device. +You can learn how to use PSIGEL by reading our documentation: -### [Stop-UMSDevice](/Docs/Stop-UMSDevice.md) -Shuts down a device. +- [Functions](docs/en-US/Functions.md) -### [Update-UMSDevice](/Docs/Update-UMSDevice.md) -Updates properties of a device. +## Maintainer -### [Update-UMSDeviceDirectory](/Docs/Update-UMSDeviceDirectory.md) -Updates the name of a device directory. +- Falk Heiland +![https://github.com/falkheiland](https://img.shields.io/badge/github-black?logo=github&link=https://github.com/falkheiland&link=https://github.com/falkheiland) +![http://twitter.com/falkheiland](https://img.shields.io/badge/twitter-black?logo=twitter&link=http://twitter.com/falkheiland&link=http://twitter.com/falkheiland) -### [Update-UMSProfile](/Docs/Update-UMSProfile.md) -Updates the name of a profile. +## License -### [Update-UMSProfileDirectory](/Docs/Update-UMSProfileDirectory.md) -Updates the name of a profile directory. \ No newline at end of file +This project is [licensed under the MIT License](LICENSE). \ No newline at end of file From 13dc5421db8e767bf5973dfb03fba24c982a8ccc Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 26 Apr 2020 13:38:59 +0200 Subject: [PATCH 119/145] edited README.md --- README.MD | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/README.MD b/README.MD index 0b48979..4e97b44 100644 --- a/README.MD +++ b/README.MD @@ -1,12 +1,13 @@ # PSIGEL -![MIT licensed](https://img.shields.io/github/license/IGEL-Community/PSIGEL?logo=github) -![GitHub last commit](https://img.shields.io/github/last-commit/IGEL-Community/PSIGEL?logo=github) -![GitHub release (latest by date)](https://img.shields.io/github/v/release/IGEL-Community/PSIGEL?logo=github) -![PowerShell Gallery Version](https://img.shields.io/powershellgallery/v/PSIGEL?logo=powershell) -![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/PSIGEL?logo=powershell) -![GitHub stars](https://img.shields.io/github/stars/IGEL-Community/PSIGEL?logo=github) -![IGEL-Community Slack](https://img.shields.io/badge/chat-IGEL%20Community-brightgreen?logo=slack&link=https://igelcommunity.slack.com/archives/C9XFWLXA8&link=https://igelcommunity.slack.com/archives/C9XFWLXA8) +[![GitHub last commit][github-commit-badge]][github-psigel] +[![GitHub release (latest by date)][github-release-badge]][github-psigel] +[![PowerShell Gallery Version][psgallery-v-badge]][powershell-gallery] +[![PS Gallery][psgallery-dl-badge]][powershell-gallery] +[![GitHub stars][github-start-badge]][github-psigel] +[![IGEL-Community Slack][slack-badge]][slack-igelcommunity] + + ![Logo](PSIGEL_1280_320.png) Table of contents: @@ -83,14 +84,32 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess You can learn how to use PSIGEL by reading our documentation: -- [Functions](docs/en-US/Functions.md) +- [Functions](docs/Functions.md) ## Maintainer -- Falk Heiland -![https://github.com/falkheiland](https://img.shields.io/badge/github-black?logo=github&link=https://github.com/falkheiland&link=https://github.com/falkheiland) -![http://twitter.com/falkheiland](https://img.shields.io/badge/twitter-black?logo=twitter&link=http://twitter.com/falkheiland&link=http://twitter.com/falkheiland) +### Falk Heiland +[![https://github.com/falkheiland][github-fh-badge]][github-fh] +[![http://twitter.com/falkheiland][twitter-fh-badge]][twitter-fh] ## License -This project is [licensed under the MIT License](LICENSE). \ No newline at end of file +This project is [licensed under the MIT License](LICENSE). + +[![MIT licensed][mit-badge]][mit-license] + +[psgallery-dl-badge]: https://img.shields.io/powershellgallery/dt/PSIGEL.svg?logo=powershell +[powershell-gallery]: https://www.powershellgallery.com/packages/PSIGEL/ +[mit-badge]: https://img.shields.io/github/license/IGEL-Community/PSIGEL?logo=github +[mit-license]: LICENSE.md +[github-commit-badge]: https://img.shields.io/github/last-commit/IGEL-Community/PSIGEL?logo=github +[github-psigel]: https://github.com/IGEL-Community/PSIGEL +[github-release-badge]: https://img.shields.io/github/v/release/IGEL-Community/PSIGEL?logo=github +[psgallery-v-badge]: https://img.shields.io/powershellgallery/v/PSIGEL?logo=powershell +[github-start-badge]: https://img.shields.io/github/stars/IGEL-Community/PSIGEL?logo=github +[slack-badge]: https://img.shields.io/badge/chat-IGEL%20Community-brightgreen?logo=slack +[slack-igelcommunity]: http://join.igelcommunity.com +[github-fh-badge]: https://img.shields.io/badge/Github-falkheiland-green?logo=github +[github-fh]: https://github.com/falkheiland +[twitter-fh-badge]: https://img.shields.io/badge/Twitter-falkheiland-blue?logo=twitter +[twitter-fh]: https://twitter.com/falkheiland From 6f7bcaa4a1af0c51aaf1b291d43d77045444f4fc Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 26 Apr 2020 13:52:08 +0200 Subject: [PATCH 120/145] edited README.md --- README.MD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index 4e97b44..eca6fb6 100644 --- a/README.MD +++ b/README.MD @@ -104,8 +104,8 @@ This project is [licensed under the MIT License](LICENSE). [mit-license]: LICENSE.md [github-commit-badge]: https://img.shields.io/github/last-commit/IGEL-Community/PSIGEL?logo=github [github-psigel]: https://github.com/IGEL-Community/PSIGEL -[github-release-badge]: https://img.shields.io/github/v/release/IGEL-Community/PSIGEL?logo=github -[psgallery-v-badge]: https://img.shields.io/powershellgallery/v/PSIGEL?logo=powershell +[github-release-badge]: https://img.shields.io/github/release/IGEL-Community/PSIGEL/all.svg?logo=github +[psgallery-v-badge]: https://img.shields.io/powershellgallery/v/PSIGEL?include_prereleases [github-start-badge]: https://img.shields.io/github/stars/IGEL-Community/PSIGEL?logo=github [slack-badge]: https://img.shields.io/badge/chat-IGEL%20Community-brightgreen?logo=slack [slack-igelcommunity]: http://join.igelcommunity.com From 52795e46327b89cde8a0ee1635a9d2df680e0f28 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 26 Apr 2020 14:38:00 +0200 Subject: [PATCH 121/145] edited README.md --- Docs/Functions.md | 139 ---------------------------------------------- README.MD | 50 ++++++++++++++--- Scripts/Test.ps1 | 2 +- 3 files changed, 44 insertions(+), 147 deletions(-) delete mode 100644 Docs/Functions.md diff --git a/Docs/Functions.md b/Docs/Functions.md deleted file mode 100644 index 1cad3dd..0000000 --- a/Docs/Functions.md +++ /dev/null @@ -1,139 +0,0 @@ -# Functions - -Follow the links to get to the documentation of a specific function. - -## [Get-UMSDevice](Get-UMSDevice.md) - -Gets information on a device. - -## [Get-UMSDeviceAssignment](Get-UMSDeviceAssignment.md) - -Gets information on a profile or master profile assignment of a device. - -## [Get-UMSDeviceDirectory](Get-UMSDeviceDirectory.md) - -Gets information on a device directory. - -## [Get-UMSDeviceDirectoryAssignment](Get-UMSDeviceDirectoryAssignment.md) - -Gets information on a profile or master profile assignment of a device directory. - -## [Get-UMSDirectoryRecursive](Get-UMSDirectoryRecursive.md) - -Gets either all directory or element ids from below given directory id. - -## [Get-UMSFirmware](Get-UMSFirmware.md) - -Gets information on a firmware. - -## [Get-UMSProfile](Get-UMSProfile.md) - -Gets information on a profile. - -## [Get-UMSProfileAssignment](Get-UMSProfileAssignment.md) - -Gets information on a device or device directory assignment of a profile. - -## [Get-UMSProfileDirectory](Get-UMSProfileDirectory.md) - -Gets information on a profile directory. - -## [Get-UMSStatus](Get-UMSStatus.md) - -Gets information on the UMS. - -## [Move-UMSDevice](Move-UMSDevice.md) - -Moves a device to a device directory. - -## [Move-UMSDeviceDirectory](Move-UMSDeviceDirectory.md) - -Moves a device directory to a device directory. - -## [Move-UMSProfile](Move-UMSProfile.md) - -Moves a profile to a profile directory. - -## [Move-UMSProfileDirectory](Move-UMSProfileDirectory.md) - -Moves a profile directory to profile directory. - -## [New-UMSAPICookie](New-UMSAPICookie.md) - -Creates a websession cookie. - -## [New-UMSDevice](New-UMSDevice.md) - -Creates a new device. - -## [New-UMSDeviceDirectory](New-UMSDeviceDirectory.md) - -Creates a device directory. - -## [New-UMSProfileAssignment](New-UMSProfileAssignment.md) - -Creates a profile assignment on a device or device directory. - -## [New-UMSProfileDirectory](New-UMSProfileDirectory.md) - -Creates a profile directory. - -## [Remove-UMSAPICookie](Remove-UMSAPICookie.md) - -Removes the active websession cookie. - -## [Remove-UMSDevice](Remove-UMSDevice.md) - -Removes a device. - -## [Remove-UMSDeviceDirectory](Remove-UMSDeviceDirectory.md) - -Removes a device directory. - -## [Remove-UMSProfile](Remove-UMSProfile.md) - -Removes a profile. - -## [Remove-UMSProfileAssignment](Remove-UMSProfileAssignment.md) - -Removes a profile assignment from a device or device directory. - -## [Remove-UMSProfileDirectory](Remove-UMSProfileDirectory.md) - -Removes a profile directory. - -## [Reset-UMSDevice](Reset-UMSDevice.md) - -Resets a device to factory defaults. - -## [Restart-UMSDevice](Restart-UMSDevice.md) - -Restarts a device. - -## [Send-UMSDeviceSetting](Send-UMSDeviceSetting.md) - -Sends settings to a device. - -## [Start-UMSDevice](Start-UMSDevice.md) - -Wakes up a device. - -## [Stop-UMSDevice](Stop-UMSDevice.md) - -Shuts down a device. - -## [Update-UMSDevice](Update-UMSDevice.md) - -Updates properties of a device. - -## [Update-UMSDeviceDirectory](Update-UMSDeviceDirectory.md) - -Updates the name of a device directory. - -## [Update-UMSProfile](Update-UMSProfile.md) - -Updates the name of a profile. - -## [Update-UMSProfileDirectory](Update-UMSProfileDirectory.md) - -Updates the name of a profile directory. \ No newline at end of file diff --git a/README.MD b/README.MD index eca6fb6..3664f2c 100644 --- a/README.MD +++ b/README.MD @@ -22,9 +22,10 @@ Table of contents: ## Overview -**PSIGEL** is a module to interact with the IGEL UMS via API. +**PSIGEL** is a powershell module that makes use of the REST API of the [**IGEL**](https://www.igel.com) Management Interface (IMI). -All functions got the noun-prefix **UMS** (Universal Management Server), e.g. Get-**UMS**Something . +via [IGEL Knowledgebase](https://kb.igel.com/igelimi-v3/en/imi-manual-2723216.html) : +> IGEL Management Interface (IMI) enables you to connect UMS to systems management tools. It is a programming interface that can create and delete thin clients, move them between directories, reboot them and much more. Its implementation as a REST API makes IMIagnostic of hardware platforms, operating systems and programming languages, thus ensuring maximum interoperability. ## Prerequisites @@ -84,12 +85,47 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess You can learn how to use PSIGEL by reading our documentation: -- [Functions](docs/Functions.md) +### Functions + +- [Get-UMSDevice](/docs/Get-UMSDevice.md) +- [Get-UMSDeviceAssignment](/docs/Get-UMSDeviceAssignment.md) +- [Get-UMSDeviceDirectory](/docs/Get-UMSDeviceDirectory.md) +- [Get-UMSDeviceDirectoryAssignment](/docs/Get-UMSDeviceDirectoryAssignment.md) +- [Get-UMSDirectoryRecursive](/docs/Get-UMSDirectoryRecursive.md) +- [Get-UMSFirmware](/docs/Get-UMSFirmware.md) +- [Get-UMSProfile](/docs/Get-UMSProfile.md) +- [Get-UMSProfileAssignment](/docs/Get-UMSProfileAssignment.md) +- [Get-UMSProfileDirectory](/docs/Get-UMSProfileDirectory.md) +- [Get-UMSStatus](/docs/Get-UMSStatus.md) +- [Move-UMSDevice](/docs/Move-UMSDevice.md) +- [Move-UMSDeviceDirectory](/docs/Move-UMSDeviceDirectory.md) +- [Move-UMSProfile](/docs/Move-UMSProfile.md) +- [Move-UMSProfileDirectory](/docs/Move-UMSProfileDirectory.md) +- [New-UMSAPICookie](/docs/New-UMSAPICookie.md) +- [New-UMSDevice](/docs/New-UMSDevice.md) +- [New-UMSDeviceDirectory](/docs/New-UMSDeviceDirectory.md) +- [New-UMSProfileAssignment](/docs/New-UMSProfileAssignment.md) +- [New-UMSProfileDirectory](/docs/New-UMSProfileDirectory.md) +- [Remove-UMSAPICookie](/docs/Remove-UMSAPICookie.md) +- [Remove-UMSDevice](/docs/Remove-UMSDevice.md) +- [Remove-UMSDeviceDirectory](/docs/Remove-UMSDeviceDirectory.md) +- [Remove-UMSProfile](/docs/Remove-UMSProfile.md) +- [Remove-UMSProfileAssignment](/docs/Remove-UMSProfileAssignment.md) +- [Remove-UMSProfileDirectory](/docs/Remove-UMSProfileDirectory.md) +- [Reset-UMSDevice](/docs/Reset-UMSDevice.md) +- [Restart-UMSDevice](/docs/Restart-UMSDevice.md) +- [Send-UMSDeviceSetting](/docs/Send-UMSDeviceSetting.md) +- [Start-UMSDevice](/docs/Start-UMSDevice.md) +- [Stop-UMSDevice](/docs/Stop-UMSDevice.md) +- [Update-UMSDevice](/docs/Update-UMSDevice.md) +- [Update-UMSDeviceDirectory](/docs/Update-UMSDeviceDirectory.md) +- [Update-UMSProfile](/docs/Update-UMSProfile.md) +- [Update-UMSProfileDirectory](/docs/Update-UMSProfileDirectory.md) ## Maintainer -### Falk Heiland -[![https://github.com/falkheiland][github-fh-badge]][github-fh] +- Falk Heiland +[![https://github.com/falkheiland][github-fh-badge]][github-fh [![http://twitter.com/falkheiland][twitter-fh-badge]][twitter-fh] ## License @@ -105,10 +141,10 @@ This project is [licensed under the MIT License](LICENSE). [github-commit-badge]: https://img.shields.io/github/last-commit/IGEL-Community/PSIGEL?logo=github [github-psigel]: https://github.com/IGEL-Community/PSIGEL [github-release-badge]: https://img.shields.io/github/release/IGEL-Community/PSIGEL/all.svg?logo=github -[psgallery-v-badge]: https://img.shields.io/powershellgallery/v/PSIGEL?include_prereleases +[psgallery-v-badge]: https://img.shields.io/powershellgallery/v/PSIGEL?include_prereleases&logo=powershell [github-start-badge]: https://img.shields.io/github/stars/IGEL-Community/PSIGEL?logo=github [slack-badge]: https://img.shields.io/badge/chat-IGEL%20Community-brightgreen?logo=slack -[slack-igelcommunity]: http://join.igelcommunity.com +[slack-igelcommunity]: https://igelcommunity.slack.com/ [github-fh-badge]: https://img.shields.io/badge/Github-falkheiland-green?logo=github [github-fh]: https://github.com/falkheiland [twitter-fh-badge]: https://img.shields.io/badge/Twitter-falkheiland-blue?logo=twitter diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index 55b6e4c..ca97c50 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -29,7 +29,7 @@ $PSDefaultParameterValues += @{ } #<# #$Result = '' -$Result = Get-UMSDeviceAssignment -Id 505 +$Result = Get-UMSDevice -Id 512 #$Result = Get-UMSDevice #$Result = Get-UMSFirmware $Result From 071ce8939d00647986832f49273ea37da18688ea Mon Sep 17 00:00:00 2001 From: falkheiland Date: Sun, 26 Apr 2020 14:40:05 +0200 Subject: [PATCH 122/145] edited README.md --- README.MD | 70 +++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/README.MD b/README.MD index 3664f2c..569c695 100644 --- a/README.MD +++ b/README.MD @@ -22,7 +22,7 @@ Table of contents: ## Overview -**PSIGEL** is a powershell module that makes use of the REST API of the [**IGEL**](https://www.igel.com) Management Interface (IMI). +**PSIGEL** is a powershell module that makes use of the REST API provided by the [**IGEL**](https://www.igel.com) Management Interface (IMI). via [IGEL Knowledgebase](https://kb.igel.com/igelimi-v3/en/imi-manual-2723216.html) : > IGEL Management Interface (IMI) enables you to connect UMS to systems management tools. It is a programming interface that can create and delete thin clients, move them between directories, reboot them and much more. Its implementation as a REST API makes IMIagnostic of hardware platforms, operating systems and programming languages, thus ensuring maximum interoperability. @@ -87,40 +87,40 @@ You can learn how to use PSIGEL by reading our documentation: ### Functions -- [Get-UMSDevice](/docs/Get-UMSDevice.md) -- [Get-UMSDeviceAssignment](/docs/Get-UMSDeviceAssignment.md) -- [Get-UMSDeviceDirectory](/docs/Get-UMSDeviceDirectory.md) -- [Get-UMSDeviceDirectoryAssignment](/docs/Get-UMSDeviceDirectoryAssignment.md) -- [Get-UMSDirectoryRecursive](/docs/Get-UMSDirectoryRecursive.md) -- [Get-UMSFirmware](/docs/Get-UMSFirmware.md) -- [Get-UMSProfile](/docs/Get-UMSProfile.md) -- [Get-UMSProfileAssignment](/docs/Get-UMSProfileAssignment.md) -- [Get-UMSProfileDirectory](/docs/Get-UMSProfileDirectory.md) -- [Get-UMSStatus](/docs/Get-UMSStatus.md) -- [Move-UMSDevice](/docs/Move-UMSDevice.md) -- [Move-UMSDeviceDirectory](/docs/Move-UMSDeviceDirectory.md) -- [Move-UMSProfile](/docs/Move-UMSProfile.md) -- [Move-UMSProfileDirectory](/docs/Move-UMSProfileDirectory.md) -- [New-UMSAPICookie](/docs/New-UMSAPICookie.md) -- [New-UMSDevice](/docs/New-UMSDevice.md) -- [New-UMSDeviceDirectory](/docs/New-UMSDeviceDirectory.md) -- [New-UMSProfileAssignment](/docs/New-UMSProfileAssignment.md) -- [New-UMSProfileDirectory](/docs/New-UMSProfileDirectory.md) -- [Remove-UMSAPICookie](/docs/Remove-UMSAPICookie.md) -- [Remove-UMSDevice](/docs/Remove-UMSDevice.md) -- [Remove-UMSDeviceDirectory](/docs/Remove-UMSDeviceDirectory.md) -- [Remove-UMSProfile](/docs/Remove-UMSProfile.md) -- [Remove-UMSProfileAssignment](/docs/Remove-UMSProfileAssignment.md) -- [Remove-UMSProfileDirectory](/docs/Remove-UMSProfileDirectory.md) -- [Reset-UMSDevice](/docs/Reset-UMSDevice.md) -- [Restart-UMSDevice](/docs/Restart-UMSDevice.md) -- [Send-UMSDeviceSetting](/docs/Send-UMSDeviceSetting.md) -- [Start-UMSDevice](/docs/Start-UMSDevice.md) -- [Stop-UMSDevice](/docs/Stop-UMSDevice.md) -- [Update-UMSDevice](/docs/Update-UMSDevice.md) -- [Update-UMSDeviceDirectory](/docs/Update-UMSDeviceDirectory.md) -- [Update-UMSProfile](/docs/Update-UMSProfile.md) -- [Update-UMSProfileDirectory](/docs/Update-UMSProfileDirectory.md) +- [Get-UMSDevice](/Docs/Get-UMSDevice.md) +- [Get-UMSDeviceAssignment](/Docs/Get-UMSDeviceAssignment.md) +- [Get-UMSDeviceDirectory](/Docs/Get-UMSDeviceDirectory.md) +- [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) +- [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md) +- [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) +- [Get-UMSProfile](/Docs/Get-UMSProfile.md) +- [Get-UMSProfileAssignment](/Docs/Get-UMSProfileAssignment.md) +- [Get-UMSProfileDirectory](/Docs/Get-UMSProfileDirectory.md) +- [Get-UMSStatus](/Docs/Get-UMSStatus.md) +- [Move-UMSDevice](/Docs/Move-UMSDevice.md) +- [Move-UMSDeviceDirectory](/Docs/Move-UMSDeviceDirectory.md) +- [Move-UMSProfile](/Docs/Move-UMSProfile.md) +- [Move-UMSProfileDirectory](/Docs/Move-UMSProfileDirectory.md) +- [New-UMSAPICookie](/Docs/New-UMSAPICookie.md) +- [New-UMSDevice](/Docs/New-UMSDevice.md) +- [New-UMSDeviceDirectory](/Docs/New-UMSDeviceDirectory.md) +- [New-UMSProfileAssignment](/Docs/New-UMSProfileAssignment.md) +- [New-UMSProfileDirectory](/Docs/New-UMSProfileDirectory.md) +- [Remove-UMSAPICookie](/Docs/Remove-UMSAPICookie.md) +- [Remove-UMSDevice](/Docs/Remove-UMSDevice.md) +- [Remove-UMSDeviceDirectory](/Docs/Remove-UMSDeviceDirectory.md) +- [Remove-UMSProfile](/Docs/Remove-UMSProfile.md) +- [Remove-UMSProfileAssignment](/Docs/Remove-UMSProfileAssignment.md) +- [Remove-UMSProfileDirectory](/Docs/Remove-UMSProfileDirectory.md) +- [Reset-UMSDevice](/Docs/Reset-UMSDevice.md) +- [Restart-UMSDevice](/Docs/Restart-UMSDevice.md) +- [Send-UMSDeviceSetting](/Docs/Send-UMSDeviceSetting.md) +- [Start-UMSDevice](/Docs/Start-UMSDevice.md) +- [Stop-UMSDevice](/Docs/Stop-UMSDevice.md) +- [Update-UMSDevice](/Docs/Update-UMSDevice.md) +- [Update-UMSDeviceDirectory](/Docs/Update-UMSDeviceDirectory.md) +- [Update-UMSProfile](/Docs/Update-UMSProfile.md) +- [Update-UMSProfileDirectory](/Docs/Update-UMSProfileDirectory.md) ## Maintainer From a5e2170137223f4a00096f93eed25e93281d7b46 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Mon, 27 Apr 2020 19:21:30 +0200 Subject: [PATCH 123/145] documentation --- Docs/Scripting-with-PSIGEL.md | 87 +++++++++++++++++++++++++++++++++ README.MD | 90 ++++++++++++++++++----------------- 2 files changed, 133 insertions(+), 44 deletions(-) create mode 100644 Docs/Scripting-with-PSIGEL.md diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md new file mode 100644 index 0000000..ae76e04 --- /dev/null +++ b/Docs/Scripting-with-PSIGEL.md @@ -0,0 +1,87 @@ +# Scripting with PSIGEL + +## Table of contents + +- [Installation](#installation) +- [Setup](#setup) +- [Configuration](#configuration) +- [Authentication](#authentication) + +## Installation + +There are several ways to install PSIGEL: + +### Powershell Gallery + +```powershell +C:\> Install-Module -Name PSIGEL -Repository PSGallery +``` + +### Github Repository + +#### Clone + +Use your favorite Git client (e.g. git, Github Desktop etc.) to clone the PSIGEL repository via HTTPS `https://github.com/IGEL-Community/PSIGEL.git` + +#### Release + +Download and extract the latest [release](https://github.com/IGEL-Community/PSIGEL/releases). + +## Setup + +### Import the module + +Powershell needs to import the PSIGEL module. This is done automatically if it resides within one of the Powershell Module Paths: + +```powershell +[Environment]::GetEnvironmentVariable('PSModulePath') -split ';' +``` + +If you installed it by using the [PSGallery](#powershell-gallery) it will be located in one of the above paths. If it is not, you have to import the Module: + +```powershell +Import-Module -FullyQualifiedName C:\Path\to\PSIGEL.psd1 +``` + +## Configuration + +If you want to script with PSIGEL, you will use parameters like `Computername` multiple times. To avoid unnecessary repetitions you can set Default Parameter Values (example): + +```powershell +$PSDefaultParameterValues = @{ + '*-UMS*:Computername' = 'igelrmserver' # Name or IP address of the UMS server + '*-UMS*:TCPPort' = 9443 # set, if the TCP Port differs from the default port 8443 +} +``` + +## Authentication + +A cookie is needed for authentication with the REST API of the IMI. In PSIGEL this is done by creating a WebSession with the function `New-UMSAPICookie`. It is then is provided to the functions with the parameter `WebSession`. + +A simple way for an interactive, single time used script would be: + +```powershell +$WebSession = New-UMSAPICookie -Credential (Get-Credential) +``` + +For the use in a unattended or repeated script you want to automatically add your credentials. + +Within Windows you can store your credential in a secure way by using: + +```powershell +Get-Credential | Export-Clixml -Path ('C:\Path\To\Your.cred') +``` + +**Warning:** This method does not create an encrypted file within Linux / MacOS. + +You can now import the saved credential and create the WebSession: + +```powershell +$WebSession = New-UMSAPICookie -Credential (Import-Clixml -Path 'C:\Path\To\Your.cred') +``` + +Finally we add the WebSession to the Default Parameter Values as well: + +```powershell +$PSDefaultParameterValues.Add('*-UMS*:WebSession', $WebSession) +``` diff --git a/README.MD b/README.MD index 569c695..0e9aa75 100644 --- a/README.MD +++ b/README.MD @@ -7,10 +7,9 @@ [![GitHub stars][github-start-badge]][github-psigel] [![IGEL-Community Slack][slack-badge]][slack-igelcommunity] - ![Logo](PSIGEL_1280_320.png) -Table of contents: +## Table of contents - [Overview](#overview) - [Prerequisites](#prerequisites) @@ -25,7 +24,7 @@ Table of contents: **PSIGEL** is a powershell module that makes use of the REST API provided by the [**IGEL**](https://www.igel.com) Management Interface (IMI). via [IGEL Knowledgebase](https://kb.igel.com/igelimi-v3/en/imi-manual-2723216.html) : -> IGEL Management Interface (IMI) enables you to connect UMS to systems management tools. It is a programming interface that can create and delete thin clients, move them between directories, reboot them and much more. Its implementation as a REST API makes IMIagnostic of hardware platforms, operating systems and programming languages, thus ensuring maximum interoperability. +> IGEL Management Interface (IMI) enables you to connect UMS to systems management tools. It is a programming interface that can create and delete thin clients, move them between directories, reboot them and much more. Its implementation as a REST API makes IMI agnostic of hardware platforms, operating systems and programming languages, thus ensuring maximum interoperability. ## Prerequisites @@ -38,7 +37,9 @@ via [IGEL Knowledgebase](https://kb.igel.com/igelimi-v3/en/imi-manual-2723216.ht \* tested -## Installation +## Quickstart + +### Installation If you have the [PowerShellGet](https://github.com/powershell/powershellget) module installed you can enter the following command: @@ -48,7 +49,7 @@ C:\> Install-Module -Name PSIGEL Alternatively you can download a ZIP file of the latest version from our [Releases](https://github.com/IGEL-Community/PSIGEL/releases) page. -## Getting Started +### Basic usage Import Module: @@ -83,49 +84,50 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess ## Documentation -You can learn how to use PSIGEL by reading our documentation: - -### Functions - -- [Get-UMSDevice](/Docs/Get-UMSDevice.md) -- [Get-UMSDeviceAssignment](/Docs/Get-UMSDeviceAssignment.md) -- [Get-UMSDeviceDirectory](/Docs/Get-UMSDeviceDirectory.md) -- [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) -- [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md) -- [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) -- [Get-UMSProfile](/Docs/Get-UMSProfile.md) -- [Get-UMSProfileAssignment](/Docs/Get-UMSProfileAssignment.md) -- [Get-UMSProfileDirectory](/Docs/Get-UMSProfileDirectory.md) -- [Get-UMSStatus](/Docs/Get-UMSStatus.md) -- [Move-UMSDevice](/Docs/Move-UMSDevice.md) -- [Move-UMSDeviceDirectory](/Docs/Move-UMSDeviceDirectory.md) -- [Move-UMSProfile](/Docs/Move-UMSProfile.md) -- [Move-UMSProfileDirectory](/Docs/Move-UMSProfileDirectory.md) -- [New-UMSAPICookie](/Docs/New-UMSAPICookie.md) -- [New-UMSDevice](/Docs/New-UMSDevice.md) -- [New-UMSDeviceDirectory](/Docs/New-UMSDeviceDirectory.md) -- [New-UMSProfileAssignment](/Docs/New-UMSProfileAssignment.md) -- [New-UMSProfileDirectory](/Docs/New-UMSProfileDirectory.md) -- [Remove-UMSAPICookie](/Docs/Remove-UMSAPICookie.md) -- [Remove-UMSDevice](/Docs/Remove-UMSDevice.md) -- [Remove-UMSDeviceDirectory](/Docs/Remove-UMSDeviceDirectory.md) -- [Remove-UMSProfile](/Docs/Remove-UMSProfile.md) -- [Remove-UMSProfileAssignment](/Docs/Remove-UMSProfileAssignment.md) -- [Remove-UMSProfileDirectory](/Docs/Remove-UMSProfileDirectory.md) -- [Reset-UMSDevice](/Docs/Reset-UMSDevice.md) -- [Restart-UMSDevice](/Docs/Restart-UMSDevice.md) -- [Send-UMSDeviceSetting](/Docs/Send-UMSDeviceSetting.md) -- [Start-UMSDevice](/Docs/Start-UMSDevice.md) -- [Stop-UMSDevice](/Docs/Stop-UMSDevice.md) -- [Update-UMSDevice](/Docs/Update-UMSDevice.md) -- [Update-UMSDeviceDirectory](/Docs/Update-UMSDeviceDirectory.md) -- [Update-UMSProfile](/Docs/Update-UMSProfile.md) -- [Update-UMSProfileDirectory](/Docs/Update-UMSProfileDirectory.md) +- [Scripting with PSIGEL](/Docs/Scripting-with-PSIGEL.md) + - [Setup](/Docs/Scripting.md#setup) +- Functions + - [Get-UMSDevice](/Docs/Get-UMSDevice.md) + - [Get-UMSDeviceAssignment](/Docs/Get-UMSDeviceAssignment.md) + - [Get-UMSDeviceDirectory](/Docs/Get-UMSDeviceDirectory.md) + - [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) + - [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md) + - [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) + - [Get-UMSProfile](/Docs/Get-UMSProfile.md) + - [Get-UMSProfileAssignment](/Docs/Get-UMSProfileAssignment.md) + - [Get-UMSProfileDirectory](/Docs/Get-UMSProfileDirectory.md) + - [Get-UMSStatus](/Docs/Get-UMSStatus.md) + - [Move-UMSDevice](/Docs/Move-UMSDevice.md) + - [Move-UMSDeviceDirectory](/Docs/Move-UMSDeviceDirectory.md) + - [Move-UMSProfile](/Docs/Move-UMSProfile.md) + - [Move-UMSProfileDirectory](/Docs/Move-UMSProfileDirectory.md) + - [New-UMSAPICookie](/Docs/New-UMSAPICookie.md) + - [New-UMSDevice](/Docs/New-UMSDevice.md) + - [New-UMSDeviceDirectory](/Docs/New-UMSDeviceDirectory.md) + - [New-UMSProfileAssignment](/Docs/New-UMSProfileAssignment.md) + - [New-UMSProfileDirectory](/Docs/New-UMSProfileDirectory.md) + - [Remove-UMSAPICookie](/Docs/Remove-UMSAPICookie.md) + - [Remove-UMSDevice](/Docs/Remove-UMSDevice.md) + - [Remove-UMSDeviceDirectory](/Docs/Remove-UMSDeviceDirectory.md) + - [Remove-UMSProfile](/Docs/Remove-UMSProfile.md) + - [Remove-UMSProfileAssignment](/Docs/Remove-UMSProfileAssignment.md) + - [Remove-UMSProfileDirectory](/Docs/Remove-UMSProfileDirectory.md) + - [Reset-UMSDevice](/Docs/Reset-UMSDevice.md) + - [Restart-UMSDevice](/Docs/Restart-UMSDevice.md) + - [Send-UMSDeviceSetting](/Docs/Send-UMSDeviceSetting.md) + - [Start-UMSDevice](/Docs/Start-UMSDevice.md) + - [Stop-UMSDevice](/Docs/Stop-UMSDevice.md) + - [Update-UMSDevice](/Docs/Update-UMSDevice.md) + - [Update-UMSDeviceDirectory](/Docs/Update-UMSDeviceDirectory.md) + - [Update-UMSProfile](/Docs/Update-UMSProfile.md) + - [Update-UMSProfileDirectory](/Docs/Update-UMSProfileDirectory.md) +- Other sources + - [igelexperts.com](https://www.igelexperts.com/category/igel/psigel/) ## Maintainer - Falk Heiland -[![https://github.com/falkheiland][github-fh-badge]][github-fh +[![https://github.com/falkheiland][github-fh-badge]][github-fh] [![http://twitter.com/falkheiland][twitter-fh-badge]][twitter-fh] ## License From 80b08bdfa2a28301896c863de9371991998d6656 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:25:45 +0200 Subject: [PATCH 124/145] Fixed reset / updating empty values --- PSIGEL/Public/Update-UMSDevice.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PSIGEL/Public/Update-UMSDevice.ps1 b/PSIGEL/Public/Update-UMSDevice.ps1 index 646f35d..149f1fc 100644 --- a/PSIGEL/Public/Update-UMSDevice.ps1 +++ b/PSIGEL/Public/Update-UMSDevice.ps1 @@ -78,39 +78,39 @@ 'Set' { $BodyHashTable = @{ } - if ($Name) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'Name' }) { $BodyHashTable.Add('name', $Name) } - if ($Site) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'Site' }) { $BodyHashTable.Add('site', $Site) } - if ($Department) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'Department' }) { $BodyHashTable.Add('department', $Department) } - if ($CostCenter) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'CostCenter' }) { $BodyHashTable.Add('costCenter', $CostCenter) } - if ($LastIP) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'LastIP' }) { $BodyHashTable.Add('lastIP', $LastIP) } - if ($Comment) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'Comment' }) { $BodyHashTable.Add('comment', $Comment) } - if ($AssetId) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'AssetId' }) { $BodyHashTable.Add('assetID', $AssetId) } - if ($InserviceDate) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'InserviceDate' }) { $BodyHashTable.Add('inserviceDate', $InserviceDate) } - if ($SerialNumber) + if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'SerialNumber' }) { $BodyHashTable.Add('serialNumber', $SerialNumber) } From c13bea6a2b29595334883f4153a4fd8faf7fb734 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:27:03 +0200 Subject: [PATCH 125/145] Create CHANGELOG.md --- CHANGELOG.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6fe4105 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# PSIGEL Changelog + +## v0.10.0 - May dd, 2020 + +### Added + +* cross platform support (Windows, Linux, MacOS) +* support for Powershell 7 +* Remove-UMSAPICookie +* Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter details +* support for Datatype Version in Get-UMSFirmware, Get-UMSStatus +* Get-UMSDirectoryRecursive + +### Changed + +* set minimum Powershell Requirement for the module to 5.1 +* SerialNumber Length to 18 + +### Fixed + +* reset / update empty values of devices + +### Removed + +* remove \*-OS\* functions From ff5c2681f04463519958ae21e52aeb3780abee08 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:27:09 +0200 Subject: [PATCH 126/145] Update Scripting-with-PSIGEL.md --- Docs/Scripting-with-PSIGEL.md | 201 ++++++++++++++++++++++++++++++++-- 1 file changed, 191 insertions(+), 10 deletions(-) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md index ae76e04..c3eb14a 100644 --- a/Docs/Scripting-with-PSIGEL.md +++ b/Docs/Scripting-with-PSIGEL.md @@ -6,6 +6,7 @@ - [Setup](#setup) - [Configuration](#configuration) - [Authentication](#authentication) +- [Creating a script](#creating-a-script) ## Installation @@ -34,13 +35,13 @@ Download and extract the latest [release](https://github.com/IGEL-Community/PSIG Powershell needs to import the PSIGEL module. This is done automatically if it resides within one of the Powershell Module Paths: ```powershell -[Environment]::GetEnvironmentVariable('PSModulePath') -split ';' +C:\> [Environment]::GetEnvironmentVariable('PSModulePath') -split ';' ``` If you installed it by using the [PSGallery](#powershell-gallery) it will be located in one of the above paths. If it is not, you have to import the Module: ```powershell -Import-Module -FullyQualifiedName C:\Path\to\PSIGEL.psd1 +C:\> Import-Module -FullyQualifiedName C:\Path\to\PSIGEL.psd1 ``` ## Configuration @@ -48,28 +49,28 @@ Import-Module -FullyQualifiedName C:\Path\to\PSIGEL.psd1 If you want to script with PSIGEL, you will use parameters like `Computername` multiple times. To avoid unnecessary repetitions you can set Default Parameter Values (example): ```powershell -$PSDefaultParameterValues = @{ - '*-UMS*:Computername' = 'igelrmserver' # Name or IP address of the UMS server - '*-UMS*:TCPPort' = 9443 # set, if the TCP Port differs from the default port 8443 +C:\> $PSDefaultParameterValues = @{ + '*-UMS*:Computername' = 'igelrmserver' # Name or IP address of the UMS server + '*-UMS*:TCPPort' = 9443 # set, if the TCP Port differs from the default port 8443 } ``` ## Authentication -A cookie is needed for authentication with the REST API of the IMI. In PSIGEL this is done by creating a WebSession with the function `New-UMSAPICookie`. It is then is provided to the functions with the parameter `WebSession`. +A cookie is needed for authentication with the REST API of the IMI. In PSIGEL this is done by creating a WebSession with the function `New-UMSAPICookie`. It then is provided to the functions with the parameter `WebSession`. A simple way for an interactive, single time used script would be: ```powershell -$WebSession = New-UMSAPICookie -Credential (Get-Credential) +C:\> $WebSession = New-UMSAPICookie -Credential (Get-Credential) ``` -For the use in a unattended or repeated script you want to automatically add your credentials. +For the use in an unattended or repeated script you want to automatically add your credentials. Within Windows you can store your credential in a secure way by using: ```powershell -Get-Credential | Export-Clixml -Path ('C:\Path\To\Your.cred') +C:\> Get-Credential | Export-Clixml -Path ('C:\Path\To\Your.cred') ``` **Warning:** This method does not create an encrypted file within Linux / MacOS. @@ -77,11 +78,191 @@ Get-Credential | Export-Clixml -Path ('C:\Path\To\Your.cred') You can now import the saved credential and create the WebSession: ```powershell -$WebSession = New-UMSAPICookie -Credential (Import-Clixml -Path 'C:\Path\To\Your.cred') +C:\> $WebSession = New-UMSAPICookie -Credential (Import-Clixml -Path 'C:\Path\To\Your.cred') ``` Finally we add the WebSession to the Default Parameter Values as well: ```powershell +C:\> $PSDefaultParameterValues.Add('*-UMS*:WebSession', $WebSession) +``` + +## Creating a script + +First, lets get information on all used firmwares: + +```powershell +C:\> $FirmwareColl = Get-UMSFirmware + +C:\> $FirmwareColl + +Id Product Version FirmwareType +-- ------- ------- ------------ + 1 IGEL OS 11 11.3.100.1 LX + 2 IGEL OS 11 11.3.110.1 LX +``` + +Now lets find out which is the Id of the latest firmware: + +```powershell +C:\> $LatestFirmwareId = ($FirmwareColl | Sort-Object -Property Version -Descending | + Select-Object -First 1 ).Id + +C:\> $LatestFirmwareId + +2 +``` + +Lets find out all online devices that are not on the latest firmware: + +```powershell +C:\> $UpdateDeviceColl = Get-UMSDevice -Filter online | + Where-Object { $_.Online -eq $false -and $_.FirmwareId -ne $LatestFirmwareId } +C:\> $UpdateDeviceColl + +Id : 505 +ObjectType : tc +UnitId : 0A0000000001 +Mac : 0A0000000001 +Name : BR-HR-001 +ParentId : 504 +FirmwareId : 1 +LastIp : +MovedToBin : False +Online : False + +... + +Id : 572 +ObjectType : tc +UnitId : 0A0000000011 +Mac : 0A0000000011 +Name : L-DIS-011 +ParentId : 520 +FirmwareId : 1 +LastIp : +MovedToBin : False +Online : False +``` + +Using the pipeline we set the description "update" to those devices: + +```powershell +C:\> $UpdateDeviceColl | Update-UMSDevice -Comment 'update' + +Message : Update successful. +Id : 505 + +... + +Message : Update successful. +Id : 572 +``` + +Check for the comment on one of the devices: + +```powershell +C:\> $UpdateDeviceColl | Get-UMSDevice -Filter details | + Select-Object -Property Id, Name, Comment -First 1 + +Id : 505 +Name : BR-HR-001 +Comment : update +``` + +Since the **API does not support views and jobs** we get back to the UMS. We create a view for all devices that have the comment "update". then we create a new scheduled job "Update on Shutdown" for that view and execute it. + +As last step we restart the selected devices to initiate the update and avoid being asked to confirm each restart: + +```powershell +C:\> $UpdateDeviceColl | Restart-UMSDevice -Confirm:$False + +Message : Ok. +Id : 505 +ExecId : ID-igelrmserver-40687-1583585133100-2-0 +Mac : 0A0000000001 +ExecTime : 1583588208593 +State : SUCCESS + +... + +Message : Ok. +Id : 572 +ExecId : ID-igelrmserver-40687-1583585133100-8-0 +Mac : 0A0000000011 +ExecTime : 1583588208904 +State : SUCCESS +``` + +After the reboot we remove the comment "update" from all devices that now have the latest firmware: + +```powershell +C:\> Get-UMSDevice -Filter details | Where-Object { + $_.Comment -eq 'update' -and $_.FirmwareId -ne $LatestFirmwareId + } | Update-UMSDevice -Comment '' + +Message : Update successful. +Id : 505 + +... + +Message : Update successful. +Id : 572 +``` + +At last we remove the WebSession Cookie: + +```powershell +Remove-UMSAPICookie + +D7588A4A667B3B76650245A8BF335036 +``` + +If we create the view to begin with and schedule the execution of the job just after the execution of the script, then we have created a simple update workflow for our devices. Notice: we don't bother with a reboot here, but rather let the update process start, when the devices a shutdown by the user or per policy. + +- The complete script (with removed unnecessary output) as follows: + +```powershell +# set parameters +$CredPath = 'C:\Path\To\Your.cred' +$PSDefaultParameterValues = @{ + '*-UMS*:Computername' = 'igelrmserver' +} + +#create a websession +$WebSession = New-UMSAPICookie -Credential (Import-Clixml -Path $CredPath) $PSDefaultParameterValues.Add('*-UMS*:WebSession', $WebSession) + +# get all firmwares +$FirmwareColl = Get-UMSFirmware + +# get latest firmware +$LatestFirmwareId = ($FirmwareColl | Sort-Object -Property Version -Descending | + Select-Object -First 1 ).Id + +# remove a comment "update" from all devices +$null = Get-UMSDevice -Filter details | Where-Object { + $_.Comment -eq 'update' -and $_.FirmwareId -ne $LatestFirmwareId +} | Update-UMSDevice -Comment '' + +# get all devices that do not have the latest firmware +$UpdateDeviceColl = Get-UMSDevice -Filter online | Where-Object { + $_.Online -eq $false -and $_.FirmwareId -ne $LatestFirmwareId +} + +# set a comment "update" to all devices with not the latest firmware +$UpdateDeviceColl | Update-UMSDevice -Comment 'update' + +# remove the used websession +$null = Remove-UMSAPICookie +``` + +Output: + +```powershell +Message Id +------- -- +Update successful. 505 +.. +Update successful. 572 ``` From 2a1fb2f590185c5c202565404589bfca36f2ec24 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:27:11 +0200 Subject: [PATCH 127/145] Update README.MD --- README.MD | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.MD b/README.MD index 0e9aa75..8a1fe56 100644 --- a/README.MD +++ b/README.MD @@ -37,6 +37,10 @@ via [IGEL Knowledgebase](https://kb.igel.com/igelimi-v3/en/imi-manual-2723216.ht \* tested +## Changelog + + + ## Quickstart ### Installation @@ -84,8 +88,12 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess ## Documentation -- [Scripting with PSIGEL](/Docs/Scripting-with-PSIGEL.md) - - [Setup](/Docs/Scripting.md#setup) +- [Scripting with PSIGEL](/Docs/Scripting-with-PSIGEL-with-PSIGEL.md) + - [Installation](/Docs/Scripting-with-PSIGEL.md#installation) + - [Setup](/Docs/Scripting-with-PSIGEL.md#setup) + - [Configuration](/Docs/Scripting-with-PSIGEL.md#configuration) + - [Authentication](/Docs/Scripting-with-PSIGEL.md#authentication) + - [Creating a script](/Docs/Scripting-with-PSIGEL.md#creating-a-script) - Functions - [Get-UMSDevice](/Docs/Get-UMSDevice.md) - [Get-UMSDeviceAssignment](/Docs/Get-UMSDeviceAssignment.md) @@ -122,7 +130,8 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess - [Update-UMSProfile](/Docs/Update-UMSProfile.md) - [Update-UMSProfileDirectory](/Docs/Update-UMSProfileDirectory.md) - Other sources - - [igelexperts.com](https://www.igelexperts.com/category/igel/psigel/) + - [igelexperts.com](https://www.igelexperts.com/category/igel/psigel/) +- [Changelog](CHANGELOG.md) ## Maintainer From 84005c56a5cbf584fc470da8f1c352ce43ea5f6f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:27:14 +0200 Subject: [PATCH 128/145] Update Test.ps1 --- Scripts/Test.ps1 | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/Scripts/Test.ps1 b/Scripts/Test.ps1 index ca97c50..2022fc6 100644 --- a/Scripts/Test.ps1 +++ b/Scripts/Test.ps1 @@ -22,23 +22,45 @@ elseif ($PSEdition -eq 'core' -and (-Not $IsWindows) ) $PSDefaultParameterValues.Add('New-UMSAPICookie:Credential', (Import-Clixml -Path '/mnt/c/Credentials/UmsRmdbWsl.cred')) } -$WebSession = New-UMSAPICookie -$PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = $WebSession -} +$WebSession = New-UMSAPICookie +$PSDefaultParameterValues.Add('*-UMS*:WebSession', $WebSession) #<# #$Result = '' -$Result = Get-UMSDevice -Id 512 +#$Result = Get-UMSDevice -Id 512 #$Result = Get-UMSDevice -#$Result = Get-UMSFirmware -$Result +#$Result = (Get-UMSFirmware | Sort-Object -Property Version -Descending | Select-Object -First 1 ).Id +#$Result -$null = Remove-UMSAPICookie +$FirmwareColl = Get-UMSFirmware +#$FirmwareColl + +$LatestFirmwareId = ($FirmwareColl | Sort-Object -Property Version -Descending | + Select-Object -First 1 ).Id +#$LatestFirmwareId + +$UpdateDeviceColl = Get-UMSDevice -Filter online | Where-Object { + $_.Online -eq $false -and $_.FirmwareId -ne $LatestFirmwareId +} +#$UpdateDeviceColl + +$UpdateDeviceColl | Update-UMSDevice -Comment 'update' + +#$UpdateDeviceColl | Get-UMSDevice -Filter details | +#Select-Object -Property Id, Name, Comment -First 1 + +#$UpdateDeviceColl | Restart-UMSDevice -Confirm:$False +$null = Get-UMSDevice -Filter details | Where-Object { + $_.Comment -eq 'update' -and $_.FirmwareId -ne $LatestFirmwareId +} | Update-UMSDevice -Comment '' + +$null = Remove-UMSAPICookie #> +#> +### if ($PSBoundParameters.GetEnumerator().Where{ $_.Key -eq 'Comment' }) <# ($WebSession.Cookies.GetCookies('https://igelrmserver').Value) From a9afce3d6ae70dfd66fb8e3564bc355a30f94601 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:27:17 +0200 Subject: [PATCH 129/145] Update PSIGEL.psd1 --- PSIGEL/PSIGEL.psd1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 0cbb2e4..03d1e29 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -143,14 +143,16 @@ # 'ReleaseNotes' des Moduls ReleaseNotes = @' 0.10.0 20200420 -* added cross platform support +* cross platform support (Windows, Linux, MacOS) +* support for Powershell 7 * added Remove-UMSAPICookie * set minimum Powershell Requirement for the module to 5.1 -* added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter detail +* added Site, Department, CostCenter, AssetID, InServiceDate and SerialNumber to Get-UMSDevice -Filter details * support for Datatype Version in Get-UMSFirmware, Get-UMSStatus * added Get-UMSDirectoryRecursive * edited SerialNumber Length to 18 * remove *-OS* functions +* fixed reset / update empty values of devices '@ } # Ende der PSData-Hashtabelle From 159036eb234c85bc3c35f356ccb3b2fcd03e32cc Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:31:30 +0200 Subject: [PATCH 130/145] Update Scripting-with-PSIGEL.md --- Docs/Scripting-with-PSIGEL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md index c3eb14a..a74aee6 100644 --- a/Docs/Scripting-with-PSIGEL.md +++ b/Docs/Scripting-with-PSIGEL.md @@ -198,7 +198,7 @@ After the reboot we remove the comment "update" from all devices that now have t ```powershell C:\> Get-UMSDevice -Filter details | Where-Object { - $_.Comment -eq 'update' -and $_.FirmwareId -ne $LatestFirmwareId + $_.Comment -eq 'update' -and $_.FirmwareId -eq $LatestFirmwareId } | Update-UMSDevice -Comment '' Message : Update successful. @@ -242,7 +242,7 @@ $LatestFirmwareId = ($FirmwareColl | Sort-Object -Property Version -Descending | # remove a comment "update" from all devices $null = Get-UMSDevice -Filter details | Where-Object { - $_.Comment -eq 'update' -and $_.FirmwareId -ne $LatestFirmwareId + $_.Comment -eq 'update' -and $_.FirmwareId -eq $LatestFirmwareId } | Update-UMSDevice -Comment '' # get all devices that do not have the latest firmware From 3afef88d5e9a7d29e42f675943bbe89a1a59aa1f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:32:43 +0200 Subject: [PATCH 131/145] Update Scripting-with-PSIGEL.md --- Docs/Scripting-with-PSIGEL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md index a74aee6..f8cc263 100644 --- a/Docs/Scripting-with-PSIGEL.md +++ b/Docs/Scripting-with-PSIGEL.md @@ -240,7 +240,7 @@ $FirmwareColl = Get-UMSFirmware $LatestFirmwareId = ($FirmwareColl | Sort-Object -Property Version -Descending | Select-Object -First 1 ).Id -# remove a comment "update" from all devices +# remove a comment "update" from all devices with the latest firmware $null = Get-UMSDevice -Filter details | Where-Object { $_.Comment -eq 'update' -and $_.FirmwareId -eq $LatestFirmwareId } | Update-UMSDevice -Comment '' From 866afcf477c2c813ca1e4bb7222c85e6e9a20617 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:35:55 +0200 Subject: [PATCH 132/145] Update Scripting-with-PSIGEL.md --- Docs/Scripting-with-PSIGEL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md index f8cc263..10e9f46 100644 --- a/Docs/Scripting-with-PSIGEL.md +++ b/Docs/Scripting-with-PSIGEL.md @@ -245,7 +245,7 @@ $null = Get-UMSDevice -Filter details | Where-Object { $_.Comment -eq 'update' -and $_.FirmwareId -eq $LatestFirmwareId } | Update-UMSDevice -Comment '' -# get all devices that do not have the latest firmware +# get all online devices that do not have the latest firmware $UpdateDeviceColl = Get-UMSDevice -Filter online | Where-Object { $_.Online -eq $false -and $_.FirmwareId -ne $LatestFirmwareId } @@ -255,6 +255,8 @@ $UpdateDeviceColl | Update-UMSDevice -Comment 'update' # remove the used websession $null = Remove-UMSAPICookie + +# timely after the execution of this script, a scheduled job "update on Shutdown" on a view for all devices with the comment "update" shut start. ``` Output: From 099ec44f8ca0669f7217757055a707af281e369e Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:37:00 +0200 Subject: [PATCH 133/145] Update Scripting-with-PSIGEL.md --- Docs/Scripting-with-PSIGEL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md index 10e9f46..316e113 100644 --- a/Docs/Scripting-with-PSIGEL.md +++ b/Docs/Scripting-with-PSIGEL.md @@ -256,7 +256,7 @@ $UpdateDeviceColl | Update-UMSDevice -Comment 'update' # remove the used websession $null = Remove-UMSAPICookie -# timely after the execution of this script, a scheduled job "update on Shutdown" on a view for all devices with the comment "update" shut start. +# timely after the execution of this script, a scheduled job "update on Shutdown" on a view for all devices with the comment "update" should start in the UMS. ``` Output: From 1008e6413d8d9435fa14c38213b526cbbad8a2c4 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:38:22 +0200 Subject: [PATCH 134/145] Update Scripting-with-PSIGEL.md --- Docs/Scripting-with-PSIGEL.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Scripting-with-PSIGEL.md index 316e113..0c98f92 100644 --- a/Docs/Scripting-with-PSIGEL.md +++ b/Docs/Scripting-with-PSIGEL.md @@ -256,7 +256,10 @@ $UpdateDeviceColl | Update-UMSDevice -Comment 'update' # remove the used websession $null = Remove-UMSAPICookie -# timely after the execution of this script, a scheduled job "update on Shutdown" on a view for all devices with the comment "update" should start in the UMS. +<# +promptly after the execution of this script, a scheduled job "update on Shutdown" +on a view for all devices with the comment "update" should start in the UMS. +#> ``` Output: From 86b0c87777d662b416a7785000eb3c7f06ab4d4b Mon Sep 17 00:00:00 2001 From: falkheiland Date: Tue, 28 Apr 2020 17:41:33 +0200 Subject: [PATCH 135/145] README.md --- README.MD | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.MD b/README.MD index 8a1fe56..f4d2035 100644 --- a/README.MD +++ b/README.MD @@ -37,10 +37,6 @@ via [IGEL Knowledgebase](https://kb.igel.com/igelimi-v3/en/imi-manual-2723216.ht \* tested -## Changelog - - - ## Quickstart ### Installation From e2ea77c5e4c2d30f0c608d4d7669d1e2c221e71c Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 08:35:54 +0200 Subject: [PATCH 136/145] README.md --- README.MD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index f4d2035..d124687 100644 --- a/README.MD +++ b/README.MD @@ -84,7 +84,7 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess ## Documentation -- [Scripting with PSIGEL](/Docs/Scripting-with-PSIGEL-with-PSIGEL.md) +- [Scripting with PSIGEL](/Docs/Scripting-with-PSIGEL.md) - [Installation](/Docs/Scripting-with-PSIGEL.md#installation) - [Setup](/Docs/Scripting-with-PSIGEL.md#setup) - [Configuration](/Docs/Scripting-with-PSIGEL.md#configuration) @@ -144,7 +144,7 @@ This project is [licensed under the MIT License](LICENSE). [psgallery-dl-badge]: https://img.shields.io/powershellgallery/dt/PSIGEL.svg?logo=powershell [powershell-gallery]: https://www.powershellgallery.com/packages/PSIGEL/ [mit-badge]: https://img.shields.io/github/license/IGEL-Community/PSIGEL?logo=github -[mit-license]: LICENSE.md +[mit-license]: LICENSE [github-commit-badge]: https://img.shields.io/github/last-commit/IGEL-Community/PSIGEL?logo=github [github-psigel]: https://github.com/IGEL-Community/PSIGEL [github-release-badge]: https://img.shields.io/github/release/IGEL-Community/PSIGEL/all.svg?logo=github From 42cbaa27a49e4020a19204d9f66caadede7a4342 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 09:08:21 +0200 Subject: [PATCH 137/145] reorganised document structure --- Docs/{ => Guides}/Scripting-with-PSIGEL.md | 0 .../Media/PSIGEL_1280_320.png | Bin Docs/{ => Reference}/Get-UMSDevice.md | 0 .../Get-UMSDeviceAssignment.md | 0 .../{ => Reference}/Get-UMSDeviceDirectory.md | 0 .../Get-UMSDeviceDirectoryAssignment.md | 0 .../Get-UMSDirectoryRecursive.md | 0 Docs/{ => Reference}/Get-UMSFirmware.md | 0 Docs/{ => Reference}/Get-UMSProfile.md | 0 .../Get-UMSProfileAssignment.md | 0 .../Get-UMSProfileDirectory.md | 0 Docs/{ => Reference}/Get-UMSStatus.md | 0 Docs/{ => Reference}/Move-UMSDevice.md | 0 .../Move-UMSDeviceDirectory.md | 0 Docs/{ => Reference}/Move-UMSProfile.md | 0 .../Move-UMSProfileDirectory.md | 0 Docs/{ => Reference}/New-UMSAPICookie.md | 0 Docs/{ => Reference}/New-UMSDevice.md | 0 .../{ => Reference}/New-UMSDeviceDirectory.md | 0 .../New-UMSProfileAssignment.md | 0 .../New-UMSProfileDirectory.md | 0 Docs/{ => Reference}/Remove-UMSDevice.md | 0 .../Remove-UMSDeviceDirectory.md | 0 Docs/{ => Reference}/Remove-UMSProfile.md | 0 .../Remove-UMSProfileAssignment.md | 0 .../Remove-UMSProfileDirectory.md | 0 Docs/{ => Reference}/Reset-UMSDevice.md | 0 Docs/{ => Reference}/Restart-UMSDevice.md | 0 Docs/{ => Reference}/Send-UMSDeviceSetting.md | 0 Docs/{ => Reference}/Start-UMSDevice.md | 0 Docs/{ => Reference}/Stop-UMSDevice.md | 0 Docs/{ => Reference}/Update-UMSDevice.md | 0 .../Update-UMSDeviceDirectory.md | 0 Docs/{ => Reference}/Update-UMSProfile.md | 0 .../Update-UMSProfileDirectory.md | 0 README.MD | 82 +++++++++--------- 36 files changed, 41 insertions(+), 41 deletions(-) rename Docs/{ => Guides}/Scripting-with-PSIGEL.md (100%) rename PSIGEL_1280_320.png => Docs/Media/PSIGEL_1280_320.png (100%) rename Docs/{ => Reference}/Get-UMSDevice.md (100%) rename Docs/{ => Reference}/Get-UMSDeviceAssignment.md (100%) rename Docs/{ => Reference}/Get-UMSDeviceDirectory.md (100%) rename Docs/{ => Reference}/Get-UMSDeviceDirectoryAssignment.md (100%) rename Docs/{ => Reference}/Get-UMSDirectoryRecursive.md (100%) rename Docs/{ => Reference}/Get-UMSFirmware.md (100%) rename Docs/{ => Reference}/Get-UMSProfile.md (100%) rename Docs/{ => Reference}/Get-UMSProfileAssignment.md (100%) rename Docs/{ => Reference}/Get-UMSProfileDirectory.md (100%) rename Docs/{ => Reference}/Get-UMSStatus.md (100%) rename Docs/{ => Reference}/Move-UMSDevice.md (100%) rename Docs/{ => Reference}/Move-UMSDeviceDirectory.md (100%) rename Docs/{ => Reference}/Move-UMSProfile.md (100%) rename Docs/{ => Reference}/Move-UMSProfileDirectory.md (100%) rename Docs/{ => Reference}/New-UMSAPICookie.md (100%) rename Docs/{ => Reference}/New-UMSDevice.md (100%) rename Docs/{ => Reference}/New-UMSDeviceDirectory.md (100%) rename Docs/{ => Reference}/New-UMSProfileAssignment.md (100%) rename Docs/{ => Reference}/New-UMSProfileDirectory.md (100%) rename Docs/{ => Reference}/Remove-UMSDevice.md (100%) rename Docs/{ => Reference}/Remove-UMSDeviceDirectory.md (100%) rename Docs/{ => Reference}/Remove-UMSProfile.md (100%) rename Docs/{ => Reference}/Remove-UMSProfileAssignment.md (100%) rename Docs/{ => Reference}/Remove-UMSProfileDirectory.md (100%) rename Docs/{ => Reference}/Reset-UMSDevice.md (100%) rename Docs/{ => Reference}/Restart-UMSDevice.md (100%) rename Docs/{ => Reference}/Send-UMSDeviceSetting.md (100%) rename Docs/{ => Reference}/Start-UMSDevice.md (100%) rename Docs/{ => Reference}/Stop-UMSDevice.md (100%) rename Docs/{ => Reference}/Update-UMSDevice.md (100%) rename Docs/{ => Reference}/Update-UMSDeviceDirectory.md (100%) rename Docs/{ => Reference}/Update-UMSProfile.md (100%) rename Docs/{ => Reference}/Update-UMSProfileDirectory.md (100%) diff --git a/Docs/Scripting-with-PSIGEL.md b/Docs/Guides/Scripting-with-PSIGEL.md similarity index 100% rename from Docs/Scripting-with-PSIGEL.md rename to Docs/Guides/Scripting-with-PSIGEL.md diff --git a/PSIGEL_1280_320.png b/Docs/Media/PSIGEL_1280_320.png similarity index 100% rename from PSIGEL_1280_320.png rename to Docs/Media/PSIGEL_1280_320.png diff --git a/Docs/Get-UMSDevice.md b/Docs/Reference/Get-UMSDevice.md similarity index 100% rename from Docs/Get-UMSDevice.md rename to Docs/Reference/Get-UMSDevice.md diff --git a/Docs/Get-UMSDeviceAssignment.md b/Docs/Reference/Get-UMSDeviceAssignment.md similarity index 100% rename from Docs/Get-UMSDeviceAssignment.md rename to Docs/Reference/Get-UMSDeviceAssignment.md diff --git a/Docs/Get-UMSDeviceDirectory.md b/Docs/Reference/Get-UMSDeviceDirectory.md similarity index 100% rename from Docs/Get-UMSDeviceDirectory.md rename to Docs/Reference/Get-UMSDeviceDirectory.md diff --git a/Docs/Get-UMSDeviceDirectoryAssignment.md b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md similarity index 100% rename from Docs/Get-UMSDeviceDirectoryAssignment.md rename to Docs/Reference/Get-UMSDeviceDirectoryAssignment.md diff --git a/Docs/Get-UMSDirectoryRecursive.md b/Docs/Reference/Get-UMSDirectoryRecursive.md similarity index 100% rename from Docs/Get-UMSDirectoryRecursive.md rename to Docs/Reference/Get-UMSDirectoryRecursive.md diff --git a/Docs/Get-UMSFirmware.md b/Docs/Reference/Get-UMSFirmware.md similarity index 100% rename from Docs/Get-UMSFirmware.md rename to Docs/Reference/Get-UMSFirmware.md diff --git a/Docs/Get-UMSProfile.md b/Docs/Reference/Get-UMSProfile.md similarity index 100% rename from Docs/Get-UMSProfile.md rename to Docs/Reference/Get-UMSProfile.md diff --git a/Docs/Get-UMSProfileAssignment.md b/Docs/Reference/Get-UMSProfileAssignment.md similarity index 100% rename from Docs/Get-UMSProfileAssignment.md rename to Docs/Reference/Get-UMSProfileAssignment.md diff --git a/Docs/Get-UMSProfileDirectory.md b/Docs/Reference/Get-UMSProfileDirectory.md similarity index 100% rename from Docs/Get-UMSProfileDirectory.md rename to Docs/Reference/Get-UMSProfileDirectory.md diff --git a/Docs/Get-UMSStatus.md b/Docs/Reference/Get-UMSStatus.md similarity index 100% rename from Docs/Get-UMSStatus.md rename to Docs/Reference/Get-UMSStatus.md diff --git a/Docs/Move-UMSDevice.md b/Docs/Reference/Move-UMSDevice.md similarity index 100% rename from Docs/Move-UMSDevice.md rename to Docs/Reference/Move-UMSDevice.md diff --git a/Docs/Move-UMSDeviceDirectory.md b/Docs/Reference/Move-UMSDeviceDirectory.md similarity index 100% rename from Docs/Move-UMSDeviceDirectory.md rename to Docs/Reference/Move-UMSDeviceDirectory.md diff --git a/Docs/Move-UMSProfile.md b/Docs/Reference/Move-UMSProfile.md similarity index 100% rename from Docs/Move-UMSProfile.md rename to Docs/Reference/Move-UMSProfile.md diff --git a/Docs/Move-UMSProfileDirectory.md b/Docs/Reference/Move-UMSProfileDirectory.md similarity index 100% rename from Docs/Move-UMSProfileDirectory.md rename to Docs/Reference/Move-UMSProfileDirectory.md diff --git a/Docs/New-UMSAPICookie.md b/Docs/Reference/New-UMSAPICookie.md similarity index 100% rename from Docs/New-UMSAPICookie.md rename to Docs/Reference/New-UMSAPICookie.md diff --git a/Docs/New-UMSDevice.md b/Docs/Reference/New-UMSDevice.md similarity index 100% rename from Docs/New-UMSDevice.md rename to Docs/Reference/New-UMSDevice.md diff --git a/Docs/New-UMSDeviceDirectory.md b/Docs/Reference/New-UMSDeviceDirectory.md similarity index 100% rename from Docs/New-UMSDeviceDirectory.md rename to Docs/Reference/New-UMSDeviceDirectory.md diff --git a/Docs/New-UMSProfileAssignment.md b/Docs/Reference/New-UMSProfileAssignment.md similarity index 100% rename from Docs/New-UMSProfileAssignment.md rename to Docs/Reference/New-UMSProfileAssignment.md diff --git a/Docs/New-UMSProfileDirectory.md b/Docs/Reference/New-UMSProfileDirectory.md similarity index 100% rename from Docs/New-UMSProfileDirectory.md rename to Docs/Reference/New-UMSProfileDirectory.md diff --git a/Docs/Remove-UMSDevice.md b/Docs/Reference/Remove-UMSDevice.md similarity index 100% rename from Docs/Remove-UMSDevice.md rename to Docs/Reference/Remove-UMSDevice.md diff --git a/Docs/Remove-UMSDeviceDirectory.md b/Docs/Reference/Remove-UMSDeviceDirectory.md similarity index 100% rename from Docs/Remove-UMSDeviceDirectory.md rename to Docs/Reference/Remove-UMSDeviceDirectory.md diff --git a/Docs/Remove-UMSProfile.md b/Docs/Reference/Remove-UMSProfile.md similarity index 100% rename from Docs/Remove-UMSProfile.md rename to Docs/Reference/Remove-UMSProfile.md diff --git a/Docs/Remove-UMSProfileAssignment.md b/Docs/Reference/Remove-UMSProfileAssignment.md similarity index 100% rename from Docs/Remove-UMSProfileAssignment.md rename to Docs/Reference/Remove-UMSProfileAssignment.md diff --git a/Docs/Remove-UMSProfileDirectory.md b/Docs/Reference/Remove-UMSProfileDirectory.md similarity index 100% rename from Docs/Remove-UMSProfileDirectory.md rename to Docs/Reference/Remove-UMSProfileDirectory.md diff --git a/Docs/Reset-UMSDevice.md b/Docs/Reference/Reset-UMSDevice.md similarity index 100% rename from Docs/Reset-UMSDevice.md rename to Docs/Reference/Reset-UMSDevice.md diff --git a/Docs/Restart-UMSDevice.md b/Docs/Reference/Restart-UMSDevice.md similarity index 100% rename from Docs/Restart-UMSDevice.md rename to Docs/Reference/Restart-UMSDevice.md diff --git a/Docs/Send-UMSDeviceSetting.md b/Docs/Reference/Send-UMSDeviceSetting.md similarity index 100% rename from Docs/Send-UMSDeviceSetting.md rename to Docs/Reference/Send-UMSDeviceSetting.md diff --git a/Docs/Start-UMSDevice.md b/Docs/Reference/Start-UMSDevice.md similarity index 100% rename from Docs/Start-UMSDevice.md rename to Docs/Reference/Start-UMSDevice.md diff --git a/Docs/Stop-UMSDevice.md b/Docs/Reference/Stop-UMSDevice.md similarity index 100% rename from Docs/Stop-UMSDevice.md rename to Docs/Reference/Stop-UMSDevice.md diff --git a/Docs/Update-UMSDevice.md b/Docs/Reference/Update-UMSDevice.md similarity index 100% rename from Docs/Update-UMSDevice.md rename to Docs/Reference/Update-UMSDevice.md diff --git a/Docs/Update-UMSDeviceDirectory.md b/Docs/Reference/Update-UMSDeviceDirectory.md similarity index 100% rename from Docs/Update-UMSDeviceDirectory.md rename to Docs/Reference/Update-UMSDeviceDirectory.md diff --git a/Docs/Update-UMSProfile.md b/Docs/Reference/Update-UMSProfile.md similarity index 100% rename from Docs/Update-UMSProfile.md rename to Docs/Reference/Update-UMSProfile.md diff --git a/Docs/Update-UMSProfileDirectory.md b/Docs/Reference/Update-UMSProfileDirectory.md similarity index 100% rename from Docs/Update-UMSProfileDirectory.md rename to Docs/Reference/Update-UMSProfileDirectory.md diff --git a/README.MD b/README.MD index d124687..3098d8e 100644 --- a/README.MD +++ b/README.MD @@ -7,7 +7,7 @@ [![GitHub stars][github-start-badge]][github-psigel] [![IGEL-Community Slack][slack-badge]][slack-igelcommunity] -![Logo](PSIGEL_1280_320.png) +![Logo](/Docs/Reference/Media/PSIGEL_1280_320.png) ## Table of contents @@ -84,47 +84,47 @@ C:\> $null = Remove-UMSAPICookie -Computername igelrmserver -WebSession $WebSess ## Documentation -- [Scripting with PSIGEL](/Docs/Scripting-with-PSIGEL.md) - - [Installation](/Docs/Scripting-with-PSIGEL.md#installation) - - [Setup](/Docs/Scripting-with-PSIGEL.md#setup) - - [Configuration](/Docs/Scripting-with-PSIGEL.md#configuration) - - [Authentication](/Docs/Scripting-with-PSIGEL.md#authentication) - - [Creating a script](/Docs/Scripting-with-PSIGEL.md#creating-a-script) +- [Scripting with PSIGEL](/Docs/Guides/Scripting-with-PSIGEL.md) + - [Installation](/Docs/Guides/Scripting-with-PSIGEL.md#installation) + - [Setup](/Docs/Guides/Scripting-with-PSIGEL.md#setup) + - [Configuration](/Docs/Guides/Scripting-with-PSIGEL.md#configuration) + - [Authentication](/Docs/Guides/Scripting-with-PSIGEL.md#authentication) + - [Creating a script](/Docs/Guides/Scripting-with-PSIGEL.md#creating-a-script) - Functions - - [Get-UMSDevice](/Docs/Get-UMSDevice.md) - - [Get-UMSDeviceAssignment](/Docs/Get-UMSDeviceAssignment.md) - - [Get-UMSDeviceDirectory](/Docs/Get-UMSDeviceDirectory.md) - - [Get-UMSDeviceDirectoryAssignment](/Docs/Get-UMSDeviceDirectoryAssignment.md) - - [Get-UMSDirectoryRecursive](/Docs/Get-UMSDirectoryRecursive.md) - - [Get-UMSFirmware](/Docs/Get-UMSFirmware.md) - - [Get-UMSProfile](/Docs/Get-UMSProfile.md) - - [Get-UMSProfileAssignment](/Docs/Get-UMSProfileAssignment.md) - - [Get-UMSProfileDirectory](/Docs/Get-UMSProfileDirectory.md) - - [Get-UMSStatus](/Docs/Get-UMSStatus.md) - - [Move-UMSDevice](/Docs/Move-UMSDevice.md) - - [Move-UMSDeviceDirectory](/Docs/Move-UMSDeviceDirectory.md) - - [Move-UMSProfile](/Docs/Move-UMSProfile.md) - - [Move-UMSProfileDirectory](/Docs/Move-UMSProfileDirectory.md) - - [New-UMSAPICookie](/Docs/New-UMSAPICookie.md) - - [New-UMSDevice](/Docs/New-UMSDevice.md) - - [New-UMSDeviceDirectory](/Docs/New-UMSDeviceDirectory.md) - - [New-UMSProfileAssignment](/Docs/New-UMSProfileAssignment.md) - - [New-UMSProfileDirectory](/Docs/New-UMSProfileDirectory.md) - - [Remove-UMSAPICookie](/Docs/Remove-UMSAPICookie.md) - - [Remove-UMSDevice](/Docs/Remove-UMSDevice.md) - - [Remove-UMSDeviceDirectory](/Docs/Remove-UMSDeviceDirectory.md) - - [Remove-UMSProfile](/Docs/Remove-UMSProfile.md) - - [Remove-UMSProfileAssignment](/Docs/Remove-UMSProfileAssignment.md) - - [Remove-UMSProfileDirectory](/Docs/Remove-UMSProfileDirectory.md) - - [Reset-UMSDevice](/Docs/Reset-UMSDevice.md) - - [Restart-UMSDevice](/Docs/Restart-UMSDevice.md) - - [Send-UMSDeviceSetting](/Docs/Send-UMSDeviceSetting.md) - - [Start-UMSDevice](/Docs/Start-UMSDevice.md) - - [Stop-UMSDevice](/Docs/Stop-UMSDevice.md) - - [Update-UMSDevice](/Docs/Update-UMSDevice.md) - - [Update-UMSDeviceDirectory](/Docs/Update-UMSDeviceDirectory.md) - - [Update-UMSProfile](/Docs/Update-UMSProfile.md) - - [Update-UMSProfileDirectory](/Docs/Update-UMSProfileDirectory.md) + - [Get-UMSDevice](/Docs/Reference/Get-UMSDevice.md) + - [Get-UMSDeviceAssignment](/Docs/Reference/Get-UMSDeviceAssignment.md) + - [Get-UMSDeviceDirectory](/Docs/Reference/Get-UMSDeviceDirectory.md) + - [Get-UMSDeviceDirectoryAssignment](/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md) + - [Get-UMSDirectoryRecursive](/Docs/Reference/Get-UMSDirectoryRecursive.md) + - [Get-UMSFirmware](/Docs/Reference/Get-UMSFirmware.md) + - [Get-UMSProfile](/Docs/Reference/Get-UMSProfile.md) + - [Get-UMSProfileAssignment](/Docs/Reference/Get-UMSProfileAssignment.md) + - [Get-UMSProfileDirectory](/Docs/Reference/Get-UMSProfileDirectory.md) + - [Get-UMSStatus](/Docs/Reference/Get-UMSStatus.md) + - [Move-UMSDevice](/Docs/Reference/Move-UMSDevice.md) + - [Move-UMSDeviceDirectory](/Docs/Reference/Move-UMSDeviceDirectory.md) + - [Move-UMSProfile](/Docs/Reference/Move-UMSProfile.md) + - [Move-UMSProfileDirectory](/Docs/Reference/Move-UMSProfileDirectory.md) + - [New-UMSAPICookie](/Docs/Reference/New-UMSAPICookie.md) + - [New-UMSDevice](/Docs/Reference/New-UMSDevice.md) + - [New-UMSDeviceDirectory](/Docs/Reference/New-UMSDeviceDirectory.md) + - [New-UMSProfileAssignment](/Docs/Reference/New-UMSProfileAssignment.md) + - [New-UMSProfileDirectory](/Docs/Reference/New-UMSProfileDirectory.md) + - [Remove-UMSAPICookie](/Docs/Reference/Remove-UMSAPICookie.md) + - [Remove-UMSDevice](/Docs/Reference/Remove-UMSDevice.md) + - [Remove-UMSDeviceDirectory](/Docs/Reference/Remove-UMSDeviceDirectory.md) + - [Remove-UMSProfile](/Docs/Reference/Remove-UMSProfile.md) + - [Remove-UMSProfileAssignment](/Docs/Reference/Remove-UMSProfileAssignment.md) + - [Remove-UMSProfileDirectory](/Docs/Reference/Remove-UMSProfileDirectory.md) + - [Reset-UMSDevice](/Docs/Reference/Reset-UMSDevice.md) + - [Restart-UMSDevice](/Docs/Reference/Restart-UMSDevice.md) + - [Send-UMSDeviceSetting](/Docs/Reference/Send-UMSDeviceSetting.md) + - [Start-UMSDevice](/Docs/Reference/Start-UMSDevice.md) + - [Stop-UMSDevice](/Docs/Reference/Stop-UMSDevice.md) + - [Update-UMSDevice](/Docs/Reference/Update-UMSDevice.md) + - [Update-UMSDeviceDirectory](/Docs/Reference/Update-UMSDeviceDirectory.md) + - [Update-UMSProfile](/Docs/Reference/Update-UMSProfile.md) + - [Update-UMSProfileDirectory](/Docs/Reference/Update-UMSProfileDirectory.md) - Other sources - [igelexperts.com](https://www.igelexperts.com/category/igel/psigel/) - [Changelog](CHANGELOG.md) From e9dbf6d2522d7a345207ed6a9b9f01df6b8f22fb Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 09:09:57 +0200 Subject: [PATCH 138/145] Update README.MD --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 3098d8e..6c11e41 100644 --- a/README.MD +++ b/README.MD @@ -7,7 +7,7 @@ [![GitHub stars][github-start-badge]][github-psigel] [![IGEL-Community Slack][slack-badge]][slack-igelcommunity] -![Logo](/Docs/Reference/Media/PSIGEL_1280_320.png) +![Logo](/Docs/Media/PSIGEL_1280_320.png) ## Table of contents From a6d9fcaaed8ff7e9262a2cdc1c8184338e09f1fe Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:10:09 +0200 Subject: [PATCH 139/145] Updated Docs --- Docs/Reference/Get-UMSDevice.md | 9 +- Docs/Reference/Get-UMSDeviceAssignment.md | 10 +- Docs/Reference/Get-UMSDeviceDirectory.md | 9 +- .../Get-UMSDeviceDirectoryAssignment.md | 10 +- Docs/Reference/Get-UMSDirectoryRecursive.md | 1 - Docs/Reference/Get-UMSFirmware.md | 10 +- Docs/Reference/Get-UMSProfile.md | 9 +- Docs/Reference/Get-UMSProfileAssignment.md | 10 +- Docs/Reference/Get-UMSProfileDirectory.md | 9 +- Docs/Reference/Get-UMSStatus.md | 10 +- Docs/Reference/Move-UMSDevice.md | 9 +- Docs/Reference/Move-UMSDeviceDirectory.md | 9 +- Docs/Reference/Move-UMSProfile.md | 9 +- Docs/Reference/Move-UMSProfileDirectory.md | 9 +- Docs/Reference/New-UMSAPICookie.md | 10 +- Docs/Reference/New-UMSDevice.md | 9 +- Docs/Reference/New-UMSDeviceDirectory.md | 9 +- Docs/Reference/New-UMSProfileAssignment.md | 9 +- Docs/Reference/New-UMSProfileDirectory.md | 9 +- Docs/Reference/Remove-UMSAPICookie.md | 154 ++++++++++++++++++ Docs/Reference/Remove-UMSDevice.md | 10 +- Docs/Reference/Remove-UMSDeviceDirectory.md | 9 +- Docs/Reference/Remove-UMSProfile.md | 10 +- Docs/Reference/Remove-UMSProfileAssignment.md | 12 +- Docs/Reference/Remove-UMSProfileDirectory.md | 9 +- Docs/Reference/Reset-UMSDevice.md | 9 +- Docs/Reference/Restart-UMSDevice.md | 9 +- Docs/Reference/Send-UMSDeviceSetting.md | 9 +- Docs/Reference/Start-UMSDevice.md | 10 +- Docs/Reference/Stop-UMSDevice.md | 10 +- Docs/Reference/Update-UMSDevice.md | 10 +- Docs/Reference/Update-UMSDeviceDirectory.md | 9 +- Docs/Reference/Update-UMSProfile.md | 10 +- Docs/Reference/Update-UMSProfileDirectory.md | 10 +- 34 files changed, 284 insertions(+), 175 deletions(-) create mode 100644 Docs/Reference/Remove-UMSAPICookie.md diff --git a/Docs/Reference/Get-UMSDevice.md b/Docs/Reference/Get-UMSDevice.md index 0f24edb..56b1bf5 100644 --- a/Docs/Reference/Get-UMSDevice.md +++ b/Docs/Reference/Get-UMSDevice.md @@ -138,7 +138,7 @@ BiosDate : 01.12.2006 00:00:00 ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -148,7 +148,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -210,7 +210,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -246,8 +246,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSDeviceAssignment.md b/Docs/Reference/Get-UMSDeviceAssignment.md index d38c84c..19e5c4b 100644 --- a/Docs/Reference/Get-UMSDeviceAssignment.md +++ b/Docs/Reference/Get-UMSDeviceAssignment.md @@ -46,11 +46,10 @@ AssigneeType : profile AssignmentPosition : 1 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -60,7 +59,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -106,7 +105,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -142,8 +141,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSDeviceDirectory.md b/Docs/Reference/Get-UMSDeviceDirectory.md index 892ce4e..416676c 100644 --- a/Docs/Reference/Get-UMSDeviceDirectory.md +++ b/Docs/Reference/Get-UMSDeviceDirectory.md @@ -74,7 +74,7 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -84,7 +84,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -146,7 +146,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -182,8 +182,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md index 8c8b58d..e8c7948 100644 --- a/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md +++ b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md @@ -45,11 +45,10 @@ AssigneeType : profile AssignmentPosition : 1 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -59,7 +58,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -105,7 +104,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -141,8 +140,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSDirectoryRecursive.md b/Docs/Reference/Get-UMSDirectoryRecursive.md index 4148f59..f07a7a8 100644 --- a/Docs/Reference/Get-UMSDirectoryRecursive.md +++ b/Docs/Reference/Get-UMSDirectoryRecursive.md @@ -87,7 +87,6 @@ Name : Room2204 ParentId : 208 MovedToBin : False ObjectType : tcdirectory - ``` ### Example 2 diff --git a/Docs/Reference/Get-UMSFirmware.md b/Docs/Reference/Get-UMSFirmware.md index 2837cc6..585d3fc 100644 --- a/Docs/Reference/Get-UMSFirmware.md +++ b/Docs/Reference/Get-UMSFirmware.md @@ -54,11 +54,10 @@ Id Product Version FirmwareType 2 IGEL OS 11 11.01.100.01 LX ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -68,7 +67,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -114,7 +113,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -150,8 +149,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSProfile.md b/Docs/Reference/Get-UMSProfile.md index 4eb5fd3..929b798 100644 --- a/Docs/Reference/Get-UMSProfile.md +++ b/Docs/Reference/Get-UMSProfile.md @@ -84,7 +84,7 @@ ObjectType : profile ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -94,7 +94,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -140,7 +140,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -176,8 +176,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSProfileAssignment.md b/Docs/Reference/Get-UMSProfileAssignment.md index e9a5ec3..816f65a 100644 --- a/Docs/Reference/Get-UMSProfileAssignment.md +++ b/Docs/Reference/Get-UMSProfileAssignment.md @@ -57,11 +57,10 @@ ReceiverType : tcdirectory AssignmentPosition : 0 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -71,7 +70,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -132,7 +131,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -168,8 +167,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSProfileDirectory.md b/Docs/Reference/Get-UMSProfileDirectory.md index 42095ff..9b30096 100644 --- a/Docs/Reference/Get-UMSProfileDirectory.md +++ b/Docs/Reference/Get-UMSProfileDirectory.md @@ -80,7 +80,7 @@ DirectoryChildren : @{ObjectType=profile; Id=669} ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -90,7 +90,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -152,7 +152,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -188,8 +188,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Get-UMSStatus.md b/Docs/Reference/Get-UMSStatus.md index 571be8f..2198d81 100644 --- a/Docs/Reference/Get-UMSStatus.md +++ b/Docs/Reference/Get-UMSStatus.md @@ -37,11 +37,10 @@ ServerUuid : 8be5a3db-ee78-48a9-9caf-52054ec6bf14 Server : igelrmserver:8443 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -51,7 +50,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -82,7 +81,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -118,8 +117,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Move-UMSDevice.md b/Docs/Reference/Move-UMSDevice.md index 45758a2..b62a253 100644 --- a/Docs/Reference/Move-UMSDevice.md +++ b/Docs/Reference/Move-UMSDevice.md @@ -59,7 +59,7 @@ $PSDefaultParameterValues += @{ ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -69,7 +69,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +145,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -197,8 +197,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Move-UMSDeviceDirectory.md b/Docs/Reference/Move-UMSDeviceDirectory.md index ad5b4d0..5be6672 100644 --- a/Docs/Reference/Move-UMSDeviceDirectory.md +++ b/Docs/Reference/Move-UMSDeviceDirectory.md @@ -59,7 +59,7 @@ $PSDefaultParameterValues += @{ ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -69,7 +69,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +145,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -197,8 +197,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Move-UMSProfile.md b/Docs/Reference/Move-UMSProfile.md index f1ed74e..b08a60e 100644 --- a/Docs/Reference/Move-UMSProfile.md +++ b/Docs/Reference/Move-UMSProfile.md @@ -59,7 +59,7 @@ $PSDefaultParameterValues += @{ ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -69,7 +69,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +145,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -197,8 +197,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Move-UMSProfileDirectory.md b/Docs/Reference/Move-UMSProfileDirectory.md index a43397a..d6266b6 100644 --- a/Docs/Reference/Move-UMSProfileDirectory.md +++ b/Docs/Reference/Move-UMSProfileDirectory.md @@ -59,7 +59,7 @@ $PSDefaultParameterValues += @{ ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -69,7 +69,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +145,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -197,8 +197,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/New-UMSAPICookie.md b/Docs/Reference/New-UMSAPICookie.md index 12a5dae..b45c6ad 100644 --- a/Docs/Reference/New-UMSAPICookie.md +++ b/Docs/Reference/New-UMSAPICookie.md @@ -29,6 +29,7 @@ Create websession cookie and assign it to variable $WebSession: ```powershell $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential (Get-Credential) ``` + ### Example 2 Create / use process to store and read credential to and from file and use it to create a websession cookie for use in $WebSession variable: @@ -47,7 +48,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -57,7 +58,7 @@ Accepted values: 3 Required: False Position: 3 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -118,7 +119,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 4 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -155,8 +156,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/New-UMSDevice.md b/Docs/Reference/New-UMSDevice.md index cf8b99f..7c33818 100644 --- a/Docs/Reference/New-UMSDevice.md +++ b/Docs/Reference/New-UMSDevice.md @@ -98,7 +98,7 @@ ParentId : 665 ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -108,7 +108,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -304,7 +304,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -386,8 +386,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/New-UMSDeviceDirectory.md b/Docs/Reference/New-UMSDeviceDirectory.md index 73b85b8..d55e103 100644 --- a/Docs/Reference/New-UMSDeviceDirectory.md +++ b/Docs/Reference/New-UMSDeviceDirectory.md @@ -51,7 +51,7 @@ Directory successfully inserted. 739 Leipzig ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -61,7 +61,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -122,7 +122,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -174,8 +174,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/New-UMSProfileAssignment.md b/Docs/Reference/New-UMSProfileAssignment.md index 49eea6f..fef2235 100644 --- a/Docs/Reference/New-UMSProfileAssignment.md +++ b/Docs/Reference/New-UMSProfileAssignment.md @@ -60,7 +60,7 @@ Message Id ReceiverId ReceiverType ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -70,7 +70,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -162,7 +162,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -214,8 +214,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/New-UMSProfileDirectory.md b/Docs/Reference/New-UMSProfileDirectory.md index 91fb95a..3d65a15 100644 --- a/Docs/Reference/New-UMSProfileDirectory.md +++ b/Docs/Reference/New-UMSProfileDirectory.md @@ -51,7 +51,7 @@ Directory successfully inserted. 745 06 ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -61,7 +61,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -122,7 +122,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -174,8 +174,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Remove-UMSAPICookie.md b/Docs/Reference/Remove-UMSAPICookie.md new file mode 100644 index 0000000..54c43d3 --- /dev/null +++ b/Docs/Reference/Remove-UMSAPICookie.md @@ -0,0 +1,154 @@ +--- +external help file: PSIGEL-help.xml +Module Name: PSIGEL +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSAPICookie.md +schema: 2.0.0 +--- + +# Remove-UMSAPICookie + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Remove-UMSAPICookie [-Computername] [[-TCPPort] ] [[-ApiVersion] ] + [[-SecurityProtocol] ] [-WebSession] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -ApiVersion +{{ Fill ApiVersion Description }} + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: +Accepted values: 3 + +Required: False +Position: 2 +Default value: 3 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Computername +{{ Fill Computername Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Benannt +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityProtocol +{{ Fill SecurityProtocol Description }} + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: +Accepted values: Tls12, Tls11, Tls, Ssl3 + +Required: False +Position: 3 +Default value: Tls12 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TCPPort +{{ Fill TCPPort Description }} + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: 8443 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WebSession +{{ Fill WebSession Description }} + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Benannt +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Keine + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/Docs/Reference/Remove-UMSDevice.md b/Docs/Reference/Remove-UMSDevice.md index 7c55c7a..80e362c 100644 --- a/Docs/Reference/Remove-UMSDevice.md +++ b/Docs/Reference/Remove-UMSDevice.md @@ -94,11 +94,10 @@ Offline deletion successful. 751 Offline deletion successful. 752 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -108,7 +107,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -184,7 +183,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -236,8 +235,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Remove-UMSDeviceDirectory.md b/Docs/Reference/Remove-UMSDeviceDirectory.md index 1de0836..a4649ed 100644 --- a/Docs/Reference/Remove-UMSDeviceDirectory.md +++ b/Docs/Reference/Remove-UMSDeviceDirectory.md @@ -68,7 +68,7 @@ Deletion successful. 687 ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -78,7 +78,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -139,7 +139,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -191,8 +191,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Remove-UMSProfile.md b/Docs/Reference/Remove-UMSProfile.md index fd94213..dd3e16b 100644 --- a/Docs/Reference/Remove-UMSProfile.md +++ b/Docs/Reference/Remove-UMSProfile.md @@ -63,11 +63,10 @@ Deleted profile. 69 Deleted profile. 390 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -77,7 +76,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -138,7 +137,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -190,8 +189,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Remove-UMSProfileAssignment.md b/Docs/Reference/Remove-UMSProfileAssignment.md index e38d808..1a6869b 100644 --- a/Docs/Reference/Remove-UMSProfileAssignment.md +++ b/Docs/Reference/Remove-UMSProfileAssignment.md @@ -62,11 +62,10 @@ deleted profile assignment. 390 71 tcdirectory deleted profile assignment. 69 71 tcdirectory ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -76,7 +75,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -122,7 +121,7 @@ Aliases: Required: True Position: 5 Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` @@ -168,7 +167,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -220,8 +219,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Remove-UMSProfileDirectory.md b/Docs/Reference/Remove-UMSProfileDirectory.md index a14266d..68c7bb1 100644 --- a/Docs/Reference/Remove-UMSProfileDirectory.md +++ b/Docs/Reference/Remove-UMSProfileDirectory.md @@ -66,7 +66,7 @@ Deletion successful. 230 ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -76,7 +76,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -137,7 +137,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -189,8 +189,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Reset-UMSDevice.md b/Docs/Reference/Reset-UMSDevice.md index 85a9a57..c7c1c8d 100644 --- a/Docs/Reference/Reset-UMSDevice.md +++ b/Docs/Reference/Reset-UMSDevice.md @@ -80,7 +80,7 @@ State : SUCCESS ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -90,7 +90,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -151,7 +151,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -203,8 +203,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Restart-UMSDevice.md b/Docs/Reference/Restart-UMSDevice.md index b87ad45..465d400 100644 --- a/Docs/Reference/Restart-UMSDevice.md +++ b/Docs/Reference/Restart-UMSDevice.md @@ -73,7 +73,7 @@ State : SUCCESS ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -83,7 +83,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -144,7 +144,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -196,8 +196,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Send-UMSDeviceSetting.md b/Docs/Reference/Send-UMSDeviceSetting.md index 0347aee..2077322 100644 --- a/Docs/Reference/Send-UMSDeviceSetting.md +++ b/Docs/Reference/Send-UMSDeviceSetting.md @@ -73,7 +73,7 @@ State : SUCCESS ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -83,7 +83,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -144,7 +144,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -196,8 +196,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Start-UMSDevice.md b/Docs/Reference/Start-UMSDevice.md index d3c5b11..149a086 100644 --- a/Docs/Reference/Start-UMSDevice.md +++ b/Docs/Reference/Start-UMSDevice.md @@ -70,11 +70,10 @@ ExecTime : 1552122279824 1552122279713 State : SUCCESS SUCCESS ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -84,7 +83,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +144,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -197,8 +196,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Stop-UMSDevice.md b/Docs/Reference/Stop-UMSDevice.md index 7c38ed0..88a068e 100644 --- a/Docs/Reference/Stop-UMSDevice.md +++ b/Docs/Reference/Stop-UMSDevice.md @@ -70,11 +70,10 @@ ExecTime : 1552123656947 State : SUCCESS ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -84,7 +83,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +144,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -197,8 +196,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Update-UMSDevice.md b/Docs/Reference/Update-UMSDevice.md index 18ea921..50f9d08 100644 --- a/Docs/Reference/Update-UMSDevice.md +++ b/Docs/Reference/Update-UMSDevice.md @@ -62,11 +62,10 @@ Update successful. 58 Update successful. 195 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -76,7 +75,7 @@ Accepted values: 3 Required: False Position: Benannt -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -242,7 +241,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: Benannt -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -324,8 +323,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Update-UMSDeviceDirectory.md b/Docs/Reference/Update-UMSDeviceDirectory.md index 7353128..8533979 100644 --- a/Docs/Reference/Update-UMSDeviceDirectory.md +++ b/Docs/Reference/Update-UMSDeviceDirectory.md @@ -63,7 +63,7 @@ Updated directory successfully. 665 ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -73,7 +73,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -149,7 +149,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -201,8 +201,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Update-UMSProfile.md b/Docs/Reference/Update-UMSProfile.md index 5d06afe..3439b78 100644 --- a/Docs/Reference/Update-UMSProfile.md +++ b/Docs/Reference/Update-UMSProfile.md @@ -61,11 +61,10 @@ Update successful. 390 Update successful. 669 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -75,7 +74,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -151,7 +150,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -203,8 +202,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Reference/Update-UMSProfileDirectory.md b/Docs/Reference/Update-UMSProfileDirectory.md index f14ab51..024066c 100644 --- a/Docs/Reference/Update-UMSProfileDirectory.md +++ b/Docs/Reference/Update-UMSProfileDirectory.md @@ -61,11 +61,10 @@ Updated directory successfully. 230 Updated directory successfully. 668 ``` - ## PARAMETERS ### -ApiVersion -API Version to use (Default: 3) +API Version to use ```yaml Type: Int32 @@ -75,7 +74,7 @@ Accepted values: 3 Required: False Position: 2 -Default value: None +Default value: 3 Accept pipeline input: False Accept wildcard characters: False ``` @@ -151,7 +150,7 @@ Accepted values: Tls12, Tls11, Tls, Ssl3 Required: False Position: 3 -Default value: None +Default value: Tls12 Accept pipeline input: False Accept wildcard characters: False ``` @@ -203,8 +202,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS From 2f3bc6b067c9675ef6bb8548b0e21113ed2e532f Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:12:25 +0200 Subject: [PATCH 140/145] Updated Docs --- Docs/Reference/Get-UMSDevice.md | 2 +- Docs/Reference/Get-UMSDeviceAssignment.md | 2 +- Docs/Reference/Get-UMSDeviceDirectory.md | 2 +- Docs/Reference/Get-UMSDeviceDirectoryAssignment.md | 2 +- Docs/Reference/Get-UMSFirmware.md | 2 +- Docs/Reference/Get-UMSProfile.md | 2 +- Docs/Reference/Get-UMSProfileAssignment.md | 2 +- Docs/Reference/Get-UMSProfileDirectory.md | 2 +- Docs/Reference/Get-UMSStatus.md | 2 +- Docs/Reference/Move-UMSDevice.md | 2 +- Docs/Reference/Move-UMSDeviceDirectory.md | 2 +- Docs/Reference/Move-UMSProfile.md | 2 +- Docs/Reference/Move-UMSProfileDirectory.md | 2 +- Docs/Reference/New-UMSAPICookie.md | 2 +- Docs/Reference/New-UMSDevice.md | 2 +- Docs/Reference/New-UMSDeviceDirectory.md | 2 +- Docs/Reference/New-UMSProfileAssignment.md | 2 +- Docs/Reference/New-UMSProfileDirectory.md | 2 +- Docs/Reference/Remove-UMSDevice.md | 2 +- Docs/Reference/Remove-UMSDeviceDirectory.md | 2 +- Docs/Reference/Remove-UMSProfile.md | 2 +- Docs/Reference/Remove-UMSProfileAssignment.md | 2 +- Docs/Reference/Remove-UMSProfileDirectory.md | 2 +- Docs/Reference/Reset-UMSDevice.md | 2 +- Docs/Reference/Restart-UMSDevice.md | 2 +- Docs/Reference/Send-UMSDeviceSetting.md | 2 +- Docs/Reference/Start-UMSDevice.md | 2 +- Docs/Reference/Stop-UMSDevice.md | 2 +- Docs/Reference/Update-UMSDevice.md | 2 +- Docs/Reference/Update-UMSDeviceDirectory.md | 2 +- Docs/Reference/Update-UMSProfile.md | 2 +- Docs/Reference/Update-UMSProfileDirectory.md | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Docs/Reference/Get-UMSDevice.md b/Docs/Reference/Get-UMSDevice.md index 56b1bf5..9ed2801 100644 --- a/Docs/Reference/Get-UMSDevice.md +++ b/Docs/Reference/Get-UMSDevice.md @@ -225,7 +225,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSDeviceAssignment.md b/Docs/Reference/Get-UMSDeviceAssignment.md index 19e5c4b..5987eb3 100644 --- a/Docs/Reference/Get-UMSDeviceAssignment.md +++ b/Docs/Reference/Get-UMSDeviceAssignment.md @@ -120,7 +120,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSDeviceDirectory.md b/Docs/Reference/Get-UMSDeviceDirectory.md index 416676c..241d60c 100644 --- a/Docs/Reference/Get-UMSDeviceDirectory.md +++ b/Docs/Reference/Get-UMSDeviceDirectory.md @@ -161,7 +161,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md index e8c7948..a6006a3 100644 --- a/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md +++ b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md @@ -119,7 +119,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSFirmware.md b/Docs/Reference/Get-UMSFirmware.md index 585d3fc..5f2e016 100644 --- a/Docs/Reference/Get-UMSFirmware.md +++ b/Docs/Reference/Get-UMSFirmware.md @@ -128,7 +128,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSProfile.md b/Docs/Reference/Get-UMSProfile.md index 929b798..a889c0e 100644 --- a/Docs/Reference/Get-UMSProfile.md +++ b/Docs/Reference/Get-UMSProfile.md @@ -155,7 +155,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSProfileAssignment.md b/Docs/Reference/Get-UMSProfileAssignment.md index 816f65a..e4c0a01 100644 --- a/Docs/Reference/Get-UMSProfileAssignment.md +++ b/Docs/Reference/Get-UMSProfileAssignment.md @@ -146,7 +146,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSProfileDirectory.md b/Docs/Reference/Get-UMSProfileDirectory.md index 9b30096..2bf5bb0 100644 --- a/Docs/Reference/Get-UMSProfileDirectory.md +++ b/Docs/Reference/Get-UMSProfileDirectory.md @@ -167,7 +167,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Get-UMSStatus.md b/Docs/Reference/Get-UMSStatus.md index 2198d81..3c9d776 100644 --- a/Docs/Reference/Get-UMSStatus.md +++ b/Docs/Reference/Get-UMSStatus.md @@ -96,7 +96,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Move-UMSDevice.md b/Docs/Reference/Move-UMSDevice.md index b62a253..81e44b2 100644 --- a/Docs/Reference/Move-UMSDevice.md +++ b/Docs/Reference/Move-UMSDevice.md @@ -160,7 +160,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Move-UMSDeviceDirectory.md b/Docs/Reference/Move-UMSDeviceDirectory.md index 5be6672..e28b85d 100644 --- a/Docs/Reference/Move-UMSDeviceDirectory.md +++ b/Docs/Reference/Move-UMSDeviceDirectory.md @@ -160,7 +160,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Move-UMSProfile.md b/Docs/Reference/Move-UMSProfile.md index b08a60e..8fd8cf7 100644 --- a/Docs/Reference/Move-UMSProfile.md +++ b/Docs/Reference/Move-UMSProfile.md @@ -160,7 +160,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Move-UMSProfileDirectory.md b/Docs/Reference/Move-UMSProfileDirectory.md index d6266b6..f03c87a 100644 --- a/Docs/Reference/Move-UMSProfileDirectory.md +++ b/Docs/Reference/Move-UMSProfileDirectory.md @@ -160,7 +160,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/New-UMSAPICookie.md b/Docs/Reference/New-UMSAPICookie.md index b45c6ad..72839c7 100644 --- a/Docs/Reference/New-UMSAPICookie.md +++ b/Docs/Reference/New-UMSAPICookie.md @@ -134,7 +134,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/New-UMSDevice.md b/Docs/Reference/New-UMSDevice.md index 7c33818..b6158e6 100644 --- a/Docs/Reference/New-UMSDevice.md +++ b/Docs/Reference/New-UMSDevice.md @@ -349,7 +349,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/New-UMSDeviceDirectory.md b/Docs/Reference/New-UMSDeviceDirectory.md index d55e103..78965ed 100644 --- a/Docs/Reference/New-UMSDeviceDirectory.md +++ b/Docs/Reference/New-UMSDeviceDirectory.md @@ -137,7 +137,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/New-UMSProfileAssignment.md b/Docs/Reference/New-UMSProfileAssignment.md index fef2235..6b3cc08 100644 --- a/Docs/Reference/New-UMSProfileAssignment.md +++ b/Docs/Reference/New-UMSProfileAssignment.md @@ -177,7 +177,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/New-UMSProfileDirectory.md b/Docs/Reference/New-UMSProfileDirectory.md index 3d65a15..64ca84f 100644 --- a/Docs/Reference/New-UMSProfileDirectory.md +++ b/Docs/Reference/New-UMSProfileDirectory.md @@ -137,7 +137,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Remove-UMSDevice.md b/Docs/Reference/Remove-UMSDevice.md index 80e362c..e4a178e 100644 --- a/Docs/Reference/Remove-UMSDevice.md +++ b/Docs/Reference/Remove-UMSDevice.md @@ -198,7 +198,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Remove-UMSDeviceDirectory.md b/Docs/Reference/Remove-UMSDeviceDirectory.md index a4649ed..96ef6d8 100644 --- a/Docs/Reference/Remove-UMSDeviceDirectory.md +++ b/Docs/Reference/Remove-UMSDeviceDirectory.md @@ -154,7 +154,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Remove-UMSProfile.md b/Docs/Reference/Remove-UMSProfile.md index dd3e16b..84f7b58 100644 --- a/Docs/Reference/Remove-UMSProfile.md +++ b/Docs/Reference/Remove-UMSProfile.md @@ -152,7 +152,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Remove-UMSProfileAssignment.md b/Docs/Reference/Remove-UMSProfileAssignment.md index 1a6869b..2c1f56c 100644 --- a/Docs/Reference/Remove-UMSProfileAssignment.md +++ b/Docs/Reference/Remove-UMSProfileAssignment.md @@ -182,7 +182,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Remove-UMSProfileDirectory.md b/Docs/Reference/Remove-UMSProfileDirectory.md index 68c7bb1..1aadfac 100644 --- a/Docs/Reference/Remove-UMSProfileDirectory.md +++ b/Docs/Reference/Remove-UMSProfileDirectory.md @@ -152,7 +152,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Reset-UMSDevice.md b/Docs/Reference/Reset-UMSDevice.md index c7c1c8d..056f759 100644 --- a/Docs/Reference/Reset-UMSDevice.md +++ b/Docs/Reference/Reset-UMSDevice.md @@ -166,7 +166,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Restart-UMSDevice.md b/Docs/Reference/Restart-UMSDevice.md index 465d400..675ad0d 100644 --- a/Docs/Reference/Restart-UMSDevice.md +++ b/Docs/Reference/Restart-UMSDevice.md @@ -159,7 +159,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Send-UMSDeviceSetting.md b/Docs/Reference/Send-UMSDeviceSetting.md index 2077322..e28848a 100644 --- a/Docs/Reference/Send-UMSDeviceSetting.md +++ b/Docs/Reference/Send-UMSDeviceSetting.md @@ -159,7 +159,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Start-UMSDevice.md b/Docs/Reference/Start-UMSDevice.md index 149a086..67abae1 100644 --- a/Docs/Reference/Start-UMSDevice.md +++ b/Docs/Reference/Start-UMSDevice.md @@ -159,7 +159,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Stop-UMSDevice.md b/Docs/Reference/Stop-UMSDevice.md index 88a068e..a8bb317 100644 --- a/Docs/Reference/Stop-UMSDevice.md +++ b/Docs/Reference/Stop-UMSDevice.md @@ -159,7 +159,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Update-UMSDevice.md b/Docs/Reference/Update-UMSDevice.md index 50f9d08..7a4c1fa 100644 --- a/Docs/Reference/Update-UMSDevice.md +++ b/Docs/Reference/Update-UMSDevice.md @@ -286,7 +286,7 @@ Aliases: Required: False Position: Benannt -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Update-UMSDeviceDirectory.md b/Docs/Reference/Update-UMSDeviceDirectory.md index 8533979..a768db4 100644 --- a/Docs/Reference/Update-UMSDeviceDirectory.md +++ b/Docs/Reference/Update-UMSDeviceDirectory.md @@ -164,7 +164,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Update-UMSProfile.md b/Docs/Reference/Update-UMSProfile.md index 3439b78..6e1000f 100644 --- a/Docs/Reference/Update-UMSProfile.md +++ b/Docs/Reference/Update-UMSProfile.md @@ -165,7 +165,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/Docs/Reference/Update-UMSProfileDirectory.md b/Docs/Reference/Update-UMSProfileDirectory.md index 024066c..36367ea 100644 --- a/Docs/Reference/Update-UMSProfileDirectory.md +++ b/Docs/Reference/Update-UMSProfileDirectory.md @@ -165,7 +165,7 @@ Aliases: Required: False Position: 1 -Default value: None +Default value: 8443 Accept pipeline input: False Accept wildcard characters: False ``` From ebe768b470c5dcf614ddc36513b39870e71c73a2 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:23:36 +0200 Subject: [PATCH 141/145] Update Remove-UMSAPICookie.md --- Docs/Reference/Remove-UMSAPICookie.md | 29 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Docs/Reference/Remove-UMSAPICookie.md b/Docs/Reference/Remove-UMSAPICookie.md index 54c43d3..4f7798e 100644 --- a/Docs/Reference/Remove-UMSAPICookie.md +++ b/Docs/Reference/Remove-UMSAPICookie.md @@ -8,7 +8,7 @@ schema: 2.0.0 # Remove-UMSAPICookie ## SYNOPSIS -{{ Fill in the Synopsis }} +Removes a websession cookie. ## SYNTAX @@ -18,21 +18,32 @@ Remove-UMSAPICookie [-Computername] [[-TCPPort] ] [[-ApiVersion] ``` ## DESCRIPTION -{{ Fill in the Description }} +Removes a websession cookie for the UMS API. ## EXAMPLES ### Example 1 + +Removes a websession cookie, gets the cookie value back as output. + ```powershell -PS C:\> {{ Add example code here }} +Remove-UMSAPICookie -ComputerName 'igelrmserver' -WebSession $WebSession + +D7588A4A667B3B76650245A8BF335036 ``` -{{ Add example description here }} +### Example 1 + +Removes a websession cookie, omits output. + +```powershell +$null = Remove-UMSAPICookie -ComputerName 'igelrmserver' -WebSession $WebSession +``` ## PARAMETERS ### -ApiVersion -{{ Fill ApiVersion Description }} +API Version to use ```yaml Type: Int32 @@ -48,7 +59,7 @@ Accept wildcard characters: False ``` ### -Computername -{{ Fill Computername Description }} +Computername of the UMS Server ```yaml Type: String @@ -78,7 +89,7 @@ Accept wildcard characters: False ``` ### -SecurityProtocol -{{ Fill SecurityProtocol Description }} +Set SSL/TLS protocol ```yaml Type: String[] @@ -94,7 +105,7 @@ Accept wildcard characters: False ``` ### -TCPPort -{{ Fill TCPPort Description }} +TCP Port API ```yaml Type: Int32 @@ -109,7 +120,7 @@ Accept wildcard characters: False ``` ### -WebSession -{{ Fill WebSession Description }} +Websession Cookie ```yaml Type: Object From 0eeb52bdfa8a6f44eb945d6791093dac5920f6d1 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:35:37 +0200 Subject: [PATCH 142/145] Updated Docs --- Docs/Reference/Get-UMSDevice.md | 2 +- Docs/Reference/Get-UMSDeviceAssignment.md | 2 +- Docs/Reference/Get-UMSDeviceDirectory.md | 2 +- Docs/Reference/Get-UMSDeviceDirectoryAssignment.md | 2 +- Docs/Reference/Get-UMSDirectoryRecursive.md | 2 +- Docs/Reference/Get-UMSFirmware.md | 2 +- Docs/Reference/Get-UMSProfile.md | 2 +- Docs/Reference/Get-UMSProfileAssignment.md | 2 +- Docs/Reference/Get-UMSProfileDirectory.md | 2 +- Docs/Reference/Get-UMSStatus.md | 2 +- Docs/Reference/Move-UMSDevice.md | 2 +- Docs/Reference/Move-UMSDeviceDirectory.md | 2 +- Docs/Reference/Move-UMSProfile.md | 2 +- Docs/Reference/Move-UMSProfileDirectory.md | 2 +- Docs/Reference/New-UMSAPICookie.md | 2 +- Docs/Reference/New-UMSDevice.md | 2 +- Docs/Reference/New-UMSDeviceDirectory.md | 2 +- Docs/Reference/New-UMSProfileAssignment.md | 2 +- Docs/Reference/New-UMSProfileDirectory.md | 2 +- Docs/Reference/Remove-UMSDevice.md | 2 +- Docs/Reference/Remove-UMSDeviceDirectory.md | 2 +- Docs/Reference/Remove-UMSProfile.md | 2 +- Docs/Reference/Remove-UMSProfileAssignment.md | 2 +- Docs/Reference/Remove-UMSProfileDirectory.md | 2 +- Docs/Reference/Reset-UMSDevice.md | 2 +- Docs/Reference/Restart-UMSDevice.md | 2 +- Docs/Reference/Send-UMSDeviceSetting.md | 2 +- Docs/Reference/Start-UMSDevice.md | 2 +- Docs/Reference/Stop-UMSDevice.md | 2 +- Docs/Reference/Update-UMSDevice.md | 2 +- Docs/Reference/Update-UMSDeviceDirectory.md | 2 +- Docs/Reference/Update-UMSProfile.md | 2 +- Docs/Reference/Update-UMSProfileDirectory.md | 2 +- PSIGEL/PSIGEL.psd1 | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Docs/Reference/Get-UMSDevice.md b/Docs/Reference/Get-UMSDevice.md index 9ed2801..2d4a2ac 100644 --- a/Docs/Reference/Get-UMSDevice.md +++ b/Docs/Reference/Get-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSDeviceAssignment.md b/Docs/Reference/Get-UMSDeviceAssignment.md index 5987eb3..1b2e10e 100644 --- a/Docs/Reference/Get-UMSDeviceAssignment.md +++ b/Docs/Reference/Get-UMSDeviceAssignment.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDeviceAssignment.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSDeviceDirectory.md b/Docs/Reference/Get-UMSDeviceDirectory.md index 241d60c..9e4ded4 100644 --- a/Docs/Reference/Get-UMSDeviceDirectory.md +++ b/Docs/Reference/Get-UMSDeviceDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDeviceDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md index a6006a3..3224347 100644 --- a/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md +++ b/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSDirectoryRecursive.md b/Docs/Reference/Get-UMSDirectoryRecursive.md index f07a7a8..49bd95e 100644 --- a/Docs/Reference/Get-UMSDirectoryRecursive.md +++ b/Docs/Reference/Get-UMSDirectoryRecursive.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDirectoryRecursive.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSFirmware.md b/Docs/Reference/Get-UMSFirmware.md index 5f2e016..4fbb19f 100644 --- a/Docs/Reference/Get-UMSFirmware.md +++ b/Docs/Reference/Get-UMSFirmware.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSFirmware.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSProfile.md b/Docs/Reference/Get-UMSProfile.md index a889c0e..cf015c6 100644 --- a/Docs/Reference/Get-UMSProfile.md +++ b/Docs/Reference/Get-UMSProfile.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSProfile.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSProfileAssignment.md b/Docs/Reference/Get-UMSProfileAssignment.md index e4c0a01..1f60b6b 100644 --- a/Docs/Reference/Get-UMSProfileAssignment.md +++ b/Docs/Reference/Get-UMSProfileAssignment.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSProfileAssignment.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSProfileDirectory.md b/Docs/Reference/Get-UMSProfileDirectory.md index 2bf5bb0..3d20284 100644 --- a/Docs/Reference/Get-UMSProfileDirectory.md +++ b/Docs/Reference/Get-UMSProfileDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSProfileDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Get-UMSStatus.md b/Docs/Reference/Get-UMSStatus.md index 3c9d776..8dacceb 100644 --- a/Docs/Reference/Get-UMSStatus.md +++ b/Docs/Reference/Get-UMSStatus.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSStatus.md schema: 2.0.0 --- diff --git a/Docs/Reference/Move-UMSDevice.md b/Docs/Reference/Move-UMSDevice.md index 81e44b2..d0be0ec 100644 --- a/Docs/Reference/Move-UMSDevice.md +++ b/Docs/Reference/Move-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Move-UMSDeviceDirectory.md b/Docs/Reference/Move-UMSDeviceDirectory.md index e28b85d..d084492 100644 --- a/Docs/Reference/Move-UMSDeviceDirectory.md +++ b/Docs/Reference/Move-UMSDeviceDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSDeviceDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Move-UMSProfile.md b/Docs/Reference/Move-UMSProfile.md index 8fd8cf7..a833363 100644 --- a/Docs/Reference/Move-UMSProfile.md +++ b/Docs/Reference/Move-UMSProfile.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSProfile.md schema: 2.0.0 --- diff --git a/Docs/Reference/Move-UMSProfileDirectory.md b/Docs/Reference/Move-UMSProfileDirectory.md index f03c87a..0d3b706 100644 --- a/Docs/Reference/Move-UMSProfileDirectory.md +++ b/Docs/Reference/Move-UMSProfileDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSProfileDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/New-UMSAPICookie.md b/Docs/Reference/New-UMSAPICookie.md index 72839c7..269349c 100644 --- a/Docs/Reference/New-UMSAPICookie.md +++ b/Docs/Reference/New-UMSAPICookie.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSAPICookie.md schema: 2.0.0 --- diff --git a/Docs/Reference/New-UMSDevice.md b/Docs/Reference/New-UMSDevice.md index b6158e6..b94dac0 100644 --- a/Docs/Reference/New-UMSDevice.md +++ b/Docs/Reference/New-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/New-UMSDeviceDirectory.md b/Docs/Reference/New-UMSDeviceDirectory.md index 78965ed..2382278 100644 --- a/Docs/Reference/New-UMSDeviceDirectory.md +++ b/Docs/Reference/New-UMSDeviceDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSDeviceDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/New-UMSProfileAssignment.md b/Docs/Reference/New-UMSProfileAssignment.md index 6b3cc08..4653cf7 100644 --- a/Docs/Reference/New-UMSProfileAssignment.md +++ b/Docs/Reference/New-UMSProfileAssignment.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/New-UMSAPICookie.md +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSProfileAssignment.md schema: 2.0.0 --- diff --git a/Docs/Reference/New-UMSProfileDirectory.md b/Docs/Reference/New-UMSProfileDirectory.md index 64ca84f..02df15a 100644 --- a/Docs/Reference/New-UMSProfileDirectory.md +++ b/Docs/Reference/New-UMSProfileDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSProfileDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Remove-UMSDevice.md b/Docs/Reference/Remove-UMSDevice.md index e4a178e..6d57092 100644 --- a/Docs/Reference/Remove-UMSDevice.md +++ b/Docs/Reference/Remove-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Remove-UMSDeviceDirectory.md b/Docs/Reference/Remove-UMSDeviceDirectory.md index 96ef6d8..fd93693 100644 --- a/Docs/Reference/Remove-UMSDeviceDirectory.md +++ b/Docs/Reference/Remove-UMSDeviceDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSDeviceDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Remove-UMSProfile.md b/Docs/Reference/Remove-UMSProfile.md index 84f7b58..5591aa2 100644 --- a/Docs/Reference/Remove-UMSProfile.md +++ b/Docs/Reference/Remove-UMSProfile.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSProfile.md schema: 2.0.0 --- diff --git a/Docs/Reference/Remove-UMSProfileAssignment.md b/Docs/Reference/Remove-UMSProfileAssignment.md index 2c1f56c..2990173 100644 --- a/Docs/Reference/Remove-UMSProfileAssignment.md +++ b/Docs/Reference/Remove-UMSProfileAssignment.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSProfileAssignment.md schema: 2.0.0 --- diff --git a/Docs/Reference/Remove-UMSProfileDirectory.md b/Docs/Reference/Remove-UMSProfileDirectory.md index 1aadfac..62a8c5a 100644 --- a/Docs/Reference/Remove-UMSProfileDirectory.md +++ b/Docs/Reference/Remove-UMSProfileDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSProfileDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Reset-UMSDevice.md b/Docs/Reference/Reset-UMSDevice.md index 056f759..263253c 100644 --- a/Docs/Reference/Reset-UMSDevice.md +++ b/Docs/Reference/Reset-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Reset-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Restart-UMSDevice.md b/Docs/Reference/Restart-UMSDevice.md index 675ad0d..605652e 100644 --- a/Docs/Reference/Restart-UMSDevice.md +++ b/Docs/Reference/Restart-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Restart-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Send-UMSDeviceSetting.md b/Docs/Reference/Send-UMSDeviceSetting.md index e28848a..143cd66 100644 --- a/Docs/Reference/Send-UMSDeviceSetting.md +++ b/Docs/Reference/Send-UMSDeviceSetting.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Send-UMSDeviceSetting.md schema: 2.0.0 --- diff --git a/Docs/Reference/Start-UMSDevice.md b/Docs/Reference/Start-UMSDevice.md index 67abae1..64450be 100644 --- a/Docs/Reference/Start-UMSDevice.md +++ b/Docs/Reference/Start-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Start-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Stop-UMSDevice.md b/Docs/Reference/Stop-UMSDevice.md index a8bb317..32b3b43 100644 --- a/Docs/Reference/Stop-UMSDevice.md +++ b/Docs/Reference/Stop-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Stop-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Update-UMSDevice.md b/Docs/Reference/Update-UMSDevice.md index 7a4c1fa..46c5cbb 100644 --- a/Docs/Reference/Update-UMSDevice.md +++ b/Docs/Reference/Update-UMSDevice.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSDevice.md schema: 2.0.0 --- diff --git a/Docs/Reference/Update-UMSDeviceDirectory.md b/Docs/Reference/Update-UMSDeviceDirectory.md index a768db4..124f300 100644 --- a/Docs/Reference/Update-UMSDeviceDirectory.md +++ b/Docs/Reference/Update-UMSDeviceDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/Update-UMSDevice.md +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSDeviceDirectory.md schema: 2.0.0 --- diff --git a/Docs/Reference/Update-UMSProfile.md b/Docs/Reference/Update-UMSProfile.md index 6e1000f..03e272b 100644 --- a/Docs/Reference/Update-UMSProfile.md +++ b/Docs/Reference/Update-UMSProfile.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSProfile.md schema: 2.0.0 --- diff --git a/Docs/Reference/Update-UMSProfileDirectory.md b/Docs/Reference/Update-UMSProfileDirectory.md index 36367ea..d697c71 100644 --- a/Docs/Reference/Update-UMSProfileDirectory.md +++ b/Docs/Reference/Update-UMSProfileDirectory.md @@ -1,7 +1,7 @@ --- external help file: PSIGEL-help.xml Module Name: PSIGEL -online version: https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/Stop-UMSDevice.md +online version: https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSProfileDirectory.md schema: 2.0.0 --- diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 03d1e29..80b3aa9 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -132,7 +132,7 @@ Tags = @('IGEL', 'UMS', 'IMI') # Eine URL zur Lizenz fuer dieses Modul. - LicenseUri = 'https://github.com/IGEL-Community/PSIGEL/blob/master/LICENSE' + LicenseUri = 'https://github.com/IGEL-Community/PSIGEL/LICENSE' # Eine URL zur Hauptwebsite fuer dieses Projekt. ProjectUri = 'https://github.com/IGEL-Community/PSIGEL' From 35f3a6dafb67605dfe0e0fa792b6e3133e76f190 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:36:55 +0200 Subject: [PATCH 143/145] Update PSIGEL-help.xml --- PSIGEL/en-US/PSIGEL-help.xml | 1442 ++++++++++++++++++---------------- 1 file changed, 761 insertions(+), 681 deletions(-) diff --git a/PSIGEL/en-US/PSIGEL-help.xml b/PSIGEL/en-US/PSIGEL-help.xml index e42657c..a86470e 100644 --- a/PSIGEL/en-US/PSIGEL-help.xml +++ b/PSIGEL/en-US/PSIGEL-help.xml @@ -1,319 +1,5 @@  - - - Get-OSFirmware - Get - OSFirmware - - Gets firmware from a device. - - - - Gets firmware from a device via Posh-SSH. - - - - Get-OSFirmware - - SSHSession - - Posh-SSH SSHSession - - Object - - Object - - - None - - - - - - SSHSession - - Posh-SSH SSHSession - - Object - - Object - - - None - - - - - - System.Object - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - $Params = @{ - ComputerName = 'V10-01' - Credential = Get-Credential - AcceptKey = $true -} -$SSHSession = New-SSHSession @Params - -Get-OSFirmware -SSHSession $SSHSession - -Version -------- -10.05.500.01 - - - - - - - - - - Get-OSUpdateConfiguration - Get - OSUpdateConfiguration - - Gets firmware from a device. - - - - Gets update configuration from a device via Posh-SSH. - - - - Get-OSUpdateConfiguration - - SSHSession - - Posh-SSH SSHSession - - Object - - Object - - - None - - - - - - SSHSession - - Posh-SSH SSHSession - - Object - - Object - - - None - - - - - - System.Object - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - $Params = @{ - ComputerName = 'V10-01' - Credential = Get-Credential - AcceptKey = $true -} -$SSHSession = New-SSHSession @Params - -Get-OSUpdateConfiguration -SSHSession $SSHSession - -Host : V10-01 -Protocol : http -Hostname : igelrmserver -Port : 9080 -Username : igelums -Password : 0009330f34121a177eb62d -Path : ums_filetransfer/IGEL_Universal_Desktop_LX-10.05.500 - - - - - - - - - - Get-OSWifiConnection - Get - OSWifiConnection - - Gets wifi connection from a device. - - - - Gets wifi connection from a device via Posh-SSH. - - - - Get-OSWifiConnection - - SSHSession - - Posh-SSH SSHSession - - Object - - Object - - - None - - - Interface - - Wifi interface of the device - - String - - String - - - wlan0 - - - - - - Interface - - Wifi interface of the device - - String - - String - - - wlan0 - - - SSHSession - - Posh-SSH SSHSession - - Object - - Object - - - None - - - - - - System.Object - - - - - - - - System.String - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - $Params = @{ - ComputerName = 'V10-01' - Credential = Get-Credential - AcceptKey = $true -} -$SSHSession = New-SSHSession @Params - -Get-OSUpdateConfiguration -SSHSession $SSHSession - -Host : V10-01 -Interface : wlan0 -ESSID : WLAN-0123456 -Mode : Managed -Frequency : 5,18 -AccessPoint : 00:42:6D:36:F8:E8 -BitRate : 18 -TxPower : 20 -LinkQualityActual : 68 -LinkQualityMax : 70 -SignalLevel : -42 - - - - - - - Get-UMSDevice @@ -332,7 +18,7 @@ SignalLevel : -42 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -342,7 +28,7 @@ SignalLevel : -42 Int32 - None + 3 Computername @@ -402,7 +88,7 @@ SignalLevel : -42 String[] - None + Tls12 TCPPort @@ -414,7 +100,7 @@ SignalLevel : -42 Int32 - None + 8443 WebSession @@ -434,14 +120,14 @@ SignalLevel : -42 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -489,7 +175,7 @@ SignalLevel : -42 String[] - None + Tls12 TCPPort @@ -501,7 +187,7 @@ SignalLevel : -42 Int32 - None + 8443 WebSession @@ -647,7 +333,12 @@ BiosDate : 01.12.2006 00:00:00 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDevice.md + + @@ -686,12 +377,12 @@ BiosDate : 01.12.2006 00:00:00 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -701,7 +392,7 @@ BiosDate : 01.12.2006 00:00:00 Int32 - None + 3 SecurityProtocol @@ -719,7 +410,7 @@ BiosDate : 01.12.2006 00:00:00 String[] - None + Tls12 WebSession @@ -751,14 +442,14 @@ BiosDate : 01.12.2006 00:00:00 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -794,7 +485,7 @@ BiosDate : 01.12.2006 00:00:00 String[] - None + Tls12 TCPPort @@ -806,7 +497,7 @@ BiosDate : 01.12.2006 00:00:00 Int32 - None + 8443 WebSession @@ -871,7 +562,12 @@ AssignmentPosition : 1 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDeviceAssignment.md + + @@ -891,7 +587,7 @@ AssignmentPosition : 1 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -901,7 +597,7 @@ AssignmentPosition : 1 Int32 - None + 3 Computername @@ -958,7 +654,7 @@ AssignmentPosition : 1 String[] - None + Tls12 TCPPort @@ -970,7 +666,7 @@ AssignmentPosition : 1 Int32 - None + 8443 WebSession @@ -990,14 +686,14 @@ AssignmentPosition : 1 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -1045,7 +741,7 @@ AssignmentPosition : 1 String[] - None + Tls12 TCPPort @@ -1057,7 +753,7 @@ AssignmentPosition : 1 Int32 - None + 8443 WebSession @@ -1138,7 +834,12 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDeviceDirectory.md + + @@ -1177,12 +878,12 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -1192,7 +893,7 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory Int32 - None + 3 SecurityProtocol @@ -1210,7 +911,7 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory String[] - None + Tls12 WebSession @@ -1242,14 +943,14 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -1285,7 +986,7 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory String[] - None + Tls12 TCPPort @@ -1297,7 +998,7 @@ DirectoryChildren : {@{ObjectType=tcdirectory; Id=664}, @{ObjectType=tcdirectory Int32 - None + 8443 WebSession @@ -1361,7 +1062,12 @@ AssignmentPosition : 1 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDeviceDirectoryAssignment.md + + @@ -1612,7 +1318,7 @@ FirmwareId : 39 IsMasterProfile : False OverridesSessions : False Id : 12047 -Name : 06|Passwort_DomaineAutomaticLogin:Off|UDW +Name : 06|Password_DomainAutomaticLogin:Off|UDW ParentId : 11724 MovedToBin : False ObjectType : profile @@ -1632,7 +1338,12 @@ ObjectType : profile - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSDirectoryRecursive.md + + @@ -1652,7 +1363,7 @@ ObjectType : profile ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -1662,7 +1373,7 @@ ObjectType : profile Int32 - None + 3 Computername @@ -1704,7 +1415,7 @@ ObjectType : profile String[] - None + Tls12 TCPPort @@ -1716,7 +1427,7 @@ ObjectType : profile Int32 - None + 8443 WebSession @@ -1736,14 +1447,14 @@ ObjectType : profile ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -1779,7 +1490,7 @@ ObjectType : profile String[] - None + Tls12 TCPPort @@ -1791,7 +1502,7 @@ ObjectType : profile Int32 - None + 8443 WebSession @@ -1856,7 +1567,12 @@ Id Product Version FirmwareType - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSFirmware.md + + @@ -1876,7 +1592,7 @@ Id Product Version FirmwareType ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -1886,7 +1602,7 @@ Id Product Version FirmwareType Int32 - None + 3 Computername @@ -1928,7 +1644,7 @@ Id Product Version FirmwareType String[] - None + Tls12 TCPPort @@ -1940,7 +1656,7 @@ Id Product Version FirmwareType Int32 - None + 8443 WebSession @@ -1960,14 +1676,14 @@ Id Product Version FirmwareType ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -2003,7 +1719,7 @@ Id Product Version FirmwareType String[] - None + Tls12 TCPPort @@ -2015,7 +1731,7 @@ Id Product Version FirmwareType Int32 - None + 8443 WebSession @@ -2107,7 +1823,12 @@ ObjectType : profile - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSProfile.md + + @@ -2127,7 +1848,7 @@ ObjectType : profile ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -2137,7 +1858,7 @@ ObjectType : profile Int32 - None + 3 Computername @@ -2190,7 +1911,7 @@ ObjectType : profile String[] - None + Tls12 TCPPort @@ -2202,7 +1923,7 @@ ObjectType : profile Int32 - None + 8443 WebSession @@ -2222,14 +1943,14 @@ ObjectType : profile ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -2277,7 +1998,7 @@ ObjectType : profile String[] - None + Tls12 TCPPort @@ -2289,7 +2010,7 @@ ObjectType : profile Int32 - None + 8443 WebSession @@ -2365,7 +2086,12 @@ AssignmentPosition : 0 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSProfileAssignment.md + + @@ -2385,7 +2111,7 @@ AssignmentPosition : 0 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -2395,7 +2121,7 @@ AssignmentPosition : 0 Int32 - None + 3 Computername @@ -2452,7 +2178,7 @@ AssignmentPosition : 0 String[] - None + Tls12 TCPPort @@ -2464,7 +2190,7 @@ AssignmentPosition : 0 Int32 - None + 8443 WebSession @@ -2484,14 +2210,14 @@ AssignmentPosition : 0 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -2539,7 +2265,7 @@ AssignmentPosition : 0 String[] - None + Tls12 TCPPort @@ -2551,7 +2277,7 @@ AssignmentPosition : 0 Int32 - None + 8443 WebSession @@ -2638,7 +2364,12 @@ DirectoryChildren : @{ObjectType=profile; Id=669} - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSProfileDirectory.md + + @@ -2677,12 +2408,12 @@ DirectoryChildren : @{ObjectType=profile; Id=669} Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -2692,7 +2423,7 @@ DirectoryChildren : @{ObjectType=profile; Id=669} Int32 - None + 3 SecurityProtocol @@ -2710,7 +2441,7 @@ DirectoryChildren : @{ObjectType=profile; Id=669} String[] - None + Tls12 WebSession @@ -2730,14 +2461,14 @@ DirectoryChildren : @{ObjectType=profile; Id=669} ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -2761,7 +2492,7 @@ DirectoryChildren : @{ObjectType=profile; Id=669} String[] - None + Tls12 TCPPort @@ -2773,7 +2504,7 @@ DirectoryChildren : @{ObjectType=profile; Id=669} Int32 - None + 8443 WebSession @@ -2829,7 +2560,12 @@ Server : igelrmserver:8443 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Get-UMSStatus.md + + @@ -2868,12 +2604,12 @@ Server : igelrmserver:8443 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -2883,7 +2619,7 @@ Server : igelrmserver:8443 Int32 - None + 3 SecurityProtocol @@ -2901,7 +2637,7 @@ Server : igelrmserver:8443 String[] - None + Tls12 WebSession @@ -2967,14 +2703,14 @@ Server : igelrmserver:8443 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -3034,7 +2770,7 @@ Server : igelrmserver:8443 String[] - None + Tls12 TCPPort @@ -3046,7 +2782,7 @@ Server : igelrmserver:8443 Int32 - None + 8443 WebSession @@ -3131,7 +2867,12 @@ $PSDefaultParameterValues += @{ - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSDevice.md + + @@ -3170,12 +2911,12 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -3185,7 +2926,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 3 SecurityProtocol @@ -3203,7 +2944,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 WebSession @@ -3269,14 +3010,14 @@ $PSDefaultParameterValues += @{ ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -3336,7 +3077,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 TCPPort @@ -3348,7 +3089,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 WebSession @@ -3433,7 +3174,12 @@ $PSDefaultParameterValues += @{ - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSDeviceDirectory.md + + @@ -3472,12 +3218,12 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -3487,7 +3233,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 3 SecurityProtocol @@ -3505,7 +3251,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 WebSession @@ -3571,14 +3317,14 @@ $PSDefaultParameterValues += @{ ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -3638,7 +3384,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 TCPPort @@ -3650,7 +3396,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 WebSession @@ -3735,7 +3481,12 @@ $PSDefaultParameterValues += @{ - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSProfile.md + + @@ -3774,12 +3525,12 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -3789,7 +3540,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 3 SecurityProtocol @@ -3807,7 +3558,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 WebSession @@ -3873,14 +3624,14 @@ $PSDefaultParameterValues += @{ ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -3940,7 +3691,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 TCPPort @@ -3952,7 +3703,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 WebSession @@ -4037,7 +3788,12 @@ $PSDefaultParameterValues += @{ - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Move-UMSProfileDirectory.md + + @@ -4076,7 +3832,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 Credential @@ -4093,7 +3849,7 @@ $PSDefaultParameterValues += @{ ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -4103,7 +3859,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 3 SecurityProtocol @@ -4121,7 +3877,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 Confirm @@ -4151,14 +3907,14 @@ $PSDefaultParameterValues += @{ ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -4206,7 +3962,7 @@ $PSDefaultParameterValues += @{ String[] - None + Tls12 TCPPort @@ -4218,7 +3974,7 @@ $PSDefaultParameterValues += @{ Int32 - None + 8443 WhatIf @@ -4281,7 +4037,12 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSAPICookie.md + + @@ -4320,7 +4081,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent Int32 - None + 8443 Department @@ -4409,7 +4170,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -4419,7 +4180,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent Int32 - None + 3 SecurityProtocol @@ -4437,7 +4198,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent String[] - None + Tls12 WebSession @@ -4539,14 +4300,14 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 AssetId @@ -4702,7 +4463,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent String[] - None + Tls12 SerialNumber @@ -4738,7 +4499,7 @@ $WebSession = New-UMSAPICookie -Computername 'igelrmserver' -Credential $Credent Int32 - None + 8443 WebSession @@ -4867,7 +4628,12 @@ ParentId : 665 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSDevice.md + + @@ -4906,12 +4672,12 @@ ParentId : 665 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -4921,7 +4687,7 @@ ParentId : 665 Int32 - None + 3 SecurityProtocol @@ -4939,7 +4705,7 @@ ParentId : 665 String[] - None + Tls12 WebSession @@ -4993,14 +4759,14 @@ ParentId : 665 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -5048,7 +4814,7 @@ ParentId : 665 String[] - None + Tls12 TCPPort @@ -5060,7 +4826,7 @@ ParentId : 665 Int32 - None + 8443 WebSession @@ -5137,7 +4903,12 @@ Directory successfully inserted. 739 Leipzig - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSDeviceDirectory.md + + @@ -5176,12 +4947,12 @@ Directory successfully inserted. 739 Leipzig Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -5191,7 +4962,7 @@ Directory successfully inserted. 739 Leipzig Int32 - None + 3 SecurityProtocol @@ -5209,7 +4980,7 @@ Directory successfully inserted. 739 Leipzig String[] - None + Tls12 WebSession @@ -5291,14 +5062,14 @@ Directory successfully inserted. 739 Leipzig ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -5339,19 +5110,311 @@ Directory successfully inserted. 739 Leipzig ReceiverId - Id of the device or device directory + Id of the device or device directory + + Int32 + + Int32 + + + None + + + ReceiverType + + Type of the device or device directory + + String + + String + + + None + + + SecurityProtocol + + Set SSL/TLS protocol + + String[] + + String[] + + + Tls12 + + + TCPPort + + TCP Port API + + Int32 + + Int32 + + + 8443 + + + WebSession + + Websession Cookie + + Object + + Object + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + SwitchParameter + + SwitchParameter + + + False + + + + + + System.Int32 + + + + + + + + System.String + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + New-UMSProfileAssignment -Computername 'igelrmserver' -WebSession $WebSession -Id 390 -ReceiverId 58 -ReceiverType tc + +Message Id ReceiverId ReceiverType +------- -- ---------- ------------ +1 asssignments successfully assigned. 390 58 tc + + + + + + -------------------------- Example 2 -------------------------- + $PSDefaultParameterValues = @{ + '*-UMS*:Credential' = (Get-Credential) + '*-UMS*:Computername' = 'igelrmserver' +} +$PSDefaultParameterValues += @{ + '*-UMS*:WebSession' = New-UMSAPICookie +} + +(Get-UMSProfile).where{$_.Name -match '^(01|07)'} | + New-UMSProfileAssignment -ReceiverId 664 -ReceiverType tcdirectory + +Message Id ReceiverId ReceiverType +------- -- ---------- ------------ +1 asssignments successfully assigned. 390 664 tcdirectory +1 asssignments successfully assigned. 669 664 tcdirectory + + + + + + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSProfileAssignment.md + + + + + + New-UMSProfileDirectory + New + UMSProfileDirectory + + Creates a profile directory. + + + + Creates a profile directory via API. + + + + New-UMSProfileDirectory + + Computername + + Computername of the UMS Server + + String + + String + + + None + + + TCPPort + + TCP Port API + + Int32 + + Int32 + + + 8443 + + + ApiVersion + + API Version to use + + + 3 + + Int32 + + Int32 + + + 3 + + + SecurityProtocol + + Set SSL/TLS protocol + + + Tls12 + Tls11 + Tls + Ssl3 + + String[] + + String[] + + + Tls12 + + + WebSession + + Websession Cookie + + Object + + Object + + + None + + + Name + + Name of the profile directory + + String + + String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + + + + ApiVersion + + API Version to use + + Int32 + + Int32 + + + 3 + + + Computername + + Computername of the UMS Server + + String + + String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. - Int32 + SwitchParameter - Int32 + SwitchParameter - None + False - - ReceiverType + + Name - Type of the device or device directory + Name of the profile directory String @@ -5370,7 +5433,7 @@ Directory successfully inserted. 739 Leipzig String[] - None + Tls12 TCPPort @@ -5382,7 +5445,7 @@ Directory successfully inserted. 739 Leipzig Int32 - None + 8443 WebSession @@ -5410,14 +5473,6 @@ Directory successfully inserted. 739 Leipzig - - - System.Int32 - - - - - System.String @@ -5445,32 +5500,23 @@ Directory successfully inserted. 739 Leipzig -------------------------- Example 1 -------------------------- - New-UMSProfileAssignment -Computername 'igelrmserver' -WebSession $WebSession -Id 390 -ReceiverId 58 -ReceiverType tc + New-UMSProfileDirectory -Computername 'igelrmserver' -WebSession $WebSession -Name '06' -Message Id ReceiverId ReceiverType -------- -- ---------- ------------ -1 asssignments successfully assigned. 390 58 tc +Message Id Name +------- -- ---- +Directory successfully inserted. 743 06 -------------------------- Example 2 -------------------------- - $PSDefaultParameterValues = @{ - '*-UMS*:Credential' = (Get-Credential) - '*-UMS*:Computername' = 'igelrmserver' -} -$PSDefaultParameterValues += @{ - '*-UMS*:WebSession' = New-UMSAPICookie -} - -(Get-UMSProfile).where{$_.Name -match '^(01|07)'} | - New-UMSProfileAssignment -ReceiverId 664 -ReceiverType tcdirectory + '05', '06' | New-UMSProfileDirectory -Computername 'igelrmserver' -WebSession $WebSession -Message Id ReceiverId ReceiverType -------- -- ---------- ------------ -1 asssignments successfully assigned. 390 664 tcdirectory -1 asssignments successfully assigned. 669 664 tcdirectory +Message Id Name +------- -- ---- +Directory successfully inserted. 744 05 +Directory successfully inserted. 745 06 @@ -5479,25 +5525,25 @@ Message Id ReceiverId ReceiverType Online Version: - https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/New-UMSAPICookie.md + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/New-UMSProfileDirectory.md - New-UMSProfileDirectory - New - UMSProfileDirectory + Remove-UMSAPICookie + Remove + UMSAPICookie - Creates a profile directory. + Removes a websession cookie. - Creates a profile directory via API. + Removes a websession cookie for the UMS API. - New-UMSProfileDirectory + Remove-UMSAPICookie Computername @@ -5520,12 +5566,12 @@ Message Id ReceiverId ReceiverType Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -5535,7 +5581,7 @@ Message Id ReceiverId ReceiverType Int32 - None + 3 SecurityProtocol @@ -5553,7 +5599,7 @@ Message Id ReceiverId ReceiverType String[] - None + Tls12 WebSession @@ -5567,18 +5613,6 @@ Message Id ReceiverId ReceiverType None - - Name - - Name of the profile directory - - String - - String - - - None - Confirm @@ -5607,14 +5641,14 @@ Message Id ReceiverId ReceiverType ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -5640,18 +5674,6 @@ Message Id ReceiverId ReceiverType False - - Name - - Name of the profile directory - - String - - String - - - None - SecurityProtocol @@ -5662,7 +5684,7 @@ Message Id ReceiverId ReceiverType String[] - None + Tls12 TCPPort @@ -5674,7 +5696,7 @@ Message Id ReceiverId ReceiverType Int32 - None + 8443 WebSession @@ -5704,7 +5726,7 @@ Message Id ReceiverId ReceiverType - System.String + Keine @@ -5729,29 +5751,27 @@ Message Id ReceiverId ReceiverType -------------------------- Example 1 -------------------------- - New-UMSProfileDirectory -Computername 'igelrmserver' -WebSession $WebSession -Name '06' + Remove-UMSAPICookie -ComputerName 'igelrmserver' -WebSession $WebSession -Message Id Name -------- -- ---- -Directory successfully inserted. 743 06 +D7588A4A667B3B76650245A8BF335036 - -------------------------- Example 2 -------------------------- - '05', '06' | New-UMSProfileDirectory -Computername 'igelrmserver' -WebSession $WebSession - -Message Id Name -------- -- ---- -Directory successfully inserted. 744 05 -Directory successfully inserted. 745 06 + -------------------------- Example 1 -------------------------- + $null = Remove-UMSAPICookie -ComputerName 'igelrmserver' -WebSession $WebSession - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSAPICookie.md + + @@ -5771,7 +5791,7 @@ Directory successfully inserted. 745 06 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -5781,7 +5801,7 @@ Directory successfully inserted. 745 06 Int32 - None + 3 Computername @@ -5845,7 +5865,7 @@ Directory successfully inserted. 745 06 String[] - None + Tls12 TCPPort @@ -5857,7 +5877,7 @@ Directory successfully inserted. 745 06 Int32 - None + 8443 WebSession @@ -5888,14 +5908,14 @@ Directory successfully inserted. 745 06 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -5955,7 +5975,7 @@ Directory successfully inserted. 745 06 String[] - None + Tls12 TCPPort @@ -5967,7 +5987,7 @@ Directory successfully inserted. 745 06 Int32 - None + 8443 WebSession @@ -6081,7 +6101,12 @@ Offline deletion successful. 752 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSDevice.md + + @@ -6120,12 +6145,12 @@ Offline deletion successful. 752 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -6135,7 +6160,7 @@ Offline deletion successful. 752 Int32 - None + 3 SecurityProtocol @@ -6153,7 +6178,7 @@ Offline deletion successful. 752 String[] - None + Tls12 WebSession @@ -6207,14 +6232,14 @@ Offline deletion successful. 752 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -6262,7 +6287,7 @@ Offline deletion successful. 752 String[] - None + Tls12 TCPPort @@ -6274,7 +6299,7 @@ Offline deletion successful. 752 Int32 - None + 8443 WebSession @@ -6368,7 +6393,12 @@ Deletion successful. 687 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSDeviceDirectory.md + + @@ -6407,12 +6437,12 @@ Deletion successful. 687 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -6422,7 +6452,7 @@ Deletion successful. 687 Int32 - None + 3 SecurityProtocol @@ -6440,7 +6470,7 @@ Deletion successful. 687 String[] - None + Tls12 WebSession @@ -6494,14 +6524,14 @@ Deletion successful. 687 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -6549,7 +6579,7 @@ Deletion successful. 687 String[] - None + Tls12 TCPPort @@ -6561,7 +6591,7 @@ Deletion successful. 687 Int32 - None + 8443 WebSession @@ -6653,7 +6683,12 @@ Deleted profile. 390 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSProfile.md + + @@ -6692,12 +6727,12 @@ Deleted profile. 390 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -6707,7 +6742,7 @@ Deleted profile. 390 Int32 - None + 3 SecurityProtocol @@ -6725,7 +6760,7 @@ Deleted profile. 390 String[] - None + Tls12 WebSession @@ -6739,7 +6774,7 @@ Deleted profile. 390 None - + Id ID of the profile @@ -6807,14 +6842,14 @@ Deleted profile. 390 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -6840,7 +6875,7 @@ Deleted profile. 390 False - + Id ID of the profile @@ -6886,7 +6921,7 @@ Deleted profile. 390 String[] - None + Tls12 TCPPort @@ -6898,7 +6933,7 @@ Deleted profile. 390 Int32 - None + 8443 WebSession @@ -6997,7 +7032,12 @@ deleted profile assignment. 69 71 tcdirectory - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSProfileAssignment.md + + @@ -7036,12 +7076,12 @@ deleted profile assignment. 69 71 tcdirectory Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -7051,7 +7091,7 @@ deleted profile assignment. 69 71 tcdirectory Int32 - None + 3 SecurityProtocol @@ -7069,7 +7109,7 @@ deleted profile assignment. 69 71 tcdirectory String[] - None + Tls12 WebSession @@ -7123,14 +7163,14 @@ deleted profile assignment. 69 71 tcdirectory ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -7178,7 +7218,7 @@ deleted profile assignment. 69 71 tcdirectory String[] - None + Tls12 TCPPort @@ -7190,7 +7230,7 @@ deleted profile assignment. 69 71 tcdirectory Int32 - None + 8443 WebSession @@ -7282,7 +7322,12 @@ Deletion successful. 230 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Remove-UMSProfileDirectory.md + + @@ -7321,12 +7366,12 @@ Deletion successful. 230 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -7336,7 +7381,7 @@ Deletion successful. 230 Int32 - None + 3 SecurityProtocol @@ -7354,7 +7399,7 @@ Deletion successful. 230 String[] - None + Tls12 WebSession @@ -7408,14 +7453,14 @@ Deletion successful. 230 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -7463,7 +7508,7 @@ Deletion successful. 230 String[] - None + Tls12 TCPPort @@ -7475,7 +7520,7 @@ Deletion successful. 230 Int32 - None + 8443 WebSession @@ -7581,7 +7626,12 @@ State : SUCCESS - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Reset-UMSDevice.md + + @@ -7620,12 +7670,12 @@ State : SUCCESS Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -7635,7 +7685,7 @@ State : SUCCESS Int32 - None + 3 SecurityProtocol @@ -7653,7 +7703,7 @@ State : SUCCESS String[] - None + Tls12 WebSession @@ -7707,14 +7757,14 @@ State : SUCCESS ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -7762,7 +7812,7 @@ State : SUCCESS String[] - None + Tls12 TCPPort @@ -7774,7 +7824,7 @@ State : SUCCESS Int32 - None + 8443 WebSession @@ -7873,7 +7923,12 @@ State : SUCCESS - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Restart-UMSDevice.md + + @@ -7912,12 +7967,12 @@ State : SUCCESS Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -7927,7 +7982,7 @@ State : SUCCESS Int32 - None + 3 SecurityProtocol @@ -7945,7 +8000,7 @@ State : SUCCESS String[] - None + Tls12 WebSession @@ -7999,14 +8054,14 @@ State : SUCCESS ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -8054,7 +8109,7 @@ State : SUCCESS String[] - None + Tls12 TCPPort @@ -8066,7 +8121,7 @@ State : SUCCESS Int32 - None + 8443 WebSession @@ -8165,7 +8220,12 @@ State : SUCCESS - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Send-UMSDeviceSetting.md + + @@ -8204,12 +8264,12 @@ State : SUCCESS Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -8219,7 +8279,7 @@ State : SUCCESS Int32 - None + 3 SecurityProtocol @@ -8237,7 +8297,7 @@ State : SUCCESS String[] - None + Tls12 WebSession @@ -8291,14 +8351,14 @@ State : SUCCESS ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -8346,7 +8406,7 @@ State : SUCCESS String[] - None + Tls12 TCPPort @@ -8358,7 +8418,7 @@ State : SUCCESS Int32 - None + 8443 WebSession @@ -8457,7 +8517,12 @@ State : SUCCESS SUCCESS - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Start-UMSDevice.md + + @@ -8496,12 +8561,12 @@ State : SUCCESS SUCCESS Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -8511,7 +8576,7 @@ State : SUCCESS SUCCESS Int32 - None + 3 SecurityProtocol @@ -8529,7 +8594,7 @@ State : SUCCESS SUCCESS String[] - None + Tls12 WebSession @@ -8583,14 +8648,14 @@ State : SUCCESS SUCCESS ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -8638,7 +8703,7 @@ State : SUCCESS SUCCESS String[] - None + Tls12 TCPPort @@ -8650,7 +8715,7 @@ State : SUCCESS SUCCESS Int32 - None + 8443 WebSession @@ -8749,7 +8814,12 @@ State : SUCCESS - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Stop-UMSDevice.md + + @@ -8769,7 +8839,7 @@ State : SUCCESS ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -8779,7 +8849,7 @@ State : SUCCESS Int32 - None + 3 AssetId @@ -8916,7 +8986,7 @@ State : SUCCESS String[] - None + Tls12 SerialNumber @@ -8952,7 +9022,7 @@ State : SUCCESS Int32 - None + 8443 WebSession @@ -8983,14 +9053,14 @@ State : SUCCESS ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 AssetId @@ -9122,7 +9192,7 @@ State : SUCCESS String[] - None + Tls12 SerialNumber @@ -9158,7 +9228,7 @@ State : SUCCESS Int32 - None + 8443 WebSession @@ -9247,7 +9317,12 @@ Update successful. 195 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSDevice.md + + @@ -9286,12 +9361,12 @@ Update successful. 195 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -9301,7 +9376,7 @@ Update successful. 195 Int32 - None + 3 SecurityProtocol @@ -9319,7 +9394,7 @@ Update successful. 195 String[] - None + Tls12 WebSession @@ -9385,14 +9460,14 @@ Update successful. 195 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -9452,7 +9527,7 @@ Update successful. 195 String[] - None + Tls12 TCPPort @@ -9464,7 +9539,7 @@ Update successful. 195 Int32 - None + 8443 WebSession @@ -9564,7 +9639,7 @@ Updated directory successfully. 665 Online Version: - https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/Update-UMSDevice.md + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSDeviceDirectory.md @@ -9605,12 +9680,12 @@ Updated directory successfully. 665 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -9620,7 +9695,7 @@ Updated directory successfully. 665 Int32 - None + 3 SecurityProtocol @@ -9638,7 +9713,7 @@ Updated directory successfully. 665 String[] - None + Tls12 WebSession @@ -9704,14 +9779,14 @@ Updated directory successfully. 665 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -9771,7 +9846,7 @@ Updated directory successfully. 665 String[] - None + Tls12 TCPPort @@ -9783,7 +9858,7 @@ Updated directory successfully. 665 Int32 - None + 8443 WebSession @@ -9881,7 +9956,12 @@ Update successful. 669 - + + + Online Version: + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSProfile.md + + @@ -9920,12 +10000,12 @@ Update successful. 669 Int32 - None + 8443 ApiVersion - API Version to use (Default: 3) + API Version to use 3 @@ -9935,7 +10015,7 @@ Update successful. 669 Int32 - None + 3 SecurityProtocol @@ -9953,7 +10033,7 @@ Update successful. 669 String[] - None + Tls12 WebSession @@ -10019,14 +10099,14 @@ Update successful. 669 ApiVersion - API Version to use (Default: 3) + API Version to use Int32 Int32 - None + 3 Computername @@ -10086,7 +10166,7 @@ Update successful. 669 String[] - None + Tls12 TCPPort @@ -10098,7 +10178,7 @@ Update successful. 669 Int32 - None + 8443 WebSession @@ -10199,7 +10279,7 @@ Updated directory successfully. 668 Online Version: - https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/Stop-UMSDevice.md + https://github.com/IGEL-Community/PSIGEL/Docs/Reference/Update-UMSProfileDirectory.md From 6769111a45feaeb22fa59d2f92b305c56c07c617 Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:50:56 +0200 Subject: [PATCH 144/145] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fe4105..6ff8741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # PSIGEL Changelog -## v0.10.0 - May dd, 2020 +## v0.10.0 - 20200429 ### Added From 477bcc2c8e1984c73152076018b2aead08cdd29c Mon Sep 17 00:00:00 2001 From: falkheiland Date: Wed, 29 Apr 2020 10:50:58 +0200 Subject: [PATCH 145/145] Update PSIGEL.psd1 --- PSIGEL/PSIGEL.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSIGEL/PSIGEL.psd1 b/PSIGEL/PSIGEL.psd1 index 80b3aa9..9f7209a 100644 --- a/PSIGEL/PSIGEL.psd1 +++ b/PSIGEL/PSIGEL.psd1 @@ -142,7 +142,7 @@ # 'ReleaseNotes' des Moduls ReleaseNotes = @' -0.10.0 20200420 +v0.10.0 20200429 * cross platform support (Windows, Linux, MacOS) * support for Powershell 7 * added Remove-UMSAPICookie