~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=deryck][bug=845846] No oops when requesting daily build for a
 disabled archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1317
1317
        build_button = find_tag_by_id(browser.contents, 'field.actions.build')
1318
1318
        self.assertIs(None, build_button)
1319
1319
 
 
1320
    def test_request_daily_builds_button_ppa_disabled(self):
 
1321
        # Recipes whose daily build ppa is disabled do not have a build now
 
1322
        # link.
 
1323
        distroseries = self.factory.makeSourcePackageRecipeDistroseries()
 
1324
        daily_build_archive = self.factory.makeArchive(
 
1325
                distribution=distroseries.distribution, owner=self.user)
 
1326
        with person_logged_in(self.user):
 
1327
            daily_build_archive.disable()
 
1328
        recipe = self.factory.makeSourcePackageRecipe(
 
1329
            owner=self.chef, daily_build_archive=daily_build_archive,
 
1330
            is_stale=True, build_daily=True)
 
1331
        browser = self.getViewBrowser(recipe)
 
1332
        build_button = find_tag_by_id(browser.contents, 'field.actions.build')
 
1333
        self.assertIs(None, build_button)
 
1334
 
1320
1335
    def test_request_daily_builds_ajax_link_not_rendered(self):
1321
1336
        # The Build now link should not be rendered without javascript.
1322
1337
        recipe = self.factory.makeSourcePackageRecipe(
1362
1377
            "for distroseries ubuntu warty",
1363
1378
            harness.view.request.notifications[0].message)
1364
1379
 
 
1380
    def test_request_daily_builds_disabled_archive(self):
 
1381
        # Requesting a daily build from a disabled archive is a user error.
 
1382
        recipe = self.factory.makeSourcePackageRecipe(
 
1383
            owner=self.chef, daily_build_archive=self.ppa,
 
1384
            name=u'julia', is_stale=True, build_daily=True)
 
1385
        harness = LaunchpadFormHarness(
 
1386
            recipe, SourcePackageRecipeRequestDailyBuildView)
 
1387
        with person_logged_in(self.ppa.owner):
 
1388
            self.ppa.disable()
 
1389
        harness.submit('build', {})
 
1390
        self.assertEqual(
 
1391
            "Secret PPA is disabled.",
 
1392
            harness.view.request.notifications[0].message)
 
1393
 
1365
1394
    def test_request_builds_page(self):
1366
1395
        """Ensure the +request-builds page is sane."""
1367
1396
        recipe = self.makeRecipe()