3
Any logged-in user can nominate a bug to be fixed in a specific
3
A bug supervisor can nominate a bug to be fixed in a specific
4
4
distribution or product series. Nominations are created by
5
5
calling IBug.addNomination.
7
7
>>> from zope.component import getUtility
8
8
>>> from zope.interface.verify import verifyClass
9
>>> from zope.security.proxy import removeSecurityProxy
10
>>> from canonical.launchpad.ftests import login_person
9
11
>>> from lp.bugs.interfaces.bug import IBugSet
10
12
>>> from lp.bugs.interfaces.bugnomination import IBugNomination
11
13
>>> from lp.bugs.model.bugnomination import BugNomination
12
14
>>> from lp.registry.interfaces.distribution import IDistributionSet
13
15
>>> from lp.registry.interfaces.person import IPersonSet
16
>>> from lp.registry.interfaces.product import IProductSet
17
>>> from lp.testing.sampledata import (ADMIN_EMAIL)
18
>>> login(ADMIN_EMAIL)
19
>>> nominator = factory.makePerson(name='nominator')
20
>>> ubuntu = getUtility(IDistributionSet).getByName("ubuntu")
21
>>> ubuntu = removeSecurityProxy(ubuntu)
22
>>> ubuntu.bug_supervisor = nominator
23
>>> firefox = getUtility(IProductSet).getByName("firefox")
24
>>> firefox = removeSecurityProxy(firefox)
25
>>> firefox.bug_supervisor = nominator
15
>>> login("no-priv@canonical.com")
28
>>> login_person(nominator)
17
30
The BugNomination class implements IBugNomination.
22
35
>>> bugset = getUtility(IBugSet)
23
36
>>> bug_one = bugset.get(1)
25
>>> ubuntu = getUtility(IDistributionSet).getByName("ubuntu")
26
38
>>> ubuntu_grumpy = ubuntu.getSeries("grumpy")
27
39
>>> personset = getUtility(IPersonSet)
28
>>> no_privs = personset.getByName("no-priv")
40
>>> nominator = personset.getByName("nominator")
30
42
>>> grumpy_nomination = bug_one.addNomination(
31
... target=ubuntu_grumpy, owner=no_privs)
43
... target=ubuntu_grumpy, owner=nominator)
33
45
The nomination records the distro series or series for which the bug
34
was nominated and the user that submitted the nomination (the "owner".)
46
was nominated and the user that submitted the nomination (the "owner").
36
48
>>> print grumpy_nomination.owner.name
39
51
>>> print grumpy_nomination.distroseries.fullseriesname
48
60
>>> firefox_trunk = firefox.getSeries("trunk")
50
>>> no_privs = personset.getByName("no-priv")
62
>>> nominator = personset.getByName("nominator")
52
64
>>> firefox_ms_nomination = bug_one.addNomination(
53
... target=firefox_trunk, owner=no_privs)
65
... target=firefox_trunk, owner=nominator)
55
67
>>> print firefox_ms_nomination.owner.name
58
70
>>> print firefox_ms_nomination.productseries.title
59
71
Mozilla Firefox trunk series
151
163
>>> ubuntu_breezy_autotest_nomination = bug_one.addNomination(
152
... target=ubuntu_breezy_autotest, owner=no_privs)
164
... target=ubuntu_breezy_autotest, owner=nominator)
154
166
>>> print ubuntu_breezy_autotest_nomination.status.title
180
192
>>> current_user = getUtility(ILaunchBag).user
182
>>> current_user == no_privs
194
>>> current_user == nominator
184
196
>>> check_permission("launchpad.Driver", firefox_ms_nomination)
187
>>> firefox_ms_nomination.approve(no_privs)
199
>>> firefox_ms_nomination.approve(nominator)
188
200
Traceback (most recent call last):
190
202
Unauthorized: ...
192
>>> firefox_ms_nomination.decline(no_privs)
204
>>> firefox_ms_nomination.decline(nominator)
193
205
Traceback (most recent call last):
195
207
Unauthorized: ...