def test_creates_a_directory_if_it_doesnt_exist(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 = 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
host.mkdir(path, owner=owner, group=group, perms=perms)
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_.makedirs.assert_called_with(realpath, perms)
os_.chown.assert_called_with(realpath, uid, gid)
评论列表
文章目录