~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/features/tests/test_flags.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-01 13:37:39 UTC
  • mfrom: (12913.2.23 mail-scope)
  • Revision ID: launchpad@pqm.canonical.com-20110801133739-r61kp1hfiqe0x83z
[r=adeuring,gmb][bug=810290] add 'mail_header:' feature scope

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Tests for feature flags."""
10
10
 
11
11
from canonical.testing import layers
12
12
from lp.services.features import (
 
13
    UseFeatureController,
13
14
    getFeatureFlag,
14
15
    install_feature_controller,
15
16
    )
117
118
        # the start-of-request handler will do something like this:
118
119
        controller, call_log = self.makeControllerInScopes(
119
120
            ['default', 'beta_user'])
120
 
        install_feature_controller(controller)
121
 
        try:
 
121
        with UseFeatureController(controller):
122
122
            # then application code can simply ask without needing a context
123
123
            # object
124
124
            self.assertEqual(u'4.0', getFeatureFlag('ui.icing'))
125
 
        finally:
126
 
            install_feature_controller(None)
127
125
 
128
126
    def test_threadGetFlagNoContext(self):
129
127
        # If there is no context, please don't crash. workaround for the root