~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/adapters/tests/test_notification.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-30 14:20:29 UTC
  • mfrom: (13555.7.5 wrong-link-818087)
  • Revision ID: launchpad@pqm.canonical.com-20110730142029-n79x5i5ge9xxk7z2
[r=julian-edwards][bug=818087] Fix the URL in sync notification
 emails so it points to the target distribution package, not the upstream's.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
from zope.component import getUtility
11
11
from zope.security.proxy import removeSecurityProxy
12
12
 
 
13
from canonical.launchpad.webapp.publisher import canonical_url
13
14
from canonical.testing.layers import (
14
15
    LaunchpadZopelessLayer,
15
16
    ZopelessDatabaseLayer,
34
35
    ArchivePurpose,
35
36
    PackageUploadCustomFormat,
36
37
    )
 
38
from lp.soyuz.model.distroseriessourcepackagerelease import (
 
39
    DistroSeriesSourcePackageRelease,
 
40
    )
37
41
from lp.testing import TestCaseWithFactory
38
42
from lp.testing.mail_helpers import pop_notifications
39
43
 
334
338
                             None, "unapproved")
335
339
        self.assertIn("Waiting for approval", body)
336
340
 
 
341
    def test_assemble_body_inserts_package_url_for_distro_upload(self):
 
342
        # The email body should contain the canonical url to the package
 
343
        # page in the target distroseries.
 
344
        spr = self.factory.makeSourcePackageRelease()
 
345
        blamer = self.factory.makePerson()
 
346
        archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
 
347
        series = self.factory.makeDistroSeries()
 
348
 
 
349
        body = assemble_body(blamer, spr, [], archive, series, "",
 
350
                             None, "unapproved")
 
351
        dsspr = DistroSeriesSourcePackageRelease(series, spr)
 
352
        url = canonical_url(dsspr)
 
353
        self.assertIn(url, body)
 
354
 
337
355
    def test__is_auto_sync_upload__no_preferred_email_for_changer(self):
338
356
        # If changer has no preferred email address,
339
357
        # is_auto_sync_upload should still work.