~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/tests/test_bugs.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-06 18:06:40 UTC
  • mfrom: (14621.2.6 oops_912178)
  • Revision ID: launchpad@pqm.canonical.com-20120106180640-1wfrp2r0kaiofx9n
[r=adeuring][bug=912178] Add missing method to
        BugsBugTaskSearchListingView and support a context less View
        for the buglisting ajax loading.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
__metaclass__ = type
7
7
 
 
8
from contextlib import contextmanager
8
9
from zope.component import getUtility
9
10
 
10
11
from lp.bugs.interfaces.malone import IMaloneApplication
11
12
from lp.bugs.publisher import BugsLayer
 
13
from lp.testing import (
 
14
    set_feature_flag,
 
15
    feature_flags,
 
16
    )
12
17
from lp.services.webapp.publisher import canonical_url
13
18
from lp.testing import (
14
19
    celebrity_logged_in,
19
24
from lp.testing.views import create_initialized_view
20
25
 
21
26
 
 
27
@contextmanager
 
28
def dynamic_listings():
 
29
    """Context manager to enable new bug listings."""
 
30
    with feature_flags():
 
31
        set_feature_flag(u'bugs.dynamic_bug_listings.enabled', u'on')
 
32
        yield
 
33
 
 
34
 
22
35
class TestMaloneView(TestCaseWithFactory):
23
36
    """Test the MaloneView for the Bugs application."""
24
37
    layer = DatabaseFunctionalLayer
90
103
        self.assertIn(picker_vocab, text)
91
104
        focus_script = "setFocusByName('field.searchtext')"
92
105
        self.assertIn(focus_script, text)
 
106
 
 
107
    def test_search_all_bugs_rendering(self):
 
108
        with dynamic_listings():
 
109
            view = create_initialized_view(
 
110
                self.application,
 
111
                '+bugs',
 
112
                rootsite='bugs')
 
113
            content = view.render()
 
114
 
 
115
        # we should get some valid content out of this
 
116
        self.assertIn('Search all bugs', content)