1
# Copyright 2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Tests for recipe index pages."""
11
from storm.store import Store
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
19
class TestRecipeSetDaily(WindmillTestCase):
20
"""Test setting the daily build flag."""
22
layer = CodeWindmillLayer
23
suite_name = "Recipe daily build flag setting"
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)
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")',
40
client.asserts.assertTextIn(
41
id=u'edit-build_daily', validator=u'Built daily')
44
freshly_fetched_recipe = Store.of(recipe).find(
45
SourcePackageRecipe, SourcePackageRecipe.id == recipe.id).one()
46
self.assertTrue(freshly_fetched_recipe.build_daily)