-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🌐 UPDATE docs small fix * ✨ ♻️ UPDATE Get-PASAccountActivity Adds Gen2 replacement for deprecated Gen1 API. Default operation will be against the Gen2 API. The `UseGen1API` parameter will need to be used to target the Gen1 API if Gen2 is not available. * 📝 🔖 Doc Updates General Updates for new version and new year * ➕ ✨ ADDS Version 14.0 Functions + Updates - `Get-PASPTARiskEvent` - New filter parameters `FromTime` & `ToTime` - Fixes output and result paging - `Set-PASPTARiskEvent` - New parameters `closeReason` & `reasonText` - General Fixes - `New-PASDirectoryMapping` - New parameters `UsedQuota`, `AuthorizedInterfaces` & `EnableENEWhenDisconnected` - `Set-PASDirectoryMapping` - New parameters `UsedQuota`, `AuthorizedInterfaces` & `EnableENEWhenDisconnected` - `Add-PASPTAExcludedTarget` - New command, supported from 14.0 - `Add-PASPTAIncludedTarget` - New command, supported from 14.0 - `Add-PASPTAPrivilegedGroup` - New command, supported from 14.0 - `Add-PASPTAPrivilegedUser` - New command, supported from 14.0 - `Get-PASPTAExcludedTarget` - New command, supported from 14.0 - `Get-PASPTAIncludedTarget` - New command, supported from 14.0 - `Get-PASPTAPrivilegedGroup` - New command, supported from 14.0 - `Get-PASPTAPrivilegedUser` - New command, supported from 14.0 - `Remove-PASPTAExcludedTarget` - New command, supported from 14.0 - `Remove-PASPTAIncludedTarget` - New command, supported from 14.0 - `Remove-PASPTAPrivilegedGroup` - New command, supported from 14.0 - `Remove-PASPTAPrivilegedUser` - New command, supported from 14.0 * Update Get-PASPTARiskEvent.Tests.ps1 Fix date format issue when testing in different culture systems * Update Get-PASPTARiskEvent.Tests.ps1 fix copy/paste error * Update Get-PASPTARiskEvent.Tests.ps1 Adding milliseconds to date request * ⚗️🚸🥅 UPDATE ISPSS Error Handling Changes the way errors caught when operating against ISPSS Shared Services tenants are handled. Instead of assuming the `error_description` & `error` properties will always be present in the caught error object, we first set a default state for the error to be returned from psPAS, then update it using the `error_description` & `error` properties only if they are present. Attempts to avoid condition reported where user experience is an error from psPAS about not handling an error from PCloud due to the `error_description` & `error` properties not being found. * Update Invoke-PASRestMethod.ps1 Corrects a copy/paste error introduced in previous commit * Update CHANGELOG.md * ⚗️ADD Get-PASLinkedGroup New function based on undocumented API to get linked groups associated with an account * Update CHANGELOG.md * Create 2024-02-01-pspas-release-6-1.md * Update CHANGELOG.md
- Loading branch information
Showing
71 changed files
with
6,049 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
Describe $($PSCommandPath -Replace '.Tests.ps1') { | ||
|
||
BeforeAll { | ||
#Get Current Directory | ||
$Here = Split-Path -Parent $PSCommandPath | ||
|
||
#Assume ModuleName from Repository Root folder | ||
$ModuleName = Split-Path (Split-Path $Here -Parent) -Leaf | ||
|
||
#Resolve Path to Module Directory | ||
$ModulePath = Resolve-Path "$Here\..\$ModuleName" | ||
|
||
#Define Path to Module Manifest | ||
$ManifestPath = Join-Path "$ModulePath" "$ModuleName.psd1" | ||
|
||
if ( -not (Get-Module -Name $ModuleName -All)) { | ||
|
||
Import-Module -Name "$ManifestPath" -ArgumentList $true -Force -ErrorAction Stop | ||
|
||
} | ||
|
||
$Script:RequestBody = $null | ||
$Script:BaseURI = 'https://SomeURL/SomeApp' | ||
$Script:ExternalVersion = '0.0' | ||
$Script:WebSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession | ||
|
||
} | ||
|
||
|
||
AfterAll { | ||
|
||
$Script:RequestBody = $null | ||
|
||
} | ||
|
||
InModuleScope $(Split-Path (Split-Path (Split-Path -Parent $PSCommandPath) -Parent) -Leaf ) { | ||
|
||
BeforeEach { | ||
|
||
Mock Invoke-PASRestMethod -MockWith { | ||
|
||
} | ||
|
||
$SomePassword = $('Some_Password' | ConvertTo-SecureString -AsPlainText -Force) | ||
|
||
$InputObj = [pscustomobject]@{ | ||
'cidr' = '10.10.10.10/32' | ||
|
||
} | ||
|
||
$response = $InputObj | Add-PASPTAExcludedTarget | ||
|
||
} | ||
|
||
|
||
|
||
Context 'Mandatory Parameters' { | ||
|
||
$Parameters = @{Parameter = 'cidr' } | ||
|
||
It 'specifies parameter <Parameter> as mandatory' -TestCases $Parameters { | ||
|
||
param($Parameter) | ||
|
||
(Get-Command Add-PASPTAExcludedTarget).Parameters["$Parameter"].Attributes.Mandatory | Should -Be $true | ||
|
||
} | ||
|
||
} | ||
|
||
Context 'Input' { | ||
|
||
It 'sends request' { | ||
|
||
Assert-MockCalled Invoke-PASRestMethod -Times 1 -Exactly -Scope It | ||
|
||
} | ||
|
||
It 'sends request to expected endpoint' { | ||
|
||
Assert-MockCalled Invoke-PASRestMethod -ParameterFilter { | ||
|
||
$URI -eq "$($Script:BaseURI)/api/pta/API/Administration/properties/CidrExclusionList" | ||
|
||
} -Times 1 -Exactly -Scope It | ||
|
||
} | ||
|
||
It 'uses expected method' { | ||
|
||
Assert-MockCalled Invoke-PASRestMethod -ParameterFilter { $Method -match 'PATCH' } -Times 1 -Exactly -Scope It | ||
|
||
} | ||
|
||
It 'sends request with expected body' { | ||
|
||
Assert-MockCalled Invoke-PASRestMethod -ParameterFilter { | ||
|
||
$Script:RequestBody = $Body | ConvertFrom-Json | ||
|
||
($Script:RequestBody) -ne $null | ||
|
||
} -Times 1 -Exactly -Scope It | ||
|
||
} | ||
|
||
It 'has a request body with expected number of properties' { | ||
|
||
($Script:RequestBody | Get-Member -MemberType NoteProperty).length | Should -Be 1 | ||
|
||
} | ||
|
||
It 'throws error if version requirement not met' { | ||
|
||
$Script:ExternalVersion = '1.0' | ||
|
||
{ $InputObj | Add-PASPTAExcludedTarget } | Should -Throw | ||
|
||
$Script:ExternalVersion = '0.0' | ||
} | ||
|
||
} | ||
|
||
Context 'Output' { | ||
|
||
It 'provides no output' { | ||
|
||
$response | Should -BeNullOrEmpty | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.