Skip to content

Commit

Permalink
Fix initiliazation with empty priority (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
baijum authored Nov 12, 2024
1 parent a4a2bac commit 7a050e7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sync2jira/intermediary.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def from_github(cls, upstream, issue, config):
comments=comments,
tags=issue['labels'],
fixVersion=[issue['milestone']],
priority=issue['priority'],
priority=issue.get('priority'),
content=issue['body'] or '',
reporter=issue['user'],
assignee=issue['assignees'],
Expand Down
42 changes: 42 additions & 0 deletions tests/test_intermediary.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,48 @@ def test_from_github_open(self):
self.assertEqual(response.downstream, {'mock_downstream': 'mock_key'})
self.assertEqual(response.storypoints, 'mock_storypoints')

def test_from_github_open_without_priority(self):
"""
This tests the 'from_github' function under the Issue class
where the state is open but the priority is not initialized.
"""
mock_github_issue = {
'comments': [{
'author': 'mock_author',
'name': 'mock_name',
'body': 'mock_body',
'id': 'mock_id',
'date_created': 'mock_date'
}],
'title': 'mock_title',
'html_url': 'mock_url',
'id': 1234,
'labels': 'mock_tags',
'milestone': 'mock_milestone',
'storypoints': '1.0',
'body': 'mock_content',
'user': 'mock_reporter',
'assignees': 'mock_assignee',
'state': 'open',
'date_created': 'mock_date',
'number': '1',
'storypoints': 'mock_storypoints',
}

# Call the function
response = i.Issue.from_github(
upstream='github',
issue=mock_github_issue,
config=self.mock_config
)

# Assert that we made the calls correctly
self.checkResponseFields(response)

self.assertEqual(response.priority, None)
self.assertEqual(response.status, 'Open')


def test_from_github_closed(self):
"""
This tests the 'from_github' function under the Issue class where the state is closed
Expand Down

0 comments on commit 7a050e7

Please sign in to comment.