Merge lp:~rockstar/launchpad/edit-recipe-too-new into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 11641
Proposed branch: lp:~rockstar/launchpad/edit-recipe-too-new
Merge into: lp:launchpad
Diff against target: 56 lines (+35/-0)
2 files modified
lib/lp/code/browser/sourcepackagerecipe.py (+5/-0)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+30/-0)
To merge this branch: bzr merge lp:~rockstar/launchpad/edit-recipe-too-new
Reviewer Review Type Date Requested Status
Curtis Hovey (community) Approve
Review via email: mp+36800@code.launchpad.net

Description of the change

This branch fixes bug #645403 through the edit workflow. I found that this workflow wasn't fixed in the branch merge here: https://code.edge.launchpad.net/~rockstar/launchpad/recipe-too-new/+merge/36379

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This looks good to land.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/sourcepackagerecipe.py'
2--- lib/lp/code/browser/sourcepackagerecipe.py 2010-09-22 20:21:57 +0000
3+++ lib/lp/code/browser/sourcepackagerecipe.py 2010-09-27 21:35:55 +0000
4@@ -403,6 +403,11 @@
5 try:
6 self.context.setRecipeText(recipe_text)
7 changed = True
8+ except TooNewRecipeFormat:
9+ self.setFieldError(
10+ 'recipe_text',
11+ 'The recipe format version specified is not available.')
12+ return
13 except ForbiddenInstructionError:
14 # XXX: bug=592513 We shouldn't be hardcoding "run" here.
15 self.setFieldError(
16
17=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
18--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-09-22 21:03:48 +0000
19+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-09-27 21:35:55 +0000
20@@ -445,6 +445,36 @@
21 extract_text(find_tags_by_class(browser.contents, 'message')[1]),
22 'The bzr-builder instruction "run" is not permitted here.')
23
24+ def test_edit_recipe_format_too_new(self):
25+ # If the recipe's format version is too new, we should notify the
26+ # user.
27+ self.factory.makeDistroSeries(
28+ displayname='Mumbly Midget', name='mumbly',
29+ distribution=self.ppa.distribution)
30+ product = self.factory.makeProduct(
31+ name='ratatouille', displayname='Ratatouille')
32+ veggie_branch = self.factory.makeBranch(
33+ owner=self.chef, product=product, name='veggies')
34+ recipe = self.factory.makeSourcePackageRecipe(
35+ owner=self.chef, registrant=self.chef,
36+ name=u'things', description=u'This is a recipe',
37+ distroseries=self.squirrel, branches=[veggie_branch])
38+
39+ new_recipe_text = dedent(u'''\
40+ # bzr-builder format 145.115 deb-version 0+{revno}
41+ %s
42+ ''') % recipe.base_branch.bzr_identity
43+
44+ with recipe_parser_newest_version(145.115):
45+ browser = self.getViewBrowser(recipe)
46+ browser.getLink('Edit recipe').click()
47+ browser.getControl('Recipe text').value = new_recipe_text
48+ browser.getControl('Update Recipe').click()
49+
50+ self.assertEqual(
51+ get_message_text(browser, 1),
52+ 'The recipe format version specified is not available.')
53+
54 def test_edit_recipe_already_exists(self):
55 self.factory.makeDistroSeries(
56 displayname='Mumbly Midget', name='mumbly',