Skip to content

Commit

Permalink
Updates New-TeamViewerUser.Tests.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianJ-TV committed Oct 12, 2023
1 parent 4eff85c commit 4877941
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Tests/Public/New-TeamViewerUser.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ BeforeAll {
# We do this only for testing
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param()
Process { $_ | ConvertTo-SecureString -AsPlainText -Force }
Process {
$_ | ConvertTo-SecureString -AsPlainText -Force
}
}
}

Expand All @@ -25,9 +27,7 @@ Describe 'New-TeamViewerUser' {
New-TeamViewerUser -ApiToken $testApiToken -Name 'Unit Test User' -Email '[email protected]' -WithoutPassword

Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter {
$ApiToken -eq $testApiToken -And `
$Uri -eq '//unit.test/users' -And `
$Method -eq 'Post' }
$ApiToken -eq $testApiToken -And $Uri -eq '//unit.test/users' -And $Method -eq 'Post' }
}

It 'Should include the given name and email in the request' {
Expand Down Expand Up @@ -64,6 +64,7 @@ Describe 'New-TeamViewerUser' {

It 'Should allow to specify a password for the new user' {
$testPassword = 'Test1234' | ConvertTo-TestPassword

New-TeamViewerUser -ApiToken $testApiToken -Name 'Unit Test User' -Email '[email protected]' -Password $testPassword

$mockArgs.Body | Should -Not -BeNullOrEmpty
Expand All @@ -73,6 +74,7 @@ Describe 'New-TeamViewerUser' {

It 'Should allow to create a SSO-enabled user' {
$testSsoCustomerId = 'my-sso-customer-id' | ConvertTo-TestPassword

New-TeamViewerUser -ApiToken $testApiToken -Name 'Unit Test User' -Email '[email protected]' -WithoutPassword -SsoCustomerIdentifier $testSsoCustomerId

$mockArgs.Body | Should -Not -BeNullOrEmpty
Expand Down

0 comments on commit 4877941

Please sign in to comment.