1499
1499
self.assertEqual(expected_text, body)
1500
1500
self.assertEqual(expected_text, body)
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()
1526
'Sponsored <sponsored@example.com>', announcement['From'])
1527
self.assertEqual(sponsored_person, copied_source.creator)
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