' in view())
+class TestHasSpecificationsTemplates(TestCaseWithFactory):
+ """Tests the selection of templates based on blueprints usage."""
+
+ layer = DatabaseFunctionalLayer
+
+ def setUp(self):
+ super(TestHasSpecificationsTemplates, self).setUp()
+ self.user = self.factory.makePerson()
+ self.product = self.factory.makeProduct()
+ self.naked_product = removeSecurityProxy(self.product)
+ login_person(self.user)
+
+ def test_not_configured(self):
+ self.naked_product.blueprints_usage = ServiceUsage.UNKNOWN
+ view = create_view(
+ self.product,
+ '+specs',
+ layer=BlueprintsLayer,
+ principal=self.user)
+ self.assertEqual(
+ view.not_launchpad_template.filename,
+ view.template.filename)
+
+ def test_external(self):
+ self.naked_product.blueprints_usage = ServiceUsage.EXTERNAL
+ view = create_view(
+ self.product,
+ '+specs',
+ layer=BlueprintsLayer,
+ principal=self.user)
+ self.assertEqual(
+ view.not_launchpad_template.filename,
+ view.template.filename)
+
+ def test_not_applicable(self):
+ self.naked_product.blueprints_usage = ServiceUsage.NOT_APPLICABLE
+ view = create_view(
+ self.product,
+ '+specs',
+ layer=BlueprintsLayer,
+ principal=self.user)
+ self.assertEqual(
+ view.not_launchpad_template.filename,
+ view.template.filename)
+
+ def test_on_launchpad(self):
+ self.naked_product.blueprints_usage = ServiceUsage.LAUNCHPAD
+ view = create_view(
+ self.product,
+ '+specs',
+ layer=BlueprintsLayer,
+ principal=self.user)
+ self.assertEqual(
+ view.default_template.filename,
+ view.template.filename)
+
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromName(__name__))
=== added file 'lib/lp/blueprints/templates/unknown-specs.pt'
--- lib/lp/blueprints/templates/unknown-specs.pt 1970-01-01 00:00:00 +0000
+++ lib/lp/blueprints/templates/unknown-specs.pt 2010-09-09 17:56:53 +0000
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+ does not use Launchpad
+ for specification tracking.
+
+
+
+ does not track
+ specifications.
+
+
+
+
+ Launchpad does not know how
+ uses specifications.
+
+
+
+
+
has a wiki, which
+ may be used for specifications.
+
+
+
+ wiki
+
+
+
+
+
+
+
+
+
=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
--- lib/lp/registry/browser/tests/pillar-views.txt 2010-09-10 13:29:42 +0000
+++ lib/lp/registry/browser/tests/pillar-views.txt 2010-09-10 14:21:30 +0000
@@ -36,12 +36,14 @@
True
>>> print view.answers_usage.name
LAUNCHPAD
- >>> view.translations_usage.name
- 'UNKNOWN'
+ >>> print view.translations_usage.name
+ UNKNOWN
>>> print view.blueprints_usage.name
UNKNOWN
>>> print view.codehosting_usage.name
UNKNOWN
+ >>> print view.codehosting_usage.name
+ NOT_APPLICABLE
The view provides a list of enabled links that is rendered by the template.
=== modified file 'lib/lp/registry/doc/distribution.txt'
--- lib/lp/registry/doc/distribution.txt 2010-09-10 13:29:42 +0000
+++ lib/lp/registry/doc/distribution.txt 2010-09-10 14:23:47 +0000
@@ -495,7 +495,6 @@
Traceback (most recent call last):
Unauthorized: (..., 'translations_usage', 'launchpad.Edit')
-
Specification Listings
......................
@@ -520,7 +519,6 @@
>>> kubuntu.specifications(filter=filter).count()
1
-
There are 2 completed specs for Kubuntu:
>>> filter = [SpecificationFilter.COMPLETE]
=== modified file 'lib/lp/registry/doc/product.txt'
--- lib/lp/registry/doc/product.txt 2010-09-10 13:29:42 +0000
+++ lib/lp/registry/doc/product.txt 2010-09-10 14:24:29 +0000
@@ -324,6 +324,7 @@
>>> print alsa.answers_usage.name
UNKNOWN
+
Product Creation
----------------