Tests/Get-RASite.Tests.ps1
Describe "Get-RASites" { 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" } ) It "<Parameter> is mandatory" -TestCases $mandatoryParameter { param($Parameter) $functionMeta = Get-Command -Name Get-RASites $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 "Returning the Alero applications" { $output = Get-RASites -Authn $auth $output | Should -Not -BeNullOrEmpty $output | Should -BeOfType [PSCustomObject] } } } |