未验证 提交 eb013486 编写于 作者: O openharmony_ci 提交者: Gitee

!5274 重新提交fchown.test.js 异步004和005用例

Merge pull request !5274 from raoxian/monthly_20220816
......@@ -122,6 +122,54 @@ describe('fileio_fchown', async function () {
}
});
/**
* @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0400
* @tc.name fileio_test_fchown_async_004
* @tc.desc Test the fchownAsync() interface with promise, wrong owner. Test file modification failed.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_fchown_async_004', 0, async function (done) {
let fpath = await nextFileName('fileio_test_fchown_async_004');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let fd = fileio.openSync(fpath);
let stat = fileio.statSync(fpath);
await fileio.fchown(fd, null, stat.gid);
} catch (e) {
console.info('fileio_test_fchown_async_004 has failed for ' + e);
expect(e.message == "Operation not permitted" || e.message == "Invalid owner").assertTrue();
fileio.unlinkSync(fpath);
done();
}
});
/**
* @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0500
* @tc.name fileio_test_fchown_async_005
* @tc.desc Test the fchownAsync() interface with promise, wrong group. Test file modification failed.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_fchown_async_005', 0, async function (done) {
let fpath = await nextFileName('fileio_test_fchown_async_005');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let fd = fileio.openSync(fpath);
let stat = fileio.statSync(fpath);
await fileio.fchown(fd, stat.uid, null);
} catch (e) {
console.info('fileio_test_fchown_async_005 has failed for ' + e);
expect(e.message == "Invalid group").assertTrue();
fileio.unlinkSync(fpath);
done();
}
});
/**
* @tc.number SUB_DF_FILEIO_FCHOWN_SYNC_0000
* @tc.name fileio_test_fchown_sync_000
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册