launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26422
[Merge] ~twom/launchpad:oci-policy-fix-image-name into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:oci-policy-fix-image-name into launchpad:master.
Commit message:
Populate the image name field on editing a recipe
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/398686
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:oci-policy-fix-image-name into launchpad:master.
diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py
index 55d17b8..3b79cec 100644
--- a/lib/lp/oci/browser/ocirecipe.py
+++ b/lib/lp/oci/browser/ocirecipe.py
@@ -1046,6 +1046,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin,
description=(
"Name to use for registry upload. "
"Defaults to the name of the recipe."),
+ default=self.context.image_name,
required=False, readonly=False))
def validate(self, data):
diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py
index c473f4b..490a0e4 100644
--- a/lib/lp/oci/browser/tests/test_ocirecipe.py
+++ b/lib/lp/oci/browser/tests/test_ocirecipe.py
@@ -768,10 +768,12 @@ class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView):
def test_edit_image_name(self):
self.setUpDistroSeries()
credentials = self.factory.makeOCIRegistryCredentials()
+ original_name = self.factory.getUniqueUnicode()
with person_logged_in(self.distribution.owner):
self.distribution.oci_registry_credentials = credentials
oci_project = self.factory.makeOCIProject(pillar=self.distribution)
recipe = self.factory.makeOCIRecipe(
+ name=original_name,
registrant=self.person, owner=self.person,
oci_project=oci_project)
oci_project.setOfficialRecipeStatus(recipe, True)
@@ -779,6 +781,8 @@ class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView):
recipe, view_name="+edit", user=recipe.owner)
image_name = self.factory.getUniqueUnicode()
field = browser.getControl(name="field.image_name")
+ # Default is the recipe name
+ self.assertEqual(field.value, original_name)
field.value = image_name
browser.getControl("Update OCI recipe").click()
content = find_main_content(browser.contents)