~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/browser/tests/test_sourcepackagerecipe.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-02-15 16:44:20 UTC
  • mfrom: (12335.5.6 set-recipe-text-bad-data)
  • Revision ID: launchpad@pqm.canonical.com-20110215164420-46dyoerjogzebo75
[r=lifeless][bug=592513,
        683321] Don't OOPS if an invalid branch is used while editing a
        recipe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
986
986
            get_message_text(browser, 1),
987
987
            'Recipe may not refer to private branch: %s' % bzr_identity)
988
988
 
 
989
    def test_edit_recipe_no_branch(self):
 
990
        # If a user tries to set a source package recipe to use a branch
 
991
        # that isn't registred, they will get an error.
 
992
        recipe = self.factory.makeSourcePackageRecipe(owner=self.user)
 
993
        no_branch_recipe_text = recipe.recipe_text[:-4]
 
994
        expected_name = recipe.base_branch.unique_name[:-3]
 
995
        browser = self.getViewBrowser(recipe, '+edit')
 
996
        browser.getControl('Recipe text').value = no_branch_recipe_text
 
997
        browser.getControl('Update Recipe').click()
 
998
        self.assertEqual(
 
999
            get_message_text(browser, 1),
 
1000
            'lp://dev/%s is not a branch on Launchpad.' % expected_name)
 
1001
 
989
1002
    def _test_edit_recipe_with_no_related_branches(self, recipe):
990
1003
        # The Related Branches section should not appear if there are no
991
1004
        # related branches.