From 4864408add586aa6c818af5476fae6ebf0c0fe61 Mon Sep 17 00:00:00 2001 From: Jake Brinkmann Date: Tue, 22 Jun 2021 12:26:35 -0500 Subject: [PATCH] feat(services.jira): include jiraassignee as new uda field --- bugwarrior/services/jira.py | 9 +++++++++ tests/test_jira.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/bugwarrior/services/jira.py b/bugwarrior/services/jira.py index 6de07ca0a..e585ec326 100644 --- a/bugwarrior/services/jira.py +++ b/bugwarrior/services/jira.py @@ -66,6 +66,7 @@ class JiraIssue(Issue): CREATED_AT = 'jiracreatedts' STATUS = 'jirastatus' SUBTASKS = 'jirasubtasks' + ASSIGNEE = 'jiraassignee' UDAS = { ISSUE_TYPE: { @@ -108,6 +109,10 @@ class JiraIssue(Issue): 'type': 'string', 'label': "Jira Subtasks" }, + ASSIGNEE: { + 'type': 'string', + 'label': "Jira Assignee" + }, } UNIQUE_KEY = (URL, ) @@ -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): @@ -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 diff --git a/tests/test_jira.py b/tests/test_jira.py index a2bb23bfd..0445bf9bf 100644 --- a/tests/test_jira.py +++ b/tests/test_jira.py @@ -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, ), } @@ -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'],