-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permissions added for user management (#68)
- Loading branch information
1 parent
018f690
commit f7b31d1
Showing
10 changed files
with
105 additions
and
11 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
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
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 |
---|---|---|
|
@@ -52,6 +52,12 @@ Describe 'Get-TeamViewerUser' { | |
$Body -And $Body['email'] -eq '[email protected],[email protected]' } | ||
} | ||
|
||
It 'Should allow to filter by permissions' { | ||
Get-TeamViewerUser -ApiToken $testApiToken -Permissions 'p1', 'p2', 'p3' | ||
Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { | ||
$Body -And $Body['permissions'] -eq 'p1,p2,p3' } | ||
} | ||
|
||
It 'Should allow to retrieve all properties' { | ||
Get-TeamViewerUser -ApiToken $testApiToken -PropertiesToLoad 'All' | ||
|
||
|
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 |
---|---|---|
|
@@ -33,23 +33,36 @@ Describe 'Set-TeamViewerUser' { | |
$testPassword = 'Test1234' | ConvertTo-TestPassword | ||
$testSsoCustomerId = 'SsoTest' | ConvertTo-TestPassword | ||
|
||
Set-TeamViewerUser -ApiToken $testApiToken -User 'u1234' -Name 'Updated User Name' -Email '[email protected]' -Password $testPassword -SsoCustomerIdentifier $testSsoCustomerId -Active $false | ||
Set-TeamViewerUser ` | ||
-ApiToken $testApiToken ` | ||
-User 'u1234' ` | ||
-Name 'Updated User Name' ` | ||
-Email '[email protected]' ` | ||
-Password $testPassword ` | ||
-SsoCustomerIdentifier $testSsoCustomerId ` | ||
-Permissions 'ManageAdmins', 'ManageUsers' ` | ||
-Active $false | ||
|
||
$mockArgs.Body | Should -Not -BeNullOrEmpty | ||
$body = [System.Text.Encoding]::UTF8.GetString($mockArgs.Body) | ConvertFrom-Json | ||
$body.name | Should -Be 'Updated User Name' | ||
$body.email | Should -Be '[email protected]' | ||
$body.password | Should -Be 'Test1234' | ||
$body.sso_customer_id | Should -Be 'SsoTest' | ||
$body.permissions | Should -Be 'ManageAdmins,ManageUsers' | ||
$body.active | Should -BeFalse | ||
} | ||
|
||
It 'Should accept user properties as hashtable' { | ||
Set-TeamViewerUser -ApiToken $testApiToken -User 'u1234' -Property @{ | ||
Set-TeamViewerUser ` | ||
-ApiToken $testApiToken ` | ||
-User 'u1234' ` | ||
-Property @{ | ||
name = 'Updated User Name' | ||
email = '[email protected]' | ||
password = 'Test1234' | ||
sso_customer_id = 'SsoTest' | ||
permissions = 'ManageAdmins,ManageUsers' | ||
active = $false | ||
} | ||
|
||
|
@@ -59,6 +72,7 @@ Describe 'Set-TeamViewerUser' { | |
$body.email | Should -Be '[email protected]' | ||
$body.password | Should -Be 'Test1234' | ||
$body.sso_customer_id | Should -Be 'SsoTest' | ||
$body.permissions | Should -Be 'ManageAdmins,ManageUsers' | ||
$body.active | Should -BeFalse | ||
} | ||
|
||
|