~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/tests/test_copypackage.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-06 09:08:39 UTC
  • mfrom: (14421.2.8 sponsor-syncs-bug-827555)
  • Revision ID: launchpad@pqm.canonical.com-20111206090839-fm73xxdr08hyvasc
[r=benji][bug=827555] Make the package copier accept a "sponsored"
 Person which will be used as the SPPH.creator and From: address on
 announcement emails. Also expose the new parameter on
 IArchive.copyPackage[s]() on the API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1499
1499
        self.assertEqual(expected_text, body)
1500
1500
        self.assertEqual(expected_text, body)
1501
1501
 
 
1502
    def test_sponsored_copy_notification(self):
 
1503
        # If it's a sponsored copy then the From: address on the
 
1504
        # notification is changed to the sponsored person and the
 
1505
        # SPPH.creator is set to the same person.
 
1506
        archive = self.test_publisher.ubuntutest.main_archive
 
1507
        source = self.test_publisher.getPubSource(
 
1508
            archive=archive, version='1.0-2', architecturehintlist='any')
 
1509
        changelog = self.factory.makeChangelog(spn="foo", versions=["1.0-2"])
 
1510
        source.sourcepackagerelease.changelog = changelog
 
1511
        # Copying to a primary archive reads the changes to close bugs.
 
1512
        transaction.commit()
 
1513
        nobby = self.createNobby(('i386', 'hppa'))
 
1514
        getUtility(ISourcePackageFormatSelectionSet).add(
 
1515
            nobby, SourcePackageFormat.FORMAT_1_0)
 
1516
        nobby.changeslist = 'nobby-changes@example.com'
 
1517
        sponsored_person = self.factory.makePerson(
 
1518
            displayname="Sponsored", email="sponsored@example.com")
 
1519
        [copied_source] = do_copy(
 
1520
            [source], archive, nobby, source.pocket, False,
 
1521
                    person=source.sourcepackagerelease.creator,
 
1522
                    check_permissions=False, send_email=True,
 
1523
                    sponsored=sponsored_person)
 
1524
        [notification, announcement] = pop_notifications()
 
1525
        self.assertEquals(
 
1526
            'Sponsored <sponsored@example.com>', announcement['From'])
 
1527
        self.assertEqual(sponsored_person, copied_source.creator)
 
1528
 
1502
1529
    def test_copy_notification_contains_aggregate_change_log(self):
1503
1530
        # When copying a package that generates a notification,
1504
1531
        # the changelog should contain all of the changelog_entry texts for