@@ -67,6 +67,13 @@ class Command(BaseCommand):
6767 default = 'nosetests.xml' ,
6868 help = 'Location of test results' ,
6969 ),
70+ make_option (
71+ '--jira-default-assignee' ,
72+ action = 'store' ,
73+ dest = 'jira_default_assignee' ,
74+ default = '' ,
75+ help = 'Default assignee for new user' ,
76+ )
7077 )
7178
7279 def handle (self , * args , ** options ):
@@ -75,6 +82,7 @@ def handle(self, *args, **options):
7582 self .jira_server = options ['jira_server' ]
7683 self .jira_username = options ['jira_username' ]
7784 self .jira_password = options ['jira_password' ]
85+ self .jira_default_assignee = options ['jira_default_assignee' ]
7886 test_results = options ['test_results' ]
7987
8088 self .repo = Repo ()
@@ -103,8 +111,13 @@ def handle(self, *args, **options):
103111 results = []
104112 for testcase in root :
105113 if testcase :
106- results .append (self .handle_testcase (testcase ))
107- return '\n ' .join (results )
114+ result = self .handle_testcase (testcase )
115+ if result is not None :
116+ results .append (result )
117+ if results :
118+ return '\n ' .join (results )
119+ else :
120+ return 'No errors in tests'
108121 else :
109122 return 'No errors in tests'
110123 except IOError :
@@ -184,19 +197,29 @@ def handle_jira(self, path, authors, classname, testcase):
184197 )
185198 else :
186199 # Create issue
187- assignee = jira .search_users (
200+ assignees = []
201+ assignees .extend (jira .search_users (
188202 user = authors ['function' ].email ,
189203 maxResults = 1
190- )
204+ ))
205+ assignees .extend (jira .search_users (
206+ user = authors ['failure' ].email ,
207+ maxResults = 1
208+ ))
209+ if self .jira_default_assignee :
210+ assignees .extend (jira .search_users (
211+ user = self .jira_default_assignee ,
212+ maxResults = 1
213+ ))
191214 issue_dict = dict (
192215 project = {'key' : self .project_key },
193216 summary = summary ,
194217 issuetype = {'name' : self .issue_type },
195218 priority = {'id' : jira .priorities ()[- 1 ].id },
196219 description = 'Description here' ,
197220 )
198- if assignee :
199- issue_dict ['assignee' ] = {'name' : assignee [0 ].name }
221+ if assignees :
222+ issue_dict ['assignee' ] = {'name' : assignees [0 ].name }
200223 new_issue = jira .create_issue (fields = issue_dict )
201224 return 'New issue "{0}" has been created' .format (new_issue )
202225 except JIRAError as e :
0 commit comments