← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:distribution-admin-view-default-traversal into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:distribution-admin-view-default-traversal into launchpad:master.

Commit message:
Add default traversal policies to Distribution:+admin

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394392
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:distribution-admin-view-default-traversal into launchpad:master.
diff --git a/lib/lp/registry/browser/distribution.py b/lib/lp/registry/browser/distribution.py
index e401ab8..c499689 100644
--- a/lib/lp/registry/browser/distribution.py
+++ b/lib/lp/registry/browser/distribution.py
@@ -1073,6 +1073,8 @@ class DistributionAdminView(LaunchpadEditFormView):
         'official_packages',
         'supports_ppas',
         'supports_mirrors',
+        'default_traversal_policy',
+        'redirect_default_traversal',
         ]
 
     @property
diff --git a/lib/lp/registry/browser/tests/test_distribution_views.py b/lib/lp/registry/browser/tests/test_distribution_views.py
index 232d421..fde5a8a 100644
--- a/lib/lp/registry/browser/tests/test_distribution_views.py
+++ b/lib/lp/registry/browser/tests/test_distribution_views.py
@@ -10,6 +10,7 @@ from zope.component import getUtility
 from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
 from lp.buildmaster.interfaces.processor import IProcessorSet
 from lp.registry.browser.distribution import DistributionPublisherConfigView
+from lp.registry.enums import DistributionDefaultTraversalPolicy
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.distributionmirror import (
     MirrorContent,
@@ -273,23 +274,33 @@ class TestDistributionAdminView(TestCaseWithFactory):
             form={
                 'field.official_packages': 'on', 'field.supports_ppas': 'on',
                 'field.supports_mirrors': 'on',
+                'field.default_traversal_policy': 'SERIES',
+                'field.redirect_default_traversal': 'on',
                 'field.actions.change': 'change'})
         self.assertThat(
             distribution,
             MatchesStructure.byEquality(
                 official_packages=True, supports_ppas=True,
-                supports_mirrors=True))
+                supports_mirrors=True,
+                default_traversal_policy=(
+                    DistributionDefaultTraversalPolicy.SERIES),
+                redirect_default_traversal=True))
         create_initialized_view(
             distribution, '+admin', principal=admin,
             form={
                 'field.official_packages': '', 'field.supports_ppas': '',
                 'field.supports_mirrors': '',
+                'field.default_traversal_policy': 'OCI_PROJECT',
+                'field.redirect_default_traversal': '',
                 'field.actions.change': 'change'})
         self.assertThat(
             distribution,
             MatchesStructure.byEquality(
                 official_packages=False, supports_ppas=False,
-                supports_mirrors=False))
+                supports_mirrors=False,
+                default_traversal_policy=(
+                    DistributionDefaultTraversalPolicy.OCI_PROJECT),
+                redirect_default_traversal=False))
 
 
 class TestDistroReassignView(TestCaseWithFactory):