Skip to content

Commit

Permalink
Update tests inline with module changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaydon committed Jan 13, 2023
1 parent 4ab6d8a commit 980c4db
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 73 deletions.
1 change: 1 addition & 0 deletions tests/unit/content.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Describe "New-QlikContentLibrary" {
Mock Get-QlikCustomProperty {
return @{
id = '0959aa45-92df-4fc7-b0e1-f316db3a2f42'
choiceValues = @('Yes', 'it works')
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/unit/dataconnection.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Describe "New-QlikDataConnection" {
Mock Get-QlikCustomProperty {
return @(@{
id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367'
choiceValues = @('development')
})
}

Expand Down
37 changes: 1 addition & 36 deletions tests/unit/rule.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand All @@ -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")'
Expand All @@ -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
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}
}
}
3 changes: 2 additions & 1 deletion tests/unit/stream.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -20,6 +20,7 @@ Describe "New-QlikStream" {
Mock Get-QlikCustomProperty {
return @(@{
id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367'
choiceValues = @('development')
})
}

Expand Down
1 change: 1 addition & 0 deletions tests/unit/task.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Describe "New-QlikTask" {
Mock Get-QlikCustomProperty {
return @(@{
id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367'
choiceValues = @('development')
})
}

Expand Down
1 change: 1 addition & 0 deletions tests/unit/user.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Describe "New-QlikUser" {
Mock Get-QlikCustomProperty {
return @(@{
id = 'daa5005e-5f3b-45c5-b2fd-1a1c92c5f367'
choiceValues = @('development')
})
}

Expand Down
37 changes: 1 addition & 36 deletions tests/unit/userdirectory.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -49,9 +42,6 @@ Describe "Update-QlikUserDirectory" {
tags = @(@{
id = '1b029edc-9c86-4e01-8c39-a10b1d9c4424'
})
customProperties = @(@{
id = 'a834722d-1306-499e-b028-11454240381b'
})
}
}

Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 980c4db

Please sign in to comment.