Skip to content

Commit

Permalink
feat(services.jira): include jiraassignee as new uda field
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebrinkmann committed Jun 22, 2021
1 parent 86a0d15 commit 4864408
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bugwarrior/services/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class JiraIssue(Issue):
CREATED_AT = 'jiracreatedts'
STATUS = 'jirastatus'
SUBTASKS = 'jirasubtasks'
ASSIGNEE = 'jiraassignee'

UDAS = {
ISSUE_TYPE: {
Expand Down Expand Up @@ -108,6 +109,10 @@ class JiraIssue(Issue):
'type': 'string',
'label': "Jira Subtasks"
},
ASSIGNEE: {
'type': 'string',
'label': "Jira Assignee"
},
}
UNIQUE_KEY = (URL, )

Expand Down Expand Up @@ -142,6 +147,7 @@ def to_taskwarrior(self):
self.FIX_VERSION: self.get_fix_version(),
self.STATUS: self.get_status(),
self.SUBTASKS: self.get_subtasks(),
self.ASSIGNEE: self.get_assignee(),
}

def get_entry(self):
Expand Down Expand Up @@ -269,6 +275,9 @@ def get_subtasks(self):
def get_issue_type(self):
return self.record['fields']['issuetype']['name']

def get_assignee(self):
return self.record['fields']['assignee']['emailAddress']


class JiraService(IssueService):
ISSUE_CLASS = JiraIssue
Expand Down
2 changes: 2 additions & 0 deletions tests/test_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class TestJiraIssue(AbstractServiceTest, ServiceTest):
'issuetype': {'name': 'Epic'},
'status': {'name': 'Open'},
'subtasks': [{'key': 'DONUT-%s' % subtask} for subtask in arbitrary_subtask_ids]
'assignee': {'displayName': 'Super Potato', 'emailAddress': 'potato@tomatocom'}
},
'key': '%s-%s' % (arbitrary_project, arbitrary_id, ),
}
Expand Down Expand Up @@ -90,6 +91,7 @@ def test_to_taskwarrior(self):
'jiraissuetype': 'Epic',
'jirastatus': 'Open',
'jirasubtasks': 'DONUT-11,DONUT-12',
'jiraassignee': 'potato@tomatocom'

issue.URL: arbitrary_url,
issue.FOREIGN_ID: self.arbitrary_record['key'],
Expand Down

0 comments on commit 4864408

Please sign in to comment.