/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Vincent Ladeuil
  • Date: 2011-11-16 17:19:13 UTC
  • mto: This revision was merged to the branch mainline in revision 6273.
  • Revision ID: v.ladeuil+lp@free.fr-20111116171913-6axpxlhb35y2d4sh
Only the DEFAULT section is searched for the normal uses of bazaar.conf

Show diffs side-by-side

added added

removed removed

Lines of Context:
3339
3339
        self.assertEquals(None, self.conf.get('foo'))
3340
3340
 
3341
3341
    def test_get_hook(self):
3342
 
        self.conf.store._load_from_string('foo=bar')
 
3342
        self.conf.set('foo', 'bar')
3343
3343
        calls = []
3344
3344
        def hook(*args):
3345
3345
            calls.append(args)
3351
3351
        self.assertEquals((self.conf, 'foo', 'bar'), calls[0])
3352
3352
 
3353
3353
 
3354
 
class TestStackGetWithConverter(TestStackGet):
 
3354
class TestStackGetWithConverter(tests.TestCaseWithTransport):
3355
3355
 
3356
3356
    def setUp(self):
3357
3357
        super(TestStackGetWithConverter, self).setUp()
3358
3358
        self.overrideAttr(config, 'option_registry', config.OptionRegistry())
3359
3359
        self.registry = config.option_registry
 
3360
        # We just want a simple stack with a simple store so we can inject
 
3361
        # whatever content the tests need without caring about what section
 
3362
        # names are valid for a given store/stack.
 
3363
        store = config.IniFileStore(self.get_transport(), 'foo.conf')
 
3364
        self.conf = config.Stack([store.get_sections], store)
3360
3365
 
3361
3366
    def register_bool_option(self, name, default=None, default_from_env=None):
3362
3367
        b = config.Option(name, help='A boolean.',
3728
3733
 
3729
3734
    def test_simple_set(self):
3730
3735
        conf = self.get_stack(self)
3731
 
        conf.store._load_from_string('foo=bar')
3732
 
        self.assertEquals('bar', conf.get('foo'))
 
3736
        self.assertEquals(None, conf.get('foo'))
3733
3737
        conf.set('foo', 'baz')
3734
3738
        # Did we get it back ?
3735
3739
        self.assertEquals('baz', conf.get('foo'))