/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_osutils.py

Only chown() the .bzr.log when creating it, fixing NEWS entry to put it under 2.2b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1990
1990
    def _dummy_chown(self, path, uid, gid):
1991
1991
        self.path, self.uid, self.gid = path, uid, gid
1992
1992
 
1993
 
    def test_mkdir_with_ownership_chown(self):
1994
 
        """Ensure that osutils.mkdir_with_ownership chowns correctly with ownership_src.
1995
 
        """
1996
 
        ownsrc = '/'
1997
 
        osutils.mkdir_with_ownership('foo', ownsrc)
1998
 
 
1999
 
        s = os.stat(ownsrc)
2000
 
        self.assertEquals(self.path, 'foo')
2001
 
        self.assertEquals(self.uid, s.st_uid)
2002
 
        self.assertEquals(self.gid, s.st_gid)
2003
 
 
2004
 
    def test_open_with_ownership_chown(self):
2005
 
        """Ensure that osutils.open_with_ownership chowns correctly with ownership_src.
2006
 
        """
2007
 
        ownsrc = '/'
2008
 
        f = osutils.open_with_ownership('foo', 'w', ownership_src=ownsrc)
2009
 
 
2010
 
        # do a test write and close
2011
 
        f.write('hello')
2012
 
        f.close()
2013
 
 
2014
 
        s = os.stat(ownsrc)
2015
 
        self.assertEquals(self.path, 'foo')
2016
 
        self.assertEquals(self.uid, s.st_uid)
2017
 
        self.assertEquals(self.gid, s.st_gid)
2018
 
 
 
1993
    def test_copy_ownership_from_path(self):
 
1994
        """copy_ownership_from_path test with specified src.
 
1995
        """
 
1996
        ownsrc = '/'
 
1997
        f = open('test_file', 'wt')
 
1998
        osutils.copy_ownership('test_file', ownsrc)
 
1999
 
 
2000
        s = os.stat(ownsrc)
 
2001
        self.assertEquals(self.path, 'test_file')
 
2002
        self.assertEquals(self.uid, s.st_uid)
 
2003
        self.assertEquals(self.gid, s.st_gid)
 
2004
 
 
2005
    def test_copy_ownership_nonesrc(self):
 
2006
        """copy_ownership_from_path test with src=None.
 
2007
        """
 
2008
        f = open('test_file', 'wt')
 
2009
        # should use parent dir for permissions
 
2010
        osutils.copy_ownership('test_file')
 
2011
 
 
2012
        s = os.stat('..')
 
2013
        self.assertEquals(self.path, 'test_file')
 
2014
        self.assertEquals(self.uid, s.st_uid)
 
2015
        self.assertEquals(self.gid, s.st_gid)