102
102
registrant = self.factory.makePerson()
104
registrant=registrant,
104
registrant = registrant,
105
105
owner = self.factory.makeTeam(owner=registrant),
106
106
distroseries = [self.factory.makeDistroSeries()],
107
107
name = self.factory.getUniqueString(u'recipe-name'),
304
304
store = Store.of(build)
306
306
build_job = store.find(SourcePackageRecipeBuildJob,
307
SourcePackageRecipeBuildJob.build_id==build.id).one()
307
SourcePackageRecipeBuildJob.build_id == build.id).one()
308
308
self.assertProvides(build_job, ISourcePackageRecipeBuildJob)
309
309
self.assertTrue(build_job.virtualized)
310
310
job = build_job.job
311
311
self.assertProvides(job, IJob)
312
312
self.assertEquals(job.status, JobStatus.WAITING)
313
build_queue = store.find(BuildQueue, BuildQueue.job==job.id).one()
313
build_queue = store.find(BuildQueue, BuildQueue.job == job.id).one()
314
314
self.assertProvides(build_queue, IBuildQueue)
315
315
self.assertTrue(build_queue.virtualized)
418
418
recipe.requestBuild(archive, recipe.owner, series,
419
419
PackagePublishingPocket.RELEASE)
421
def test_requestBuildPrivatePPAWithArchivePermission(self):
422
"""User is not in PPA owner team but has ArchivePermission.
424
The case where the user is not in the PPA owner team but is allowed to
425
upload to the PPA via an explicit ArchivePermission takes a different
426
security path than if he were part of the team.
429
# Create a team private PPA.
430
team_owner = self.factory.makePerson()
431
team = self.factory.makeTeam(owner=team_owner)
432
team_p3a = self.factory.makeArchive(
433
owner=team, displayname='Private PPA', name='p3a',
436
# Create a recipe with the team P3A as the build destination.
437
recipe = self.factory.makeSourcePackageRecipe()
439
# Add upload component rights for the non-team person.
440
with person_logged_in(team_owner):
441
team_p3a.newComponentUploader(
442
person=recipe.owner, component_name="main")
443
(distroseries,) = list(recipe.distroseries)
445
# Try to request a build. It should work.
446
with person_logged_in(recipe.owner):
447
build = recipe.requestBuild(
448
team_p3a, recipe.owner, distroseries,
449
PackagePublishingPocket.RELEASE)
450
self.assertEqual(build.archive, team_p3a)
451
self.assertEqual(build.distroseries, distroseries)
452
self.assertEqual(build.requester, recipe.owner)
421
454
def test_sourcepackagerecipe_description(self):
422
455
"""Ensure that the SourcePackageRecipe has a proper description."""
423
456
description = u'The whoozits and whatzits.'
464
497
with person_logged_in(owner):
465
498
recipe = self.factory.makeSourcePackageRecipe(branches=[branch])
466
499
self.assertTrue(check_permission('launchpad.View', recipe))
467
removeSecurityProxy(branch).explicitly_private=True
500
removeSecurityProxy(branch).explicitly_private = True
468
501
with person_logged_in(self.factory.makePerson()):
469
502
self.assertFalse(check_permission('launchpad.View', recipe))
470
503
self.assertFalse(check_permission('launchpad.View', recipe))
606
639
"""SourcePackageRecipe.getPendingBuildInfo() is as expected."""
607
640
person = self.factory.makePerson()
608
641
archives = [self.factory.makeArchive(owner=person) for x in range(4)]
609
distroseries= self.factory.makeSourcePackageRecipeDistroseries()
642
distroseries = self.factory.makeSourcePackageRecipeDistroseries()
610
643
recipe = self.factory.makeSourcePackageRecipe()
613
646
for archive in archives:
614
build = recipe.requestBuild(archive, person, distroseries)
647
recipe.requestBuild(archive, person, distroseries)
615
648
build_info.insert(0, {
616
649
"distroseries": distroseries.displayname,
617
650
"archive": '%s/%s' %
1036
1069
"""SourcePackageRecipe.[pending_|completed_]builds is as expected."""
1037
1070
person = self.factory.makePerson()
1038
1071
archives = [self.factory.makeArchive(owner=person) for x in range(4)]
1039
distroseries= self.factory.makeSourcePackageRecipeDistroseries()
1072
distroseries = self.factory.makeSourcePackageRecipeDistroseries()
1041
1074
recipe, user, launchpad = self.makeRecipe(person)
1042
1075
distroseries = ws_object(launchpad, distroseries)
1056
1089
"""SourcePackageRecipe.getPendingBuildInfo() is as expected."""
1057
1090
person = self.factory.makePerson()
1058
1091
archives = [self.factory.makeArchive(owner=person) for x in range(4)]
1059
distroseries= self.factory.makeSourcePackageRecipeDistroseries()
1092
distroseries = self.factory.makeSourcePackageRecipeDistroseries()
1061
1094
recipe, user, launchpad = self.makeRecipe(person)
1062
1095
ws_distroseries = ws_object(launchpad, distroseries)
1064
1097
build_info = []
1065
1098
for archive in archives:
1066
1099
ws_archive = ws_object(launchpad, archive)
1067
build = recipe.requestBuild(
1100
recipe.requestBuild(
1068
1101
archive=ws_archive, distroseries=ws_distroseries,
1069
1102
pocket=PackagePublishingPocket.RELEASE.title)
1070
1103
build_info.insert(0, {