~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/windmill/tests/test_recipe_index.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-02-15 02:07:37 UTC
  • mfrom: (12344.2.16 daily-ajax)
  • Revision ID: launchpad@pqm.canonical.com-20110215020737-5mzlcotobwen1pej
[r=deryck, lifeless,
        wgrant][bug=673530][incr] Add a popup choice widget for the build
        frequency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2011 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Tests for recipe index pages."""
 
5
 
 
6
__metaclass__ = type
 
7
__all__ = []
 
8
 
 
9
import transaction
 
10
 
 
11
from storm.store import Store
 
12
 
 
13
from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
 
14
from lp.code.windmill.testing import CodeWindmillLayer
 
15
from lp.testing import WindmillTestCase
 
16
from lp.testing.windmill.constants import FOR_ELEMENT
 
17
 
 
18
 
 
19
class TestRecipeSetDaily(WindmillTestCase):
 
20
    """Test setting the daily build flag."""
 
21
 
 
22
    layer = CodeWindmillLayer
 
23
    suite_name = "Recipe daily build flag setting"
 
24
 
 
25
    def test_inline_recipe_daily_build(self):
 
26
        eric = self.factory.makePerson(
 
27
            name="eric", displayname="Eric the Viking", password="test",
 
28
            email="eric@example.com")
 
29
        recipe = self.factory.makeSourcePackageRecipe(owner=eric)
 
30
        transaction.commit()
 
31
 
 
32
        client, start_url = self.getClientFor(recipe, user=eric)
 
33
        client.click(id=u'edit-build_daily')
 
34
        client.waits.forElement(
 
35
            classname=u'yui3-ichoicelist-content', timeout=FOR_ELEMENT)
 
36
        client.click(link=u'Built daily')
 
37
        client.waits.forElement(
 
38
            jquery=u'("div#edit-build_daily a.editicon.sprite.edit")',
 
39
            timeout=FOR_ELEMENT)
 
40
        client.asserts.assertTextIn(
 
41
            id=u'edit-build_daily', validator=u'Built daily')
 
42
 
 
43
        transaction.commit()
 
44
        freshly_fetched_recipe = Store.of(recipe).find(
 
45
            SourcePackageRecipe, SourcePackageRecipe.id == recipe.id).one()
 
46
        self.assertTrue(freshly_fetched_recipe.build_daily)