~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Merge first-try into propagate-exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    trace,
36
36
    transport,
37
37
    )
 
38
from bzrlib.tests import features
38
39
from bzrlib.util.configobj import configobj
39
40
 
40
41
 
367
368
            '/home/bogus/.cache')
368
369
 
369
370
 
370
 
class TestIniConfig(tests.TestCase):
 
371
class TestIniConfig(tests.TestCaseInTempDir):
371
372
 
372
373
    def make_config_parser(self, s):
373
374
        conf = config.IniBasedConfig(None)
393
394
        parser = my_config._get_parser(file=config_file)
394
395
        self.failUnless(my_config._get_parser() is parser)
395
396
 
 
397
    def _dummy_chown(self, path, uid, gid):
 
398
        self.path, self.uid, self.gid = path, uid, gid
 
399
 
 
400
    def test_ini_config_ownership(self):
 
401
        """Ensure that chown is happening during _write_config_file.
 
402
        """
 
403
        self.requireFeature(features.chown_feature)
 
404
        self.overrideAttr(os, 'chown', self._dummy_chown)
 
405
        self.path = self.uid = self.gid = None
 
406
        def get_filename():
 
407
            return 'foo.conf'
 
408
        conf = config.IniBasedConfig(get_filename)
 
409
        conf._write_config_file()
 
410
        self.assertEquals(self.path, 'foo.conf')
 
411
        self.assertTrue(isinstance(self.uid, int))
 
412
        self.assertTrue(isinstance(self.gid, int))
396
413
 
397
414
class TestGetUserOptionAs(TestIniConfig):
398
415