Skip to content

Commit

Permalink
Tests - correct failures
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Aug 17, 2021
1 parent 5e80596 commit 039f56b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 119 deletions.
37 changes: 0 additions & 37 deletions tests/event-pipeline-policy/Get-TssEventPipelinePolicy.Tests.ps1
Expand Up @@ -21,41 +21,4 @@ Describe "$commandName verify parameters" {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.EventPipelinePolicy.Policy'
}
}
}
Describe "$commandName functions" {
Context "Checking" {
BeforeAll {
$session = [pscustomobject]@{
ApiVersion = 'api/v1'
Take = 2147483647
SecretServer = 'http://alpha/'
SecretServerVersion= '10.9.000000'
ApiUrl = 'http://alpha/api/v1'
AccessToken = 'AgJf5YLChrisPine312UcBrM1s1KB2BGZ5Ufc4qLZ'
RefreshToken = '9oacYeah0YqgBNg0L7VinDiesel6-Z9ITE51Humus'
TokenType = 'bearer'
ExpiresIn = 1199
}

Mock -Verifiable -CommandName Invoke-RestMethod -ParameterFilter { $Uri -match '/Endpoint' } -MockWith {
return [pscustomobject]@{
# Object expected by REST API call
}
}
$object = Endpoint -TssSession $session Parameters
Assert-VerifiableMock
}
It "Should not be empty" {
$object | Should -Not -BeNullOrEmpty
}
It "Should have property <_>" -TestCases Properties {
$object[0].PSObject.Properties.Name | Should -Contain $_
}
It "Should have property Property equal value" {
$object.Property | Should -Be value
}
It "Should have called Invoke-RestMethod 2 times" {
Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope Describe
}
}
}
Expand Up @@ -21,41 +21,4 @@ Describe "$commandName verify parameters" {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.EventPipelinePolicy.List'
}
}
}
Describe "$commandName functions" {
Context "Checking" {
BeforeAll {
$session = [pscustomobject]@{
ApiVersion = 'api/v1'
Take = 2147483647
SecretServer = 'http://alpha/'
SecretServerVersion= '10.9.000000'
ApiUrl = 'http://alpha/api/v1'
AccessToken = 'AgJf5YLChrisPine312UcBrM1s1KB2BGZ5Ufc4qLZ'
RefreshToken = '9oacYeah0YqgBNg0L7VinDiesel6-Z9ITE51Humus'
TokenType = 'bearer'
ExpiresIn = 1199
}

Mock -Verifiable -CommandName Invoke-RestMethod -ParameterFilter { $Uri -match '/Endpoint' } -MockWith {
return [pscustomobject]@{
# Object expected by REST API call
}
}
$object = Endpoint -TssSession $session Parameters
Assert-VerifiableMock
}
It "Should not be empty" {
$object | Should -Not -BeNullOrEmpty
}
It "Should have property <_>" -TestCases Properties {
$object[0].PSObject.Properties.Name | Should -Contain $_
}
It "Should have property Property equal value" {
$object.Property | Should -Be value
}
It "Should have called Invoke-RestMethod 2 times" {
Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope Describe
}
}
}
4 changes: 2 additions & 2 deletions tests/event-pipeline/Get-TssEventPipeline.Tests.ps1
Expand Up @@ -17,8 +17,8 @@ Describe "$commandName verify parameters" {
}
}
Context "Command specific details" {
It "$commandName should set OutputType to Thycotic.PowerShell.EventPipeline.Lis" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.EventPipeline.Lis'
It "$commandName should set OutputType to Thycotic.PowerShell.EventPipeline.List" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.EventPipeline.List'
}
}
}
4 changes: 2 additions & 2 deletions tests/event-pipeline/Search-TssEventPipeline.Tests.ps1
Expand Up @@ -17,8 +17,8 @@ Describe "$commandName verify parameters" {
}
}
Context "Command specific details" {
It "$commandName should set OutputType to Thycotic.PowerShell.EventPipeline.List" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.EventPipeline.List'
It "$commandName should set OutputType to Thycotic.PowerShell.EventPipeline.Summary" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.EventPipeline.Summary'
}
}
}
4 changes: 2 additions & 2 deletions tests/metadata/Remove-TssMetadata.Tests.ps1
Expand Up @@ -17,8 +17,8 @@ Describe "$commandName verify parameters" {
}
}
Context "Command specific details" {
It "$commandName should set OutputType to Thycotic.PowerShell.Delete" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.Delete'
It "$commandName should set OutputType to Thycotic.PowerShell.Common.Delete" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.Common.Delete'
}
}
}
2 changes: 1 addition & 1 deletion tests/metadata/Update-TssMetadataField.Tests.ps1
Expand Up @@ -3,7 +3,7 @@ BeforeDiscovery {
}
Describe "$commandName verify parameters" {
BeforeDiscovery {
[object[]]$knownParameters = 'TssSession', 'ItemId', 'ItemType', 'FieldDataType', 'FieldValue'
[object[]]$knownParameters = 'TssSession', 'ItemId', 'ItemType', 'ItemDataId', 'FieldDataType', 'FieldValue'
[object[]]$currentParams = ([Management.Automation.CommandMetaData]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName,'Function')).Parameters.Keys
[object[]]$commandDetails = [System.Management.Automation.CommandInfo]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName,'Function')
$unknownParameters = Compare-Object -ReferenceObject $knownParameters -DifferenceObject $currentParams -PassThru
Expand Down
Expand Up @@ -21,41 +21,4 @@ Describe "$commandName verify parameters" {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.AccessRequests.Request'
}
}
}
Describe "$commandName functions" {
Context "Checking" {
BeforeAll {
$session = [pscustomobject]@{
ApiVersion = 'api/v1'
Take = 2147483647
SecretServer = 'http://alpha/'
SecretServerVersion= '10.9.000000'
ApiUrl = 'http://alpha/api/v1'
AccessToken = 'AgJf5YLChrisPine312UcBrM1s1KB2BGZ5Ufc4qLZ'
RefreshToken = '9oacYeah0YqgBNg0L7VinDiesel6-Z9ITE51Humus'
TokenType = 'bearer'
ExpiresIn = 1199
}

Mock -Verifiable -CommandName Invoke-RestMethod -ParameterFilter { $Uri -match '/Endpoint' } -MockWith {
return [pscustomobject]@{
# Object expected by REST API call
}
}
$object = Endpoint -TssSession $session Parameters
Assert-VerifiableMock
}
It "Should not be empty" {
$object | Should -Not -BeNullOrEmpty
}
It "Should have property <_>" -TestCases Properties {
$object[0].PSObject.Properties.Name | Should -Contain $_
}
It "Should have property Property equal value" {
$object.Property | Should -Be value
}
It "Should have called Invoke-RestMethod 2 times" {
Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope Describe
}
}
}
2 changes: 1 addition & 1 deletion tests/secret-policies/Set-TssSecretPolicy.Tests.ps1
Expand Up @@ -3,7 +3,7 @@ BeforeDiscovery {
}
Describe "$commandName verify parameters" {
BeforeDiscovery {
[object[]]$knownParameters = 'TssSession', 'Name', 'Description', 'Active', 'ItemName', 'ItemApplyType', 'ItemType', 'UserGroupMap'
[object[]]$knownParameters = 'TssSession', 'Id', 'Name', 'Description', 'Active', 'ItemName', 'ItemType', 'ItemApplyType', 'ItemValue', 'UserGroupMap'
[object[]]$currentParams = ([Management.Automation.CommandMetaData]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName,'Function')).Parameters.Keys
[object[]]$commandDetails = [System.Management.Automation.CommandInfo]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName,'Function')
$unknownParameters = Compare-Object -ReferenceObject $knownParameters -DifferenceObject $currentParams -PassThru
Expand Down

0 comments on commit 039f56b

Please sign in to comment.