launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18807
[Merge] lp:~cjwatson/launchpad/processor-archtag into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/processor-archtag into lp:launchpad.
Commit message:
Show processor names as well as titles in Archive:+admin.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1360006 in Launchpad itself: "Archive:+admin (at least) should render restricted processors with the architecture tag"
https://bugs.launchpad.net/launchpad/+bug/1360006
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/processor-archtag/+merge/262342
Show processor names as well as titles in Archive:+admin, so that sysadmins who don't have the mapping between them hardwired into their brains have a better chance of getting it right.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/processor-archtag into lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2015-05-19 01:52:14 +0000
+++ lib/lp/soyuz/browser/archive.py 2015-06-18 14:11:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Browser views for archive."""
@@ -2033,7 +2033,8 @@
for processor in sorted(
getUtility(IProcessorSet).getAll(), key=attrgetter('name')):
terms.append(SimpleTerm(
- processor, token=processor.name, title=processor.title))
+ processor, token=processor.name,
+ title="%s (%s)" % (processor.title, processor.name)))
old_field = IArchive['processors']
return form.Fields(
List(__name__=old_field.__name__,
=== modified file 'lib/lp/soyuz/browser/tests/test_archive_admin_view.py'
--- lib/lp/soyuz/browser/tests/test_archive_admin_view.py 2013-05-10 06:44:11 +0000
+++ lib/lp/soyuz/browser/tests/test_archive_admin_view.py 2015-06-18 14:11:47 +0000
@@ -1,16 +1,19 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
+from lp.services.webapp import canonical_url
from lp.services.webapp.servers import LaunchpadTestRequest
from lp.soyuz.browser.archive import ArchiveAdminView
from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
from lp.testing import (
login,
+ login_celebrity,
TestCaseWithFactory,
)
from lp.testing.layers import LaunchpadFunctionalLayer
+from lp.testing.pages import extract_text
class TestArchivePrivacySwitchingView(TestCaseWithFactory):
@@ -88,3 +91,35 @@
'This archive already has published sources. '
'It is not possible to switch the privacy.',
view.errors[0])
+
+
+class TestArchiveAdminView(TestCaseWithFactory):
+
+ layer = LaunchpadFunctionalLayer
+
+ def test_display_processors(self):
+ ppa = self.factory.makeArchive()
+ admin = login_celebrity("admin")
+ browser = self.getUserBrowser(
+ canonical_url(ppa) + "/+admin", user=admin)
+ processors = browser.getControl(name="field.processors")
+ self.assertContentEqual(
+ ["Intel 386 (386)", "AMD 64bit (amd64)", "HPPA Processor (hppa)"],
+ [extract_text(option) for option in processors.displayOptions])
+ self.assertContentEqual(["386", "amd64", "hppa"], processors.options)
+
+ def test_edit_processors(self):
+ ppa = self.factory.makeArchive()
+ admin = login_celebrity("admin")
+ self.assertEqual(
+ ["386", "amd64"], [processor.name for processor in ppa.processors])
+ browser = self.getUserBrowser(
+ canonical_url(ppa) + "/+admin", user=admin)
+ processors = browser.getControl(name="field.processors")
+ self.assertContentEqual(["386", "amd64"], processors.value)
+ processors.value = ["386", "amd64", "hppa"]
+ browser.getControl("Save").click()
+ login_celebrity("admin")
+ self.assertEqual(
+ ["386", "amd64", "hppa"],
+ [processor.name for processor in ppa.processors])
Follow ups