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