From 9a3dcd35dd7cd2547e3fc70e276c531da94b48fe Mon Sep 17 00:00:00 2001 From: ThePSAdmin Date: Fri, 11 Dec 2015 11:14:10 +0100 Subject: [PATCH 1/3] Added updated test for Custom multi select field --- PSJira/Functions/Set-JiraIssue.Tests.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PSJira/Functions/Set-JiraIssue.Tests.ps1 b/PSJira/Functions/Set-JiraIssue.Tests.ps1 index 051edb5a..f4c4da13 100644 --- a/PSJira/Functions/Set-JiraIssue.Tests.ps1 +++ b/PSJira/Functions/Set-JiraIssue.Tests.ps1 @@ -113,10 +113,12 @@ InModuleScope PSJira { 'ID' = $Field; } } - { Set-JiraIssue -Issue TEST-001 -Fields @{'customfield_12345'='foo'; 'customfield_67890'='bar'} } | Should Not Throw + { Set-JiraIssue -Issue TEST-001 -Fields @{'customfield_12345'='foo'; 'customfield_67890'='bar'; 'customfield_111222'=@(@{value='foobar'})} } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_12345*set*foo*' } Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_67890*set*bar*' } - } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_111222*set*foobar*' } + } + } Context "Input testing" { From 65c07dc3ea7f1f8ac4d2d39c4ae08ce28c5bc09a Mon Sep 17 00:00:00 2001 From: ThePSAdmin Date: Fri, 11 Dec 2015 12:59:24 +0100 Subject: [PATCH 2/3] Update ConvertTo-Json depth --- PSJira/Functions/Set-JiraIssue.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PSJira/Functions/Set-JiraIssue.ps1 b/PSJira/Functions/Set-JiraIssue.ps1 index c0f20c3f..e2a0a0e4 100644 --- a/PSJira/Functions/Set-JiraIssue.ps1 +++ b/PSJira/Functions/Set-JiraIssue.ps1 @@ -181,7 +181,7 @@ function Set-JiraIssue Write-Debug "[Set-JiraIssue] IssueProps: [$issueProps]" Write-Debug "[Set-JiraIssue] Converting results to JSON" - $json = ConvertTo-Json -InputObject $issueProps -Depth 3 + $json = ConvertTo-Json -InputObject $issueProps -Depth 5 $issueObjURL = $issueObj.RestUrl Write-Debug "[Set-JiraIssue] Preparing for blastoff!" From 268ade9b0c4e493f0c5e5685623e61cdf100acb8 Mon Sep 17 00:00:00 2001 From: ThePSAdmin Date: Fri, 11 Dec 2015 13:12:34 +0100 Subject: [PATCH 3/3] Removed whitespace --- PSJira/Functions/Set-JiraIssue.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PSJira/Functions/Set-JiraIssue.Tests.ps1 b/PSJira/Functions/Set-JiraIssue.Tests.ps1 index f4c4da13..cc862122 100644 --- a/PSJira/Functions/Set-JiraIssue.Tests.ps1 +++ b/PSJira/Functions/Set-JiraIssue.Tests.ps1 @@ -116,9 +116,9 @@ InModuleScope PSJira { { Set-JiraIssue -Issue TEST-001 -Fields @{'customfield_12345'='foo'; 'customfield_67890'='bar'; 'customfield_111222'=@(@{value='foobar'})} } | Should Not Throw Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_12345*set*foo*' } Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_67890*set*bar*' } - Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_111222*set*foobar*' } + Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName PSJira -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like '*/rest/api/2/issue/12345' -and $Body -like '*customfield_111222*set*foobar*' } } - + } Context "Input testing" {