def test_removes_file_with_same_path_before_mkdir(self, os_, log,
getgrnam, getpwnam):
uid = 123
gid = 234
owner = 'some-user'
group = 'some-group'
path = '/some/other/path/from/link'
realpath = '/some/path'
path_exists = True
force = True
is_dir = False
perms = 0o644
getpwnam.return_value.pw_uid = uid
getgrnam.return_value.gr_gid = gid
os_.path.abspath.return_value = realpath
os_.path.exists.return_value = path_exists
os_.path.isdir.return_value = is_dir
host.mkdir(path, owner=owner, group=group, perms=perms, force=force)
getpwnam.assert_called_with('some-user')
getgrnam.assert_called_with('some-group')
os_.path.abspath.assert_called_with(path)
os_.path.exists.assert_called_with(realpath)
os_.unlink.assert_called_with(realpath)
os_.makedirs.assert_called_with(realpath, perms)
os_.chown.assert_called_with(realpath, uid, gid)
评论列表
文章目录