13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
1 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
4 |
__metaclass__ = type |
|
5 |
||
13169.1.3
by Steve Kowalik
Make use of rSP, and add some comments. |
6 |
from zope.security.proxy import removeSecurityProxy |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
7 |
|
14612.2.1
by William Grant
format-imports on lib/. So many imports. |
8 |
from lp.services.features.testing import FeatureFixture |
14600.2.2
by Curtis Hovey
Moved webapp to lp.services. |
9 |
from lp.services.webapp import canonical_url |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
10 |
from lp.soyuz.enums import PackagePublishingStatus |
14400.2.23
by Curtis Hovey
Use an alternate schema instead of setUpFields to switch from spn to dsp. |
11 |
from lp.testing import TestCaseWithFactory |
14612.2.1
by William Grant
format-imports on lib/. So many imports. |
12 |
from lp.testing.layers import DatabaseFunctionalLayer |
14578.4.4
by William Grant
format-imports. |
13 |
from lp.testing.pages import get_feedback_messages |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
14 |
|
15 |
||
16 |
class TestBugAlsoAffectsDistribution(TestCaseWithFactory): |
|
17 |
||
18 |
layer = DatabaseFunctionalLayer |
|
19 |
||
20 |
def setUp(self): |
|
21 |
super(TestBugAlsoAffectsDistribution, self).setUp() |
|
22 |
self.distribution = self.factory.makeDistribution() |
|
13169.1.3
by Steve Kowalik
Make use of rSP, and add some comments. |
23 |
removeSecurityProxy(self.distribution).official_malone = True |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
24 |
|
14400.2.26
by Curtis Hovey
Fixed comments and documentation. |
25 |
def openBugPage(self, bug): |
26 |
browser = self.getUserBrowser() |
|
27 |
browser.open(canonical_url(bug)) |
|
28 |
return browser |
|
29 |
||
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
30 |
def test_bug_alsoaffects_spn_exists(self): |
13169.1.3
by Steve Kowalik
Make use of rSP, and add some comments. |
31 |
# If the source package name exists, there is no error.
|
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
32 |
bug = self.factory.makeBug() |
33 |
spn = self.factory.makeSourcePackageName() |
|
14400.2.26
by Curtis Hovey
Fixed comments and documentation. |
34 |
browser = self.openBugPage(bug) |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
35 |
browser.getLink(url='+distrotask').click() |
36 |
browser.getControl('Distribution').value = [self.distribution.name] |
|
37 |
browser.getControl('Source Package Name').value = spn.name |
|
38 |
browser.getControl('Continue').click() |
|
39 |
self.assertEqual([], get_feedback_messages(browser.contents)) |
|
40 |
||
14400.2.25
by Curtis Hovey
Use the submitted distribution with the dsp vocab to support spns. |
41 |
def test_bug_alsoaffects_spn_exists_dsp_picker_feature_flag(self): |
42 |
# If the distribution source package for an spn is official,
|
|
43 |
# there is no error.
|
|
44 |
bug = self.factory.makeBug() |
|
45 |
distribution, dsp = self.factory.makeDSPCache( |
|
46 |
distro_name=self.distribution.name, package_name='snarf', |
|
47 |
make_distro=False) |
|
48 |
with FeatureFixture({u"disclosure.dsp_picker.enabled": u"on"}): |
|
14400.2.26
by Curtis Hovey
Fixed comments and documentation. |
49 |
browser = self.openBugPage(bug) |
14400.2.25
by Curtis Hovey
Use the submitted distribution with the dsp vocab to support spns. |
50 |
browser.getLink(url='+distrotask').click() |
51 |
browser.getControl('Distribution').value = [distribution.name] |
|
52 |
browser.getControl('Source Package Name').value = ( |
|
53 |
dsp.sourcepackagename.name) |
|
54 |
browser.getControl('Continue').click() |
|
55 |
self.assertEqual([], get_feedback_messages(browser.contents)) |
|
56 |
||
14400.2.23
by Curtis Hovey
Use an alternate schema instead of setUpFields to switch from spn to dsp. |
57 |
def test_bug_alsoaffects_dsp_exists_dsp_picker_feature_flag(self): |
58 |
# If the distribution source package is official, there is no error.
|
|
59 |
bug = self.factory.makeBug() |
|
60 |
distribution, dsp = self.factory.makeDSPCache( |
|
61 |
distro_name=self.distribution.name, package_name='snarf', |
|
62 |
make_distro=False) |
|
63 |
with FeatureFixture({u"disclosure.dsp_picker.enabled": u"on"}): |
|
14400.2.26
by Curtis Hovey
Fixed comments and documentation. |
64 |
browser = self.openBugPage(bug) |
14400.2.23
by Curtis Hovey
Use an alternate schema instead of setUpFields to switch from spn to dsp. |
65 |
browser.getLink(url='+distrotask').click() |
66 |
browser.getControl('Distribution').value = [distribution.name] |
|
67 |
browser.getControl('Source Package Name').value = ( |
|
68 |
'%s/%s' % (distribution.name, dsp.name)) |
|
69 |
browser.getControl('Continue').click() |
|
70 |
self.assertEqual([], get_feedback_messages(browser.contents)) |
|
71 |
||
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
72 |
def test_bug_alsoaffects_spn_not_exists_with_published_binaries(self): |
13169.1.3
by Steve Kowalik
Make use of rSP, and add some comments. |
73 |
# When the distribution has published binaries, we search both
|
74 |
# source and binary package names.
|
|
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
75 |
bug = self.factory.makeBug() |
76 |
distroseries = self.factory.makeDistroSeries( |
|
77 |
distribution=self.distribution) |
|
78 |
das = self.factory.makeDistroArchSeries(distroseries=distroseries) |
|
14400.2.23
by Curtis Hovey
Use an alternate schema instead of setUpFields to switch from spn to dsp. |
79 |
self.factory.makeBinaryPackagePublishingHistory( |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
80 |
distroarchseries=das, status=PackagePublishingStatus.PUBLISHED) |
81 |
self.assertTrue(self.distribution.has_published_binaries) |
|
14400.2.26
by Curtis Hovey
Fixed comments and documentation. |
82 |
browser = self.openBugPage(bug) |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
83 |
browser.getLink(url='+distrotask').click() |
84 |
browser.getControl('Distribution').value = [self.distribution.name] |
|
85 |
browser.getControl('Source Package Name').value = 'does-not-exist' |
|
86 |
browser.getControl('Continue').click() |
|
87 |
expected = [ |
|
88 |
u'There is 1 error.', |
|
89 |
u'There is no package in %s named "does-not-exist".' % ( |
|
90 |
self.distribution.displayname)] |
|
91 |
self.assertEqual(expected, get_feedback_messages(browser.contents)) |
|
92 |
||
93 |
def test_bug_alsoaffects_spn_not_exists_with_no_binaries(self): |
|
13169.1.3
by Steve Kowalik
Make use of rSP, and add some comments. |
94 |
# When the distribution has no binary packages published, we can't.
|
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
95 |
bug = self.factory.makeBug() |
14400.2.26
by Curtis Hovey
Fixed comments and documentation. |
96 |
browser = self.openBugPage(bug) |
13169.1.1
by Steve Kowalik
* Stop instructing users to file a bug if they can't find a package, and tell |
97 |
browser.getLink(url='+distrotask').click() |
98 |
browser.getControl('Distribution').value = [self.distribution.name] |
|
99 |
browser.getControl('Source Package Name').value = 'does-not-exist' |
|
100 |
browser.getControl('Continue').click() |
|
101 |
expected = [ |
|
102 |
u'There is 1 error.', |
|
103 |
u'There is no package in %s named "does-not-exist". Launchpad ' |
|
104 |
'does not track binary package names in %s.' % ( |
|
105 |
self.distribution.displayname, |
|
106 |
self.distribution.displayname)] |
|
107 |
self.assertEqual(expected, get_feedback_messages(browser.contents)) |