Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 2.6.0 (not released yet)

### Updated

- Updates `Get-TeamViewerGroup` to list the assigned PolicyID of a defined group


## 2.5.1 (not released yet)

Expand Down
1 change: 1 addition & 0 deletions Cmdlets/Private/ConvertTo-TeamViewerGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function ConvertTo-TeamViewerGroup {
Id = $InputObject.id
Name = $InputObject.name
Permissions = $InputObject.permissions
PolicyId = $InputObject.policy_id
SharedWith = @($InputObject.shared_with | ConvertTo-TeamViewerGroupShare)
}
if ($InputObject.owner) {
Expand Down
2 changes: 1 addition & 1 deletion Cmdlets/TeamViewerPS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RootModule = 'TeamViewerPS.psm1'

# Version number of this module.
ModuleVersion = '2.5.1'
ModuleVersion = '2.6.0'

# Supported PSEditions.
# CompatiblePSEditions = @()
Expand Down
21 changes: 17 additions & 4 deletions Tests/Public/Get-TeamViewerGroup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ BeforeAll {
Mock Get-TeamViewerApiUri { '//unit.test' }
Mock Invoke-TeamViewerRestMethod { @{
groups = @(
@{ id = 'g1234'; name = 'test group 1' },
@{ id = 'g4567'; name = 'test group 2' },
@{ id = 'g8901'; name = 'test group 3' }
@{ id = 'g1234'; name = 'test group 1'; policy_id = 'p1234' },
@{ id = 'g4567'; name = 'test group 2'; policy_id = 'p4567' },
@{ id = 'g8901'; name = 'test group 3'; policy_id = 'p8901' }
)
} }
Mock Invoke-TeamViewerRestMethod { @{ id = 'g1234'; name = 'test group 1'; policy_id = 'p1234' } } -ParameterFilter {
$Uri -eq '//unit.test/groups/g1234'
}
}

Describe 'Get-TeamViewerGroup' {
Expand All @@ -29,7 +32,7 @@ Describe 'Get-TeamViewerGroup' {
}

It 'Should call the correct API endpoint for single group' {
Get-TeamViewerGroup -ApiToken $testApiToken -Group 'g1234'
Get-TeamViewerGroup -ApiToken $testApiToken -Id 'g1234'

Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter {
$ApiToken -eq $testApiToken -And `
Expand Down Expand Up @@ -62,4 +65,14 @@ Describe 'Get-TeamViewerGroup' {
Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter {
$Body -And $Body['name'] -eq 'TestName' }
}

It 'Should include PolicyId when getting single group' {
$result = Get-TeamViewerGroup -ApiToken $testApiToken -Id 'g1234'
$result.PolicyId | Should -Be 'p1234'
}

It 'Should include PolicyId when filtering groups' {
$result = Get-TeamViewerGroup -ApiToken $testApiToken
$result[0].PolicyId | Should -Be 'p1234'
}
}