Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Updated

- Updates `Get-TeamViewerGroup` to list the assigned PolicyID of a defined group
- Updates `Get-TeamViewerRole` to list all the possible permissions.
- Updates `Set-TeamViewerManagedDevice` with additional description endpoint.
- Updates all tests to support the changed assertion syntax for Pester 6.0.0 or later.
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
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'

Should -Invoke Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter {
$ApiToken -eq $testApiToken -And `
Expand Down Expand Up @@ -62,4 +65,14 @@ Describe 'Get-TeamViewerGroup' {
Should -Invoke 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'
}
}