Skip to content

Commit

Permalink
Tweak downstream issue code
Browse files Browse the repository at this point in the history
  • Loading branch information
webbnh committed Nov 22, 2024
1 parent f6d94c7 commit a7dcd3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sync2jira/downstream_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ def _update_github_project_fields(client, existing, issue,
log.error("Configuration error: Missing 'storypoints' in `default_jira_fields`")
continue
try:
existing.update({jirafieldname: fieldvalue})
existing[jirafieldname] = fieldvalue
except JIRAError as err:
# Add a comment to indicate there was an issue
client.add_comment(existing, f"Error updating GitHub project storypoints field: {err}")
Expand All @@ -1004,7 +1004,7 @@ def _update_github_project_fields(client, existing, issue,
jira_priority = values.get('options', {}).get(fieldvalue)
if jira_priority:
try:
existing.update({jirafieldname: {'name': jira_priority}})
existing[jirafieldname] = {'name': jira_priority}
except JIRAError as err:
# Add a comment to indicate there was an issue
client.add_comment(existing, f"Error updating GitHub project priority field: {err}")
Expand Down
10 changes: 6 additions & 4 deletions tests/test_downstream_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -1681,9 +1681,10 @@ def test_update_github_project_fields_storypoints(self, mock_client):
"storypoints": {
"gh_field": "Estimate"
}}
d._update_github_project_fields(mock_client, self.mock_downstream, self.mock_issue,
existing = {}
d._update_github_project_fields(mock_client, existing, self.mock_issue,
github_project_fields, self.mock_config)
self.mock_downstream.update.assert_called_with({'customfield_12310243': 2})
self.assertEqual(existing['customfield_12310243'], 2)


@mock.patch('jira.client.JIRA')
Expand All @@ -1703,6 +1704,7 @@ def test_update_github_project_fields_priority(self, mock_client):
"P4": "Optional",
"P5": "Trivial"
}}}
d._update_github_project_fields(mock_client, self.mock_downstream, self.mock_issue,
existing = {}
d._update_github_project_fields(mock_client, existing, self.mock_issue,
github_project_fields, self.mock_config)
self.mock_downstream.update.assert_called_with({'priority': {'name': 'Critical'}})
self.assertEqual(existing['priority'], {'name': 'Critical'})

0 comments on commit a7dcd3b

Please sign in to comment.