From 980c4dbb000349fb6ffaf557e3a679c811585c6e Mon Sep 17 00:00:00 2001 From: Adam Haydon Date: Fri, 13 Jan 2023 14:58:57 +0000 Subject: [PATCH] Update tests inline with module changes --- tests/unit/content.tests.ps1 | 1 + tests/unit/dataconnection.tests.ps1 | 1 + tests/unit/rule.tests.ps1 | 37 +---------------------------- tests/unit/stream.tests.ps1 | 3 ++- tests/unit/task.tests.ps1 | 1 + tests/unit/user.tests.ps1 | 1 + tests/unit/userdirectory.tests.ps1 | 37 +---------------------------- 7 files changed, 8 insertions(+), 73 deletions(-) diff --git a/tests/unit/content.tests.ps1 b/tests/unit/content.tests.ps1 index 233afd0..b10f801 100644 --- a/tests/unit/content.tests.ps1 +++ b/tests/unit/content.tests.ps1 @@ -54,6 +54,7 @@ Describe "New-QlikContentLibrary" { Mock Get-QlikCustomProperty { return @{ id = '0959aa45-92df-4fc7-b0e1-f316db3a2f42' + choiceValues = @('Yes', 'it works') } } diff --git a/tests/unit/dataconnection.tests.ps1 b/tests/unit/dataconnection.tests.ps1 index 9654956..b60021c 100644 --- a/tests/unit/dataconnection.tests.ps1 +++ b/tests/unit/dataconnection.tests.ps1 @@ -24,6 +24,7 @@ Describe "New-QlikDataConnection" { Mock Get-QlikCustomProperty { return @(@{ id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367' + choiceValues = @('development') }) } diff --git a/tests/unit/rule.tests.ps1 b/tests/unit/rule.tests.ps1 index 37f5fda..1c091b7 100644 --- a/tests/unit/rule.tests.ps1 +++ b/tests/unit/rule.tests.ps1 @@ -17,11 +17,6 @@ Describe "New-QlikRule" { id = '177cf33f-1ace-41e8-8382-1c443a51352d' }) } - Mock Get-QlikCustomProperty { - return @(@{ - id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367' - }) - } It 'should create a rule with all parameters' { $rule = New-QlikRule ` @@ -31,8 +26,7 @@ Describe "New-QlikRule" { -resourceFilter 'Stream_*' ` -actions 1 ` -ruleContext 'BothQlikSenseAndQMC' ` - -tags 'testing' ` - -customProperties 'environment=development' + -tags 'testing' $rule.name | Should Be 'Custom Rule' $rule.rule | Should Be '(name = "me")' @@ -41,7 +35,6 @@ Describe "New-QlikRule" { $rule.category | Should Be 'Security' $rule.ruleContext | Should Be 'BothQlikSenseAndQMC' $rule.tags | Should -HaveCount 1 - $rule.customProperties | Should -HaveCount 1 Assert-VerifiableMock } @@ -62,9 +55,6 @@ Describe "Update-QlikRule" { tags = @(@{ id = '1b029edc-9c86-4e01-8c39-a10b1d9c4424' }) - customProperties = @(@{ - id = 'a834722d-1306-499e-b028-11454240381b' - }) } } Mock Get-QlikRule -ParameterFilter { @@ -134,29 +124,4 @@ Describe "Update-QlikRule" { Assert-VerifiableMock } } - - Context 'custom property' { - Mock Get-QlikCustomProperty { - return $null - } - - It 'should be possible to remove all custom properties' { - $dc = Update-QlikRule ` - -id 'e46cc4b4-b248-401a-a2fe-b3170532cc00' ` - -customProperties $null - - $dc.customProperties | Should -BeNullOrEmpty - - Assert-VerifiableMock - } - - It 'should not remove custom properties if parameter not provided' { - $dc = Update-QlikRule ` - -id 'e46cc4b4-b248-401a-a2fe-b3170532cc00' - - $dc.customProperties | Should -HaveCount 1 - - Assert-VerifiableMock - } - } } diff --git a/tests/unit/stream.tests.ps1 b/tests/unit/stream.tests.ps1 index 6b61c46..d3c2199 100644 --- a/tests/unit/stream.tests.ps1 +++ b/tests/unit/stream.tests.ps1 @@ -11,7 +11,7 @@ Describe "New-QlikStream" { return ConvertFrom-Json $body } - Context 'Create rule from parameters' { + Context 'Create stream from parameters' { Mock Get-QlikTag { return @(@{ id = '177cf33f-1ace-41e8-8382-1c443a51352d' @@ -20,6 +20,7 @@ Describe "New-QlikStream" { Mock Get-QlikCustomProperty { return @(@{ id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367' + choiceValues = @('development') }) } diff --git a/tests/unit/task.tests.ps1 b/tests/unit/task.tests.ps1 index 4510252..24e5f7f 100644 --- a/tests/unit/task.tests.ps1 +++ b/tests/unit/task.tests.ps1 @@ -38,6 +38,7 @@ Describe "New-QlikTask" { Mock Get-QlikCustomProperty { return @(@{ id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367' + choiceValues = @('development') }) } diff --git a/tests/unit/user.tests.ps1 b/tests/unit/user.tests.ps1 index 0a499b1..3a0d025 100644 --- a/tests/unit/user.tests.ps1 +++ b/tests/unit/user.tests.ps1 @@ -20,6 +20,7 @@ Describe "New-QlikUser" { Mock Get-QlikCustomProperty { return @(@{ id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367' + choiceValues = @('development') }) } diff --git a/tests/unit/userdirectory.tests.ps1 b/tests/unit/userdirectory.tests.ps1 index 0e5267b..5a17828 100644 --- a/tests/unit/userdirectory.tests.ps1 +++ b/tests/unit/userdirectory.tests.ps1 @@ -17,21 +17,14 @@ Describe "New-QlikUserDirectory" { id = '177cf33f-1ace-41e8-8382-1c443a51352d' }) } - Mock Get-QlikCustomProperty { - return @(@{ - id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367' - }) - } It 'should create a stream with all parameters' { $ud = New-QlikUserDirectory ` -name 'AD' ` - -tags 'testing' ` - -customProperties 'environment=development' + -tags 'testing' $ud.name | Should Be 'AD' $ud.tags | Should -HaveCount 1 - $ud.customProperties | Should -HaveCount 1 Assert-VerifiableMock } @@ -49,9 +42,6 @@ Describe "Update-QlikUserDirectory" { tags = @(@{ id = '1b029edc-9c86-4e01-8c39-a10b1d9c4424' }) - customProperties = @(@{ - id = 'a834722d-1306-499e-b028-11454240381b' - }) } } @@ -79,29 +69,4 @@ Describe "Update-QlikUserDirectory" { Assert-VerifiableMock } } - - Context 'custom property' { - Mock Get-QlikCustomProperty { - return $null - } - - It 'should be possible to remove all custom properties' { - $user = Update-QlikUserDirectory ` - -id '2c317485-1a4a-4112-9bef-e0639262464a' ` - -customProperties $null - - $user.customProperties | Should -BeNullOrEmpty - - Assert-VerifiableMock - } - - It 'should not remove custom properties if parameter not provided' { - $user = Update-QlikUserDirectory ` - -id '2c317485-1a4a-4112-9bef-e0639262464a' - - $user.customProperties | Should -HaveCount 1 - - Assert-VerifiableMock - } - } }