Merge lp:~ivo-kracht/launchpad/bug-897571 into lp:launchpad

Proposed by Ivo Kracht on 2012-06-21
Status: Merged
Approved by: Abel Deuring on 2012-06-21
Approved revision: no longer in the source branch.
Merged at revision: 15467
Proposed branch: lp:~ivo-kracht/launchpad/bug-897571
Merge into: lp:launchpad
Diff against target: 79 lines (+8/-15)
2 files modified
lib/lp/registry/interfaces/sourcepackage.py (+1/-15)
lib/lp/registry/tests/test_sourcepackage.py (+7/-0)
To merge this branch: bzr merge lp:~ivo-kracht/launchpad/bug-897571
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) 2012-06-21 Approve on 2012-06-21
Review via email: mp+111367@code.launchpad.net

Commit Message

test added that SourcePackage implements ISourcePackage

Description of the Change

I wrote a test to confirm that “ISourcePackage.getSharingDetailPermissions specifies more parameters than SourcePackage.getSharingDetailPermissions actually supports” like the description said. It turned out to be a little bit more complicated. The test failed because of some weird attribute definitions that did not make any sense and don't seem to be related to anything, so I deleted them. After that the test failed because of the actual problem with IsoucePackage.getSharingDetailPermissions as it should and I just changed it so that it worked.

Pre-imp call with adeuring

test:
./bin/test registry -vvt test_sourcepackage

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/tests/test_sourcepackage.py

To post a comment you must log in.
Jelmer Vernooij (jelmer) wrote :

Thanks, another nice cleanup.

Just one small comment: s/consistancy/consistency/

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/interfaces/sourcepackage.py'
2--- lib/lp/registry/interfaces/sourcepackage.py 2011-12-24 16:54:44 +0000
3+++ lib/lp/registry/interfaces/sourcepackage.py 2012-06-21 15:15:31 +0000
4@@ -77,8 +77,6 @@
5 IHasDrivers, IHasOwner):
6 """Public attributes for SourcePackage."""
7
8- id = Attribute("ID")
9-
10 name = exported(
11 TextLine(
12 title=_("Name"), required=True, readonly=True,
13@@ -122,13 +120,6 @@
14
15 sourcepackagename = Attribute("SourcePackageName")
16
17- bugtasks = Attribute("Bug Tasks that reference this Source Package name "
18- "in the context of this distribution.")
19-
20- product = Attribute(
21- "The best guess we have as to the Launchpad Project associated with "
22- "this SourcePackage.")
23-
24 # This is really a reference to an IProductSeries.
25 productseries = exported(
26 ReferenceChoice(
27@@ -232,7 +223,7 @@
28 def deletePackaging():
29 """Delete the packaging for this sourcepackage."""
30
31- def getSharingDetailPermissions(self):
32+ def getSharingDetailPermissions():
33 """Return a dictionary of user permissions for +sharing-details page.
34
35 This shows whether the user can change
36@@ -274,11 +265,6 @@
37 :return: An `IBranch`.
38 """
39
40- shouldimport = Attribute("""Whether we should import this or not.
41- By 'import' we mean sourcerer analysis resulting in a manifest and a
42- set of Bazaar branches which describe the source package release.
43- The attribute is True or False.""")
44-
45 latest_published_component = Object(
46 title=u'The component in which the package was last published.',
47 schema=IComponent, readonly=True, required=False)
48
49=== modified file 'lib/lp/registry/tests/test_sourcepackage.py'
50--- lib/lp/registry/tests/test_sourcepackage.py 2012-01-01 02:58:52 +0000
51+++ lib/lp/registry/tests/test_sourcepackage.py 2012-06-21 15:15:31 +0000
52@@ -15,6 +15,8 @@
53 from zope.security.checker import canAccess
54 from zope.security.interfaces import Unauthorized
55 from zope.security.management import checkPermission
56+from zope.security.proxy import removeSecurityProxy
57+from zope.interface.verify import verifyObject
58
59 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
60 from lp.code.model.seriessourcepackagebranch import (
61@@ -23,6 +25,7 @@
62 from lp.registry.interfaces.distribution import NoPartnerArchive
63 from lp.registry.interfaces.pocket import PackagePublishingPocket
64 from lp.registry.interfaces.series import SeriesStatus
65+from lp.registry.interfaces.sourcepackage import ISourcePackage
66 from lp.registry.model.distributionsourcepackage import (
67 DistributionSourcePackage,
68 )
69@@ -46,6 +49,10 @@
70
71 layer = DatabaseFunctionalLayer
72
73+ def test_interface_consistency(self):
74+ package = self.factory.makeSourcePackage()
75+ verifyObject(ISourcePackage, removeSecurityProxy(package))
76+
77 def test_path(self):
78 sourcepackage = self.factory.makeSourcePackage()
79 self.assertEqual(