Skip to content

Commit

Permalink
Merge pull request #309 from lipkau/fix/UnassigningOfAnIssue
Browse files Browse the repository at this point in the history
Fixed setting the assignee to null
  • Loading branch information
lipkau authored Aug 20, 2018
2 parents fbe2e75 + dae2b4a commit 3b82e0c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
11 changes: 10 additions & 1 deletion JiraPS/Public/Set-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,16 @@ function Set-JiraIssue {
This behavior should be deprecated
#>
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] 'Unassigned' String passed. Issue will be assigned to no one."
$assigneeString = ""
$assigneeString = $null
$validAssignee = $true
}
elseif ($Assignee -eq "Default") {
<#
#ToDo:Deprecated
This behavior should be deprecated
#>
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] 'Default' String passed. Issue will be assigned to the default assignee."
$assigneeString = "-1"
$validAssignee = $true
}
else {
Expand Down
7 changes: 6 additions & 1 deletion Tests/Set-JiraIssue.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@

It "Unassigns an issue if 'Unassigned' is passed to the -Assignee parameter" {
{ Set-JiraIssue -Issue TEST-001 -Assignee unassigned } | Should Not Throw
Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like "$jiraServer/rest/api/2/issue/12345/assignee" -and $Body -like '*name*""*' }
Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like "$jiraServer/rest/api/2/issue/12345/assignee" -and $Body -like '*"name":*null*' }
}

It "Sets the default assignee to an issue if 'Default' is passed to the -Assignee parameter" {
{ Set-JiraIssue -Issue TEST-001 -Assignee default } | Should Not Throw
Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Put' -and $URI -like "$jiraServer/rest/api/2/issue/12345/assignee" -and $Body -like '*"name":*"-1"*' }
}

It "Calls Invoke-JiraMethod twice if using Assignee and another field" {
Expand Down
10 changes: 9 additions & 1 deletion docs/en-US/commands/Set-JiraIssue.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ This example removes the assignee from JIRA issue TEST-01.

### EXAMPLE 4

```powershell
Set-JiraIssue -Issue TEST-01 -Assignee 'Default'
```

This example will set the assgignee of JIRA issue TEST-01 to the value the project or type of the issue determine as default.

### EXAMPLE 5

```powershell
Set-JiraIssue -Issue TEST-01 -Assignee 'joe' -AddComment 'Dear [~joe], please review.'
```

This example assigns the JIRA Issue TEST-01 to 'joe' and adds a comment at one.

### EXAMPLE 5
### EXAMPLE 6

```powershell
$parameters = @{
Expand Down

0 comments on commit 3b82e0c

Please sign in to comment.