~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/tests/helpers.py

[r=benji][bug=795573,
 796233] On DistroSeries:+localpackagediffs ensure that the comment
 form is hidden after adding a new comment to a DistroSeriesDifference,
 prevent empty comments from being submitted,
 and add some animations and effects to make the UI less jarring and easier to
 follow.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    removeSecurityProxy,
29
29
    )
30
30
 
31
 
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
32
31
from lp.code.interfaces.branchmergeproposal import (
33
32
    IBranchMergeProposalJobSource,
34
33
    )
35
34
from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
36
35
from lp.code.interfaces.revision import IRevisionSet
37
 
from lp.code.interfaces.seriessourcepackagebranch import (
38
 
    IMakeOfficialBranchLinks,
 
36
from lp.code.model.seriessourcepackagebranch import (
 
37
    SeriesSourcePackageBranchSet
39
38
    )
40
39
from lp.registry.interfaces.pocket import PackagePublishingPocket
41
40
from lp.registry.interfaces.series import SeriesStatus
89
88
 
90
89
    :return: a dict of objects to put into local scope.
91
90
    """
92
 
    result = {}
93
91
    eric = factory.makePerson(
94
92
        name='eric', displayname='Eric the Viking',
95
93
        email='eric@example.com', password='test')
135
133
    # It is possible for the param to be None, so reset to the factory
136
134
    # generated one.
137
135
    sourcepackagename = source_package.sourcepackagename
138
 
    # We don't care about who can make things official, so get rid of the
139
 
    # security proxy.
140
 
    series_set = removeSecurityProxy(getUtility(IMakeOfficialBranchLinks))
141
 
    series_set.new(
 
136
    SeriesSourcePackageBranchSet.new(
142
137
        distro_series, pocket, sourcepackagename, branch, branch.owner)
143
138
    return branch
144
139
 
177
172
        for i in range(branch_count)]
178
173
 
179
174
    official = []
180
 
    # We don't care about who can make things official, so get rid of the
181
 
    # security proxy.
182
 
    series_set = removeSecurityProxy(getUtility(IMakeOfficialBranchLinks))
183
175
    # Sort the pocket items so RELEASE is last, and thus first popped.
184
176
    pockets = sorted(PackagePublishingPocket.items, reverse=True)
185
177
    # Since there can be only one link per pocket, max out the number of
187
179
    for i in range(min(official_count, len(pockets))):
188
180
        branch = branches.pop()
189
181
        pocket = pockets.pop()
190
 
        sspb = series_set.new(
 
182
        SeriesSourcePackageBranchSet.new(
191
183
            series, pocket, sourcepackagename, branch, branch.owner)
192
184
        official.append(branch)
193
185
 
262
254
    sourcepackage = branch.sourcepackage
263
255
    suite_sourcepackage = sourcepackage.getSuiteSourcePackage(pocket)
264
256
    registrant = factory.makePerson()
265
 
    ubuntu_branches = getUtility(ILaunchpadCelebrities).ubuntu_branches
266
257
    run_with_login(
267
 
        ubuntu_branches.teamowner,
 
258
        suite_sourcepackage.distribution.owner,
268
259
        ICanHasLinkedBranch(suite_sourcepackage).setBranch,
269
260
        branch, registrant)
270
261
    return branch