Skip to content

Commit

Permalink
Invoke-TssRestApi - add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Dec 29, 2020
1 parent 38032f5 commit 2ce6787
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/functions/Get-TssVersion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Describe "$commandName verify parameters" {
}
}
}

Describe "$commandName works" {
BeforeDiscovery {
$session = New-TssSession -SecretServer $ss -Credential $ssCred
Expand Down
21 changes: 21 additions & 0 deletions tests/functions/Invoke-TssRestApi.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,25 @@ Describe "$commandName Unit Tests" {
$_ | Should -BeNullOrEmpty
}
}
}
Describe "$commandName works" {
BeforeDiscovery {
$session = New-TssSession -SecretServer $ss -Credential $ssCred

$invokeParams = @{ }
$invokeParams.Uri = $session.SecretServer + ($session.ApiVersion, "version" -join '/')
$invokeParams.Method = 'GET'
$invokeParams.PersonalAccessToken = $TssSession.AccessToken
$restResponse = Invoke-TssRestApi @invokeParams

$session.SessionExpire()
}
Context "Checking" -Foreach @{restResponse = $restResponse} {
It "Should not be empty" {
$restResponse | Should -Not -BeNullOrEmpty
}
It "Should be successful" {
$restResponse.success | Should -BeTrue
}
}
}

0 comments on commit 2ce6787

Please sign in to comment.