12612.2.5
by Tim Penhey
Fix the attendance. |
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 Sprint pages and views."""
|
|
5 |
||
6 |
__metaclass__ = type |
|
7 |
||
8 |
from storm.locals import Store |
|
9 |
||
10 |
from canonical.testing.layers import DatabaseFunctionalLayer |
|
12612.2.7
by Tim Penhey
Change the query limit matcher. |
11 |
from lp.testing import TestCaseWithFactory |
12 |
from lp.testing.matchers import BrowsesWithQueryLimit |
|
12612.2.5
by Tim Penhey
Fix the attendance. |
13 |
|
14 |
||
15 |
class TestSprintIndex(TestCaseWithFactory): |
|
16 |
||
17 |
layer = DatabaseFunctionalLayer |
|
18 |
||
19 |
def test_query_count(self): |
|
20 |
sprint = self.factory.makeSprint() |
|
21 |
for x in range(30): |
|
22 |
sprint.attend( |
|
23 |
self.factory.makePerson(), |
|
24 |
sprint.time_starts, |
|
25 |
sprint.time_ends, |
|
26 |
True) |
|
27 |
Store.of(sprint).flush() |
|
28 |
Store.of(sprint).invalidate() |
|
12612.2.7
by Tim Penhey
Change the query limit matcher. |
29 |
self.assertThat(sprint, BrowsesWithQueryLimit(15, sprint.owner)) |