allura
修訂 | 21d36d31fd0a6a3ce2d8e235241c617c33d305a5 (tree) |
---|---|
時間 | 2012-07-08 06:27:29 |
作者 | Yuriy <yuriyarhipovua@yand...> |
Commiter | Yuriy |
[#4481] ticket:103 tests and pep8
@@ -576,7 +576,6 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact): | ||
576 | 576 | assigned_to_id=self.assigned_to_id and str(self.assigned_to_id) or None, |
577 | 577 | status=self.status, |
578 | 578 | private=self.private, |
579 | - votes=self.votes, | |
580 | 579 | custom_fields=self.custom_fields) |
581 | 580 | |
582 | 581 | @classmethod |
@@ -31,6 +31,8 @@ | ||
31 | 31 | <td class="{{t.open_or_closed}}">{{t.status}}</td> |
32 | 32 | {% elif col['name'] == 'assigned_to' %} |
33 | 33 | <td>{% if t.assigned_to_id %}{{t.assigned_to.display_name}}{% endif %}</td> |
34 | + {% elif col['name'] == 'votes' %} | |
35 | + <td>{{ t.votes }}</td> | |
34 | 36 | {% else %} |
35 | 37 | {% set fld = c.app.globals.get_custom_field(col['name']) %} |
36 | 38 | {% if fld and fld.type == 'user' %} |
@@ -819,6 +819,14 @@ class TestFunctionalController(TrackerTestController): | ||
819 | 819 | assert_in('1', str(votes_up)) |
820 | 820 | assert_in('1', str(votes_down)) |
821 | 821 | |
822 | + r = self.app.get('/bugs/') | |
823 | + assert "Votes" in r | |
824 | + self.app.post( | |
825 | + '/admin/bugs/set_options', | |
826 | + params={'EnableVoting': 'false'}) | |
827 | + r = self.app.get('/bugs/') | |
828 | + assert "Votes" not in r | |
829 | + | |
822 | 830 | |
823 | 831 | class TestMilestoneAdmin(TrackerTestController): |
824 | 832 | def _post(self, params, **kw): |
@@ -64,6 +64,8 @@ def _mongo_col_to_solr_col(name): | ||
64 | 64 | return 'ticket_num_i' |
65 | 65 | elif name == 'summary': |
66 | 66 | return 'snippet_s' |
67 | + elif name == 'votes': | |
68 | + return 'votes_i' | |
67 | 69 | elif name == '_milestone': |
68 | 70 | return '_milestone_s' |
69 | 71 | elif name == 'status': |
@@ -393,6 +395,7 @@ class RootController(BaseController): | ||
393 | 395 | dict(name='summary', sort_name='snippet_s', label='Summary', active=True), |
394 | 396 | dict(name='_milestone', sort_name='_milestone_s', label='Milestone', active=True), |
395 | 397 | dict(name='status', sort_name='status_s', label='Status', active=True), |
398 | + dict(name='votes', sort_name='votes_s', label='Votes', active=True), | |
396 | 399 | dict(name='assigned_to', sort_name='assigned_to_s', label='Owner', active=True)] |
397 | 400 | for field in sortable_custom_fields: |
398 | 401 | columns.append(dict(name=field['name'], sort_name=field['sortable_name'], label=field['label'], active=True)) |
@@ -1479,7 +1482,8 @@ class MilestoneController(BaseController): | ||
1479 | 1482 | milestone=self.milestone, |
1480 | 1483 | total=progress['hits'], |
1481 | 1484 | closed=progress['closed'], |
1482 | - q=self.progress_key) | |
1485 | + q=self.progress_key, | |
1486 | + voting_enabled=True,) | |
1483 | 1487 | result['url_sort'] = '' |
1484 | 1488 | if sort: |
1485 | 1489 | sort_split = sort.split(' ') |