~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Andrew Bennetts
  • Date: 2010-07-29 11:17:57 UTC
  • mfrom: (5050.3.17 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: andrew.bennetts@canonical.com-20100729111757-018h3pcefo7z0dnq
Merge lp:bzr/2.2 into lp:bzr.

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