~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
= Review Nominated Bugs =

== Distribution Series ==

From the distribution series bug page you can go to a page to review
all the bugs nominated for this series.

    >>> anon_browser.open('http://bugs.launchpad.dev/ubuntu/hoary')
    >>> anon_browser.getLink('Review nominations').click()
    >>> print anon_browser.title
    Bugs : Hoary : Bugs : Hoary (5.04) : Ubuntu

All the basic bug details are displayed.

    >>> from lp.bugs.tests.bug import print_bugtasks
    >>> print_bugtasks(anon_browser.contents)
    1  Firefox does not support SVG  mozilla-firefox  Medium  New

There are no controls for approving/declining the nominations if the
user don't have permissions to do it.

    >>> user_browser.open('http://bugs.launchpad.dev/ubuntu/hoary')
    >>> user_browser.getLink('Review nominations').click()
    >>> print anon_browser.title
    Bugs : Hoary : Bugs : Hoary (5.04) : Ubuntu

    >>> print_bugtasks(user_browser.contents)
    1  Firefox does not support SVG  mozilla-firefox  Medium  New

    >>> bug_listing = find_tag_by_id(user_browser.contents, 'buglisting')
    >>> def print_which_items_have_widgets(bug_listing):
    ...     for tr in bug_listing.tbody('tr'):
    ...         approve_td, icon_td, bug_id = tr('td')[:3]
    ...         if not bug_id.renderContents().isdigit():
    ...             # No widget column is rendered at all.
    ...             has_input_controls = False
    ...             bug_id = icon_td
    ...         else:
    ...             has_input_controls = (
    ...                 approve_td.renderContents().strip() != '')
    ...         print "%s: %s" % (extract_text(bug_id), has_input_controls)
    >>> print_which_items_have_widgets(bug_listing)
    1: False

No button for submitting the form is shown, nor is the approve/decline
header:

    >>> user_browser.getControl('Save changes')
    Traceback (most recent call last):
    ...
    LookupError: label 'Save changes'

    >>> for th in bug_listing.thead('th'):
    ...     print "'%s'" % extract_text(th).strip()
    'Summary'
    'Package'
    'Importance'
    'Status'

Someone with enough permissions sees controls for approving/declining
nominations.

    >>> admin_browser.open('http://bugs.launchpad.dev/ubuntu/hoary')
    >>> admin_browser.getLink('Review nominations').click()
    >>> print anon_browser.title
    Bugs : Hoary : Bugs : Hoary (5.04) : Ubuntu

    >>> print_bugtasks(admin_browser.contents)
    1  Firefox does not support SVG  mozilla-firefox  Medium  New

    >>> bug_listing = find_tag_by_id(admin_browser.contents, 'buglisting')
    >>> print_which_items_have_widgets(bug_listing)
    1: True

    >>> for th in bug_listing.thead('th'):
    ...     print "'%s'" % extract_text(th).strip()
    'Accept Decline No change'
    'Summary'
    'Package'
    'Importance'
    'Status'

After approving the nominated bugs, the listing is empty.

    # Use the DB classes directly to avoid having to setup a zope interaction
    # (i.e. login()) and bypass the security proxy.
    >>> from lp.bugs.model.bug import Bug
    >>> from lp.registry.model.distribution import Distribution
    >>> login('admin@canonical.com')
    >>> ubuntu = Distribution.selectOneBy(name='ubuntu')
    >>> hoary = ubuntu.getSeries('hoary')
    >>> bug_one = Bug.get(1)
    >>> hoary_nomination_id = bug_one.getNominationFor(hoary).id
    >>> logout()
    >>> nomination_control = admin_browser.getControl(
    ...     name='field.review_action_%s' % hoary_nomination_id)
    >>> nomination_control.getControl(value='ACCEPT').click()
    >>> admin_browser.getControl('Save changes').click()
    >>> for message in get_feedback_messages(admin_browser.contents):
    ...     print message
    1 nomination(s) accepted

    >>> print find_tag_by_id(admin_browser.contents, 'buglisting')
    None
    >>> user_browser.getControl('Save changes')
    Traceback (most recent call last):
    ...
    LookupError: label 'Save changes'

== Product Series ==

A product series has the same nomination listing as a distro series.

    >>> user_browser.open('http://bugs.launchpad.dev/firefox/1.0')
    >>> user_browser.getLink('Review nominations').click()
    >>> print user_browser.title
     Bugs : 1.0 : Bugs : Series 1.0 : Mozilla Firefox

    >>> print_bugtasks(user_browser.contents)
    1  Firefox does not support SVG Low  New

    # Use the DB classes directly to avoid having to setup a zope interaction
    # (i.e. login()) and bypass the security proxy.
    >>> from lp.registry.model.product import Product
    >>> firefox = Product.byName('firefox')
    >>> firefox_1_0 = firefox.getSeries('1.0')
    >>> bug_one = Bug.get(1)
    >>> firefox_nomination = bug_one.getNominationFor(firefox_1_0)

    >>> admin_browser.open('http://bugs.launchpad.dev/firefox/1.0')
    >>> admin_browser.getLink('Review nominations').click()
    >>> nomination_control = admin_browser.getControl(
    ...     name='field.review_action_%s' % firefox_nomination.id)
    >>> nomination_control.getControl(value='DECLINE').click()
    >>> admin_browser.getControl('Save changes').click()
    >>> for message in get_feedback_messages(admin_browser.contents):
    ...     print message
    1 nomination(s) declined