Tests/Edit-RAUser.Tests.ps1
Describe "Edit-RAUser" { BeforeAll { #region Importing the module $dir = Split-Path (Split-Path $PSScriptRoot -Parent) -Leaf Import-Module -Name $dir #endregion #region Importing configuration file $moduleDir = Split-Path -Path $PSScriptRoot -Parent $configFile = Get-Content -Path "$(Split-Path -Path $moduleDir -Parent)\config.json" | ConvertFrom-Json $configPath = "$(Split-Path -Path $moduleDir -Parent)\$($configFile.PrivateKey)" #endregion } Context "Verifying parameters" { $mandatoryParameter = @( @{ Parameter = "Authn" } @{ Parameter = "UserId" } @{ Parameter = "Status" } ) It "<Parameter> is mandatory" -TestCases $mandatoryParameter { param($Parameter) $functionMeta = Get-Command -Name Edit-RAUser $functionMeta.Parameters[$Parameter].Attributes.Mandatory | Should -BeTrue } } Context "Verify the output" { BeforeEach { $auth = New-RAToken -Path $configPath -Datacenter $configFile.Datacenter -TenantID $configFile.TenantID -AsSecureString } It "Edit the Alero user" { $user = Edit-RAUser -Authn $auth -UserId 11ea83a02ec686e38639817872fb7b6e -Status Activated $user | Should -BeNullOrEmpty $user | Should -BeOfType [string] } } } |