919
921
"Nancy Requester <requester@example.com>",
920
922
emails[1]['From'])
924
def test_copying_closes_bugs(self):
925
# Copying a package into a primary archive should close any bugs
926
# mentioned in its changelog for versions added since the most
927
# recently published version in the target.
929
# Firstly, lots of boring set up.
930
publisher = SoyuzTestPublisher()
931
publisher.prepareBreezyAutotest()
932
distroseries = publisher.breezy_autotest
933
target_archive = self.factory.makeArchive(
934
distroseries.distribution, purpose=ArchivePurpose.PRIMARY)
935
source_archive = self.factory.makeArchive()
936
bug280 = self.factory.makeBug()
937
bug281 = self.factory.makeBug()
938
bug282 = self.factory.makeBug()
940
# Publish a package in the source archive and give it a changelog
941
# entry that closes a bug.
942
source_pub = self.factory.makeSourcePackagePublishingHistory(
943
distroseries=distroseries, sourcepackagename="libc",
944
version="2.8-2", status=PackagePublishingStatus.PUBLISHED,
945
archive=source_archive)
946
spr = removeSecurityProxy(source_pub).sourcepackagerelease
947
changelog = dedent("""\
948
libc (2.8-2) unstable; urgency=low
952
-- Foo Bar <foo@example.com> Tue, 01 Jan 1970 01:50:41 +0000
954
libc (2.8-1) unstable; urgency=low
958
-- Foo Bar <foo@example.com> Tue, 01 Jan 1970 01:50:41 +0000
960
libc (2.8-0) unstable; urgency=low
964
-- Foo Bar <foo@example.com> Tue, 01 Jan 1970 01:50:41 +0000
965
""" % (bug282.id, bug281.id, bug280.id))
966
spr.changelog = self.factory.makeLibraryFileAlias(content=changelog)
967
spr.changelog_entry = "dummy"
968
self.layer.txn.commit() # Librarian.
969
bugtask280 = self.factory.makeBugTask(
970
target=spr.sourcepackage, bug=bug280)
971
bugtask281 = self.factory.makeBugTask(
972
target=spr.sourcepackage, bug=bug281)
973
bugtask282 = self.factory.makeBugTask(
974
target=spr.sourcepackage, bug=bug282)
976
# Now put the same named package in the target archive at the
977
# oldest version in the changelog.
978
publisher.getPubSource(
979
distroseries=distroseries, sourcename="libc",
980
version="2.8-0", status=PackagePublishingStatus.PUBLISHED,
981
archive=target_archive)
984
source = getUtility(IPlainPackageCopyJobSource)
985
requester = self.factory.makePerson()
986
with person_logged_in(target_archive.owner):
987
target_archive.newComponentUploader(requester, "main")
990
package_version="2.8-2",
991
source_archive=source_archive,
992
target_archive=target_archive,
993
target_distroseries=distroseries,
994
target_pocket=PackagePublishingPocket.RELEASE,
995
include_binaries=False,
999
# All the bugs apart from the one for 2.8-0 should be fixed.
1000
self.assertEqual(BugTaskStatus.FIXRELEASED, bugtask282.status)
1001
self.assertEqual(BugTaskStatus.FIXRELEASED, bugtask281.status)
1002
self.assertEqual(BugTaskStatus.NEW, bugtask280.status)
922
1004
def test_findMatchingDSDs_matches_all_DSDs_for_job(self):
923
1005
# findMatchingDSDs finds matching DSDs for any of the packages