~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Change the way Stacks are built: requires a Store and a mutable section name instead of a callable returning the mutable section.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2223
2223
    def test_simple_set(self):
2224
2224
        store = config.IniFileStore(self.get_transport(), 'test.conf')
2225
2225
        store._load_from_string('foo=bar')
2226
 
        conf = config.Stack([store.get_sections], store.get_mutable_section)
 
2226
        conf = config.Stack([store.get_sections], store)
2227
2227
        self.assertEquals('bar', conf.get('foo'))
2228
2228
        conf.set('foo', 'baz')
2229
2229
        # Did we get it back ?
2231
2231
 
2232
2232
    def test_set_creates_a_new_section(self):
2233
2233
        store = config.IniFileStore(self.get_transport(), 'test.conf')
2234
 
        conf = config.Stack([store.get_sections], store.get_mutable_section)
 
2234
        conf = config.Stack([store.get_sections], store)
2235
2235
        conf.set('foo', 'baz')
2236
2236
        self.assertEquals, 'baz', conf.get('foo')
2237
2237
 
2244
2244
    def test_remove_existing(self):
2245
2245
        store = config.IniFileStore(self.get_transport(), 'test.conf')
2246
2246
        store._load_from_string('foo=bar')
2247
 
        conf = config.Stack([store.get_sections], store.get_mutable_section)
 
2247
        conf = config.Stack([store.get_sections], store)
2248
2248
        self.assertEquals('bar', conf.get('foo'))
2249
2249
        conf.remove('foo')
2250
2250
        # Did we get it back ?
2252
2252
 
2253
2253
    def test_remove_unknown(self):
2254
2254
        store = config.IniFileStore(self.get_transport(), 'test.conf')
2255
 
        conf = config.Stack([store.get_sections], store.get_mutable_section)
 
2255
        conf = config.Stack([store.get_sections], store)
2256
2256
        self.assertRaises(KeyError, conf.remove, 'I_do_not_exist')
2257
2257
 
2258
2258