Ticket #2511: trac.testing.diff
| File trac.testing.diff, 13.2 KB (added by wichert@…, 3 years ago) |
|---|
-
htdocs/css/roadmap.css
9 9 } 10 10 div.progress :link:hover, div.progress :visited:hover { background: #fff } 11 11 div.progress .closed:link, div.progress .closed:visited { background: #bae0ba } 12 div.progress .testing:link, div.progress .testing:visited { background: #fff788 } 12 13 p.percent { font-size: 10px; line-height: 2.4em; margin: 0.9em 0 0 } 13 14 14 15 /* Styles for the roadmap view */ -
trac/db_default.py
344 344 ('status', 'assigned', 2), 345 345 ('status', 'reopened', 3), 346 346 ('status', 'closed', 4), 347 ('status', 'testing', 5), 347 348 ('resolution', 'fixed', 1), 348 349 ('resolution', 'invalid', 2), 349 350 ('resolution', 'wontfix', 3), -
trac/ticket/api.py
29 29 def get_available_actions(self, ticket, perm_): 30 30 """Returns the actions that can be performed on the ticket.""" 31 31 actions = { 32 'new': ['leave', 'resolve', 'reassign', 'accept'], 33 'assigned': ['leave', 'resolve', 'reassign' ], 34 'reopened': ['leave', 'resolve', 'reassign' ], 35 'closed': ['leave', 'reopen'] 32 'new': ['leave', 'testing', 'resolve', 'reassign', 'accept'], 33 'assigned': ['leave', 'testing', 'resolve', 'reassign' ], 34 'reopened': ['leave', 'testing', 'resolve', 'reassign' ], 35 'testing': ['leave', 'resolve', 'reassign', 'reopen'], 36 'closed': ['leave', 'reopen'] 36 37 } 37 38 perms = {'resolve': 'TICKET_MODIFY', 'reassign': 'TICKET_CHGPROP', 39 'testing': 'TICKET_CHGPROP', 38 40 'accept': 'TICKET_CHGPROP', 'reopen': 'TICKET_CREATE'} 39 41 return [action for action in actions.get(ticket['status'], ['leave']) 40 42 if action not in perms or perm_.has_permission(perms[action])] -
trac/ticket/web_ui.py
368 368 elif action == 'reopen': 369 369 ticket['status'] = 'reopened' 370 370 ticket['resolution'] = '' 371 elif action == 'testing': 372 ticket['status'] = 'testing' 373 ticket['resolution'] = '' 371 374 372 375 now = int(time.time()) 373 376 ticket.save_changes(req.args.get('author', req.authname), -
trac/ticket/tests/api.py
55 55 def test_available_actions_full_perms(self): 56 56 ts = TicketSystem(self.env) 57 57 perm = Mock(has_permission=lambda x: 1) 58 self.assertEqual(['leave', ' resolve', 'reassign', 'accept'],58 self.assertEqual(['leave', 'testing', 'resolve', 'reassign', 'accept'], 59 59 ts.get_available_actions({'status': 'new'}, perm)) 60 self.assertEqual(['leave', ' resolve', 'reassign'],60 self.assertEqual(['leave', 'testing', 'resolve', 'reassign'], 61 61 ts.get_available_actions({'status': 'assigned'}, perm)) 62 self.assertEqual(['leave', ' resolve', 'reassign'],62 self.assertEqual(['leave', 'testing', 'resolve', 'reassign'], 63 63 ts.get_available_actions({'status': 'reopened'}, perm)) 64 64 self.assertEqual(['leave', 'reopen'], 65 65 ts.get_available_actions({'status': 'closed'}, perm)) … … 91 91 def test_available_actions_chgprop_only(self): 92 92 ts = TicketSystem(self.env) 93 93 perm = Mock(has_permission=lambda x: x == 'TICKET_CHGPROP') 94 self.assertEqual(['leave', ' reassign', 'accept'],94 self.assertEqual(['leave', 'testing', 'reassign', 'accept'], 95 95 ts.get_available_actions({'status': 'new'}, perm)) 96 self.assertEqual(['leave', ' reassign'],96 self.assertEqual(['leave', 'testing', 'reassign'], 97 97 ts.get_available_actions({'status': 'assigned'}, perm)) 98 self.assertEqual(['leave', ' reassign'],98 self.assertEqual(['leave', 'testing', 'reassign'], 99 99 ts.get_available_actions({'status': 'reopened'}, perm)) 100 100 self.assertEqual(['leave'], 101 101 ts.get_available_actions({'status': 'closed'}, perm)) -
trac/ticket/roadmap.py
49 49 q['all_tickets'] = env.href.query(milestone=milestone) 50 50 q['active_tickets'] = env.href.query(milestone=milestone, 51 51 status=('new', 'assigned', 'reopened')) 52 q['testing_tickets'] = env.href.query(milestone=milestone, 53 status=('testing')) 52 54 q['closed_tickets'] = env.href.query(milestone=milestone, status='closed') 53 55 else: 54 56 q['all_tickets'] = env.href.query({grouped_by: group}, … … 56 58 q['active_tickets'] = env.href.query({grouped_by: group}, 57 59 milestone=milestone, 58 60 status=('new', 'assigned', 'reopened')) 61 q['testing_tickets'] = env.href.query({grouped_by: group}, 62 milestone=milestone, 63 status=('testing')) 59 64 q['closed_tickets'] = env.href.query({grouped_by: group}, 60 65 milestone=milestone, 61 66 status='closed') … … 63 68 64 69 def calc_ticket_stats(tickets): 65 70 total_cnt = len(tickets) 66 active = [ticket for ticket in tickets if ticket['status'] != 'closed'] 71 active = [ticket for ticket in tickets if ticket['status'] != 'closed' and \ 72 ticket['status'] != 'testing' ] 67 73 active_cnt = len(active) 68 closed_cnt = total_cnt - active_cnt 74 testing = [ticket for ticket in tickets if ticket['status'] == 'testing'] 75 testing_cnt = len(testing) 76 closed_cnt = total_cnt - active_cnt - testing_cnt 69 77 70 percent_active, percent_ closed =0, 078 percent_active, percent_testing, percent_closed = 0, 0, 0 71 79 if total_cnt > 0: 72 80 percent_active = round(float(active_cnt) / float(total_cnt) * 100) 81 percent_testing = round(float(testing_cnt) / float(total_cnt) * 100) 73 82 percent_closed = round(float(closed_cnt) / float(total_cnt) * 100) 74 if percent_active + percent_ closed > 100:83 if percent_active + percent_testing + percent_closed > 100: 75 84 percent_closed -= 1 76 85 77 86 return { 78 87 'total_tickets': total_cnt, 79 88 'active_tickets': active_cnt, 80 89 'percent_active': percent_active, 90 'testing_tickets': testing_cnt, 91 'percent_testing': percent_testing, 81 92 'closed_tickets': closed_cnt, 82 93 'percent_closed': percent_closed 83 94 } … … 200 211 status = ticket['status'] 201 212 if status == 'new' or status == 'reopened' and not ticket['owner']: 202 213 return 'NEEDS-ACTION' 203 elif status == 'assigned' or status == 'reopened':214 elif status in [ 'assigned', 'reopened', 'testing']: 204 215 return 'IN-PROCESS' 205 216 elif status == 'closed': 206 217 if ticket['resolution'] == 'fixed': return 'COMPLETED' -
templates/ticket.cs
248 248 call:action_radio('reopen') ?> 249 249 <label for="reopen">reopen ticket</label><br /><?cs 250 250 /if ?><?cs 251 if:ticket.actions.testing ?><?cs 252 call:action_radio('testing') ?> 253 <label for="testing">ready for testing</label><br /><?cs 254 /if ?><?cs 251 255 if:ticket.actions.resolve ?><?cs 252 256 call:action_radio('resolve') ?> 253 257 <label for="resolve">resolve</label><?cs -
templates/roadmap.cs
44 44 var:#stats.closed_tickets ?> of <?cs 45 45 var:#stats.total_tickets ?> ticket<?cs 46 46 if:#stats.total_tickets != #1 ?>s<?cs /if ?> closed"></a> 47 <a class="testing" href="<?cs 48 var:milestone.queries.testing_tickets ?>" style="width: <?cs 49 var:#stats.percent_testing ?>%" title="<?cs 50 var:#stats.testing_tickets ?> of <?Cs 51 var:#stats.total_tickets ?> ticket<?cs 52 if:#stats.total_tickets != #1 ?>s<?cs /if ?> testing"></a> 47 53 <a class="open" href="<?cs 48 54 var:milestone.queries.active_tickets ?>" style="width: <?cs 49 55 var:#stats.percent_active - 1 ?>%" title="<?cs … … 56 62 <dt>Closed tickets:</dt> 57 63 <dd><a href="<?cs var:milestone.queries.closed_tickets ?>"><?cs 58 64 var:stats.closed_tickets ?></a></dd> 65 <dt>Testing tickets:</dt> 66 <dd><a href="<?cs var:milestone.queries.testing_tickets ?>"><?cs 67 var:stats.testing_tickets ?></a></dd> 59 68 <dt>Active tickets:</dt> 60 69 <dd><a href="<?cs var:milestone.queries.active_tickets ?>"><?cs 61 70 var:stats.active_tickets ?></a></dd> -
templates/milestone.cs
124 124 var:#stats.closed_tickets ?> of <?cs 125 125 var:#stats.total_tickets ?> ticket<?cs 126 126 if:#stats.total_tickets != #1 ?>s<?cs /if ?> closed"></a> 127 <a class="testing" href="<?cs 128 var:milestone.queries.testing_tickets ?>" style="width: <?cs 129 var:#stats.percent_testing ?>%" title="<?cs 130 var:#stats.testing_tickets ?> of <?Cs 131 var:#stats.total_tickets ?> ticket<?cs 132 if:#stats.total_tickets != #1 ?>s<?cs /if ?> testing"></a> 127 133 <a class="open" href="<?cs 128 134 var:milestone.queries.active_tickets ?>" style="width: <?cs 129 135 var:#stats.percent_active - 1 ?>%" title="<?cs … … 136 142 <dt>Closed tickets:</dt> 137 143 <dd><a href="<?cs var:milestone.queries.closed_tickets ?>"><?cs 138 144 var:stats.closed_tickets ?></a></dd> 145 <dt>Testing tickets:</dt> 146 <dd><a href="<?cs var:milestone.queries.testingtickets ?>"><?cs 147 var:stats.testing_tickets ?></a></dd> 139 148 <dt>Active tickets:</dt> 140 149 <dd><a href="<?cs var:milestone.queries.active_tickets ?>"><?cs 141 150 var:stats.active_tickets ?></a></dd> … … 170 179 var:group.closed_tickets ?> of <?cs 171 180 var:group.total_tickets ?> ticket<?cs 172 181 if:group.total_tickets != #1 ?>s<?cs /if ?> closed"></a> 182 <a class="testing" href="<?cs 183 var:group.queries.testing_tickets ?>" style="width: <?cs 184 var:#group.percent_testing ?>%" title="<?cs 185 var:group.testing_tickets ?> of <?cs 186 var:group.total_tickets ?> ticket<?cs 187 if:group.total_tickets != #1 ?>s<?cs /if ?> testing"></a> 173 188 <a class="open" href="<?cs 174 189 var:group.queries.active_tickets ?>" style="width: <?cs 175 190 var:#group.percent_active - 1 ?>%" title="<?cs -
contrib/trac-post-commit-hook
99 99 help='The user who is responsible for this action') 100 100 parser.add_option('-m', '--msg', dest='msg', 101 101 help='The log message to search.') 102 parser.add_option('-t', '--testing', dest='testing', 103 action='store_true', default='False', 104 help='Set a ticket to testing instead of resolved if the ' 105 'commit message indicates it is fixed.') 102 106 parser.add_option('-s', '--siteurl', dest='url', 103 107 help='The base URL to the project\'s trac website (to which ' 104 108 '/ticket/## is appended). If this is not specified, ' … … 151 155 for tkt_id in tickets: 152 156 try: 153 157 ticket = Ticket(self.env, tkt_id) 154 ticket['status'] = 'closed' 155 ticket['resolution'] = 'fixed' 158 if options.testing: 159 ticket['status'] = 'testing' 160 ticket['resolution'] = '' 161 else: 162 ticket['status'] = 'closed' 163 ticket['resolution'] = 'fixed' 156 164 ticket.save_changes(self.author, self.msg, self.now) 157 165 tn = TicketNotifyEmail(self.env) 158 166 tn.notify(ticket, newticket=0, modtime=self.now)
