launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27277
[Merge] ~cjwatson/launchpad:fix-snap-oci-build-privacy-banner into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-snap-oci-build-privacy-banner into launchpad:master.
Commit message:
Fix a few test failures related to snap / OCI recipe build privacy
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/405835
These were caused by various aspects of https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/405339.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-snap-oci-build-privacy-banner into launchpad:master.
diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py
index 9dc3fc3..718bc7e 100644
--- a/lib/lp/oci/browser/tests/test_ocirecipe.py
+++ b/lib/lp/oci/browser/tests/test_ocirecipe.py
@@ -1442,7 +1442,7 @@ class TestOCIRecipeView(BaseTestOCIRecipeView):
information_type=InformationType.PRIVATESECURITY)
with admin_logged_in():
build_path = recipe.build_path
- build = self.makeBuild(
+ self.makeBuild(
recipe=recipe, status=BuildStatus.FULLYBUILT,
duration=timedelta(minutes=30))
@@ -1451,7 +1451,8 @@ class TestOCIRecipeView(BaseTestOCIRecipeView):
with person_logged_in(self.person):
recipe.subscribe(subscriber, self.person)
- main_text = self.getMainText(build.recipe, user=subscriber)
+ with person_logged_in(subscriber):
+ main_text = self.getMainText(recipe, user=subscriber)
self.assertTextMatchesExpressionIgnoreWhitespace("""\
recipe-name
.*
diff --git a/lib/lp/oci/model/ocirecipebuild.py b/lib/lp/oci/model/ocirecipebuild.py
index ed3d19d..e24abb7 100644
--- a/lib/lp/oci/model/ocirecipebuild.py
+++ b/lib/lp/oci/model/ocirecipebuild.py
@@ -566,6 +566,7 @@ class OCIRecipeBuildSet(SpecificBuildFarmJobSourceMixin):
build_farm_job, requester, recipe, distro_arch_series.processor,
virtualized, date_created, build_request=build_request)
store.add(ocirecipebuild)
+ store.flush()
return ocirecipebuild
def preloadBuildsData(self, builds):
diff --git a/lib/lp/security.py b/lib/lp/security.py
index 5983e3a..9cd579b 100644
--- a/lib/lp/security.py
+++ b/lib/lp/security.py
@@ -3575,8 +3575,6 @@ class ViewOCIRecipeBuild(DelegatedAuthorization):
def iter_objects(self):
yield self.obj.recipe
- if self.obj.recipe.git_repository is not None:
- yield self.obj.recipe.git_repository
class EditOCIRecipeBuild(AdminByBuilddAdmin):
diff --git a/lib/lp/snappy/model/snapbuild.py b/lib/lp/snappy/model/snapbuild.py
index 85afe4b..d4d1f6c 100644
--- a/lib/lp/snappy/model/snapbuild.py
+++ b/lib/lp/snappy/model/snapbuild.py
@@ -585,6 +585,7 @@ class SnapBuildSet(SpecificBuildFarmJobSourceMixin):
date_created, store_upload_metadata=store_upload_metadata,
build_request=build_request)
store.add(snapbuild)
+ store.flush()
return snapbuild
def getByID(self, build_id):
diff --git a/lib/lp/snappy/tests/test_snap.py b/lib/lp/snappy/tests/test_snap.py
index ac023bb..a3d6c68 100644
--- a/lib/lp/snappy/tests/test_snap.py
+++ b/lib/lp/snappy/tests/test_snap.py
@@ -3895,7 +3895,10 @@ class TestSnapWebservice(TestCaseWithFactory):
private=True)
archive_url = api_url(archive)
snap = self.makeSnap(distroseries=distroseries, processors=[processor])
- response = self.webservice.named_post(
+ private_webservice = webservice_for_person(
+ self.person, permission=OAuthPermission.WRITE_PRIVATE)
+ private_webservice.default_api_version = "devel"
+ response = private_webservice.named_post(
snap["self_link"], "requestBuild", archive=archive_url,
distro_arch_series=distroarchseries_url, pocket="Updates")
self.assertEqual(201, response.status)