Merge lp:~edwin-grubbs/launchpad/bug-526001-edit-packaging-oops into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Brad Crittenden on 2010-02-24 | ||||
| Approved revision: | not available | ||||
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~edwin-grubbs/launchpad/bug-526001-edit-packaging-oops | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
134 lines (+91/-9) 2 files modified
lib/lp/registry/browser/sourcepackage.py (+16/-9) lib/lp/registry/tests/test_sourcepackage.py (+75/-0) |
||||
| To merge this branch: | bzr merge lp:~edwin-grubbs/launchpad/bug-526001-edit-packaging-oops | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Brad Crittenden (community) | code | 2010-02-23 | Approve on 2010-02-24 |
|
Review via email:
|
|||
Commit Message
Fix oops when changing the sourcepackage's productseries if the current series is obsolete.
| Edwin Grubbs (edwin-grubbs) wrote : | # |
| Brad Crittenden (bac) wrote : | # |
Edwin as we discussed on IRC I think we need a test showing the successful working when the productseries is obsolete. Otherwise it looks good.
| Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Brad,
Thanks for the review. Here are the added tests.
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -22,6 +22,7 @@
from lp.code.
IMakeOffic
from lp.testing import TestCaseWithFactory
+from lp.testing.views import create_
from canonical.
@@ -238,5 +239,79 @@
+class TestSourcePacka
+ """Tests for source package view classes."""
+
+ layer = DatabaseFunctio
+
+ def setUp(self):
+ TestCaseWithFac
+ self.owner = self.factory.
+ self.product = self.factory.
+ name='bonkers', displayname=
+
+ self.obsolete_
+ name='obsolete', product=
+ self.obsolete_
+
+ self.dev_
+ name='current', product=
+ self.dev_
+
+ self.distribution = self.factory.
+ name='youbuntu', displayname=
+ self.distroseries = self.factory.
+ distribution=
+ self.sourcepack
+ name='bonkers')
+ self.package = self.factory.
+ sourcepackagena
+ distroseries=
+
+ def test_editpackag
+ # The sourcepackage's current product series is included in
+ # the vocabulary even if it is obsolete.
+ self.package.
+ form = {
+ 'field.product': 'bonkers',
+ 'field.
+ 'field.
+ }
+ view = create_
+ self.package, name='+
+ principal=
+ self.assertEqua
+ self.assertEqual(
+ self.obsolete_
+ view.view.
+ "The form's default productseries must be the current one.")
+ options = [term.token
+ for term in view.view.
+ self.assertEqual(
+ ['trunk', 'current', 'obsolete'], options,
+ "The obsolete series must be in the vocabulary.")
+
+ def test_editpackag
+ # Obsolete productseries are normally not in the vocabulary.
+ form = {
+ ...

Summary
-------
Fix bug where an exception is raised if you try to change the
productseries for a sourcepackage, when the current productseries
is obsolete.
Implementation details ------- ------- -
-------
If the current context. productseries is not in the series_list variable,
add it. The code that converts the series_list into SimpleTerm objects
was moved below that if-statement.
Tests
-----
./bin/test -vv -t 'xx-distributio n-packages. txt|xx- also-affects- upstream- default- values. txt|sourcepacka ge-views. txt|xx- sourcepackage- packaging. txt'
Demo and Q/A
------------
* Open https:/ /launchpad. dev/ubuntu/ warty/+ source/ mozilla- firefox/ +edit-packaging /launchpad. dev/ubuntu/ warty/+ source/ mozilla- firefox/ +edit-packaging
* Set the product series.
* Open the productseries page that you used.
* Change the status to OBSOLETE.
* Open https:/
* The current project should already be entered, so just click "Continue".
* The obsolete series should show up as a radio button option
instead of raising an exception.