launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01410
Re: [Merge] lp:~edwin-grubbs/launchpad/bug-635302-dsp-filebug-oops into lp:launchpad/devel
Here is a diff of a couple of files that I forgot to commit before.
=== added file 'lib/lp/bugs/browser/tests/test_buglisting.py'
--- lib/lp/bugs/browser/tests/test_buglisting.py 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/browser/tests/test_buglisting.py 2010-10-06 20:20:08 +0000
@@ -0,0 +1,71 @@
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+__metaclass__ = type
+
+from canonical.launchpad.testing.pages import (
+ extract_text,
+ find_tag_by_id,
+ find_tags_by_class,
+ )
+from canonical.launchpad.webapp import canonical_url
+from canonical.testing.layers import LaunchpadFunctionalLayer
+from lp.testing import BrowserTestCase
+
+
+class TestBugTaskSearchListingView(BrowserTestCase):
+
+ layer = LaunchpadFunctionalLayer
+
+ def _makeDistributionSourcePackage(self):
+ distro = self.factory.makeDistribution('test-distro')
+ return self.factory.makeDistributionSourcePackage('test-dsp', distro)
+
+ def test_distributionsourcepackage_unknown_bugtracker_message(self):
+ dsp = self._makeDistributionSourcePackage()
+ url = canonical_url(dsp, rootsite='bugs')
+ browser = self.getUserBrowser(url)
+ top_portlet = find_tags_by_class(
+ browser.contents, 'top-portlet')
+ self.assertTrue(len(top_portlet) > 0,
+ "Tag with class=top-portlet not found")
+ self.assertTextMatchesExpressionIgnoreWhitespace("""
+ test-dsp in test-distro does not use Launchpad for bug tracking.
+ Getting started with bug tracking in Launchpad.""",
+ extract_text(top_portlet[0]))
+
+ def test_distributionsourcepackage_unknown_bugtracker_no_button(self):
+ dsp = self._makeDistributionSourcePackage()
+ url = canonical_url(dsp, rootsite='bugs')
+ browser = self.getUserBrowser(url)
+ self.assertIs(None, find_tag_by_id(browser.contents, 'involvement'),
+ "Involvement portlet with Report-a-bug button should "
+ "not be shown")
+
+ def _makeSourcePackage(self):
+ distro = self.factory.makeDistribution('test-distro')
+ series = self.factory.makeDistroRelease(
+ distribution=distro, name='test-series')
+ return self.factory.makeSourcePackage('test-sp', distro.currentseries)
+
+ def test_sourcepackage_unknown_bugtracker_message(self):
+ sp = self._makeSourcePackage()
+ url = canonical_url(sp, rootsite='bugs')
+ browser = self.getUserBrowser(url)
+ top_portlet = find_tags_by_class(
+ browser.contents, 'top-portlet')
+ self.assertTrue(len(top_portlet) > 0,
+ "Tag with class=top-portlet not found")
+ self.assertTextMatchesExpressionIgnoreWhitespace("""
+ test-sp in Test-distro Test-series does not
+ use Launchpad for bug tracking.
+ Getting started with bug tracking in Launchpad.""",
+ extract_text(top_portlet[0]))
+
+ def test_sourcepackage_unknown_bugtracker_no_button(self):
+ sp = self._makeSourcePackage()
+ url = canonical_url(sp, rootsite='bugs')
+ browser = self.getUserBrowser(url)
+ self.assertIs(None, find_tag_by_id(browser.contents, 'involvement'),
+ "Involvement portlet with Report-a-bug button should "
+ "not be shown")
=== added file 'lib/lp/testing/service_usage_helpers.py'
--- lib/lp/testing/service_usage_helpers.py 1970-01-01 00:00:00 +0000
+++ lib/lp/testing/service_usage_helpers.py 2010-10-06 20:20:08 +0000
@@ -0,0 +1,33 @@
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Helper functions dealing with IServiceUsage."""
+__metaclass__ = type
+
+import transaction
+from zope.component import getUtility
+
+from lp.app.enums import ServiceUsage
+from lp.registry.interfaces.pillar import IPillarNameSet
+from lp.testing import (
+ login,
+ logout,
+ )
+from lp.testing.factory import LaunchpadObjectFactory
+from lp.testing.sampledata import ADMIN_EMAIL
+
+
+def set_service_usage(pillar_name, **kw):
+ factory = LaunchpadObjectFactory()
+ login(ADMIN_EMAIL)
+ pillar = getUtility(IPillarNameSet)[pillar_name]
+ for attr, service_usage_name in kw.items():
+ service_usage = getattr(ServiceUsage, service_usage_name)
+ if attr == 'bug_tracking_usage':
+ pillar.official_malone = (service_usage == ServiceUsage.LAUNCHPAD)
+ if service_usage == ServiceUsage.EXTERNAL:
+ pillar.bugtracker = factory.makeBugTracker()
+ else:
+ setattr(pillar, attr, service_usage)
+ #transaction.commit()
+ logout()
--
https://code.launchpad.net/~edwin-grubbs/launchpad/bug-635302-dsp-filebug-oops/+merge/37679
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~edwin-grubbs/launchpad/bug-635302-dsp-filebug-oops into lp:launchpad/devel.
References