提交 21e490ad 编写于 作者: R raoxian

修改引入命名跟d.ts一致

Signed-off-by: Nraoxian <raoxian@huawei.com>
上级 a06b3953
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import securitylabel from '@ohos.securitylabel'; import securityLabel from '@ohos.securitylabel';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
...@@ -37,6 +37,6 @@ export { ...@@ -37,6 +37,6 @@ export {
afterAll, afterAll,
it, it,
expect, expect,
securitylabel, securityLabel,
fileio fileio
}; };
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import { import {
describe, it, expect, securitylabel, nextFileName, fileio describe, it, expect, securityLabel, nextFileName, fileio
} from './Common'; } from './Common';
describe('securitylabel', function () { describe('securitylabel', function () {
...@@ -33,8 +33,8 @@ describe('securitylabel', function () { ...@@ -33,8 +33,8 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
securitylabel.setSecurityLabel(fpath, 's0', function (err) { securityLabel.setSecurityLabel(fpath, 's0', function (err) {
securitylabel.getSecurityLabel(fpath, function (err, dataLevel) { securityLabel.getSecurityLabel(fpath, function (err, dataLevel) {
expect(dataLevel == 's0').assertTrue(); expect(dataLevel == 's0').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -60,8 +60,8 @@ describe('securitylabel', function () { ...@@ -60,8 +60,8 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
securitylabel.setSecurityLabel(fpath, 's1', async function (err) { securityLabel.setSecurityLabel(fpath, 's1', async function (err) {
let dataLevel = await securitylabel.getSecurityLabel(fpath); let dataLevel = await securityLabel.getSecurityLabel(fpath);
expect(dataLevel == 's1').assertTrue(); expect(dataLevel == 's1').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -86,8 +86,8 @@ describe('securitylabel', function () { ...@@ -86,8 +86,8 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
await securitylabel.setSecurityLabel(fpath, 's2'); await securityLabel.setSecurityLabel(fpath, 's2');
securitylabel.getSecurityLabel(fpath, function (err, dataLevel) { securityLabel.getSecurityLabel(fpath, function (err, dataLevel) {
expect(dataLevel == 's2').assertTrue(); expect(dataLevel == 's2').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -112,8 +112,8 @@ describe('securitylabel', function () { ...@@ -112,8 +112,8 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
await securitylabel.setSecurityLabel(fpath, 's3'); await securityLabel.setSecurityLabel(fpath, 's3');
let dataLevel = await securitylabel.getSecurityLabel(fpath); let dataLevel = await securityLabel.getSecurityLabel(fpath);
expect(dataLevel == 's3').assertTrue(); expect(dataLevel == 's3').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -137,8 +137,8 @@ describe('securitylabel', function () { ...@@ -137,8 +137,8 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
await securitylabel.setSecurityLabel(fpath, 's4'); await securityLabel.setSecurityLabel(fpath, 's4');
let dataLevel = await securitylabel.getSecurityLabel(fpath); let dataLevel = await securityLabel.getSecurityLabel(fpath);
expect(dataLevel == 's4').assertTrue(); expect(dataLevel == 's4').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -159,7 +159,7 @@ describe('securitylabel', function () { ...@@ -159,7 +159,7 @@ describe('securitylabel', function () {
*/ */
it('securitylabel_test_set_security_label_async_005', 0, async function (done) { it('securitylabel_test_set_security_label_async_005', 0, async function (done) {
try { try {
securitylabel.setSecurityLabel('', 's0', function (err) { securityLabel.setSecurityLabel('', 's0', function (err) {
expect(err.code == '-1').assertTrue(); expect(err.code == '-1').assertTrue();
done(); done();
}); });
...@@ -181,7 +181,7 @@ describe('securitylabel', function () { ...@@ -181,7 +181,7 @@ describe('securitylabel', function () {
*/ */
it('securitylabel_test_set_security_label_async_006', 0, async function (done) { it('securitylabel_test_set_security_label_async_006', 0, async function (done) {
try { try {
securitylabel.setSecurityLabel('/data/test.txt', 's0', function (err) { securityLabel.setSecurityLabel('/data/test.txt', 's0', function (err) {
expect(err.code == '-1').assertTrue(); expect(err.code == '-1').assertTrue();
done(); done();
}); });
...@@ -203,7 +203,7 @@ describe('securitylabel', function () { ...@@ -203,7 +203,7 @@ describe('securitylabel', function () {
*/ */
it('securitylabel_test_set_security_label_async_007', 0, async function (done) { it('securitylabel_test_set_security_label_async_007', 0, async function (done) {
try { try {
await securitylabel.setSecurityLabel('s0'); await securityLabel.setSecurityLabel('s0');
expect(null).assertFail(); expect(null).assertFail();
done(); done();
} catch (e) { } catch (e) {
...@@ -227,9 +227,9 @@ describe('securitylabel', function () { ...@@ -227,9 +227,9 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
securitylabel.setSecurityLabel(fpath, '', async function (err) { securityLabel.setSecurityLabel(fpath, '', async function (err) {
expect(err.code == '-1').assertTrue(); expect(err.code == '-1').assertTrue();
let dataLevel = await securitylabel.getSecurityLabel(fpath); let dataLevel = await securityLabel.getSecurityLabel(fpath);
expect(dataLevel == '').assertTrue(); expect(dataLevel == '').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -255,9 +255,9 @@ describe('securitylabel', function () { ...@@ -255,9 +255,9 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
securitylabel.setSecurityLabel(fpath, 'ss', async function (err) { securityLabel.setSecurityLabel(fpath, 'ss', async function (err) {
expect(err.code == '-1').assertTrue(); expect(err.code == '-1').assertTrue();
let dataLevel = await securitylabel.getSecurityLabel(fpath); let dataLevel = await securityLabel.getSecurityLabel(fpath);
expect(dataLevel == '').assertTrue(); expect(dataLevel == '').assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue();
done(); done();
...@@ -283,7 +283,7 @@ describe('securitylabel', function () { ...@@ -283,7 +283,7 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
await securitylabel.setSecurityLabel(fpath); await securityLabel.setSecurityLabel(fpath);
expect(null).assertFail(); expect(null).assertFail();
done(); done();
} catch (e) { } catch (e) {
...@@ -308,7 +308,7 @@ describe('securitylabel', function () { ...@@ -308,7 +308,7 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
securitylabel.setSecurityLabel(fpath, 's0', '', function (err) { securityLabel.setSecurityLabel(fpath, 's0', '', function (err) {
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -330,7 +330,7 @@ describe('securitylabel', function () { ...@@ -330,7 +330,7 @@ describe('securitylabel', function () {
*/ */
it('securitylabel_test_get_security_label_async_000', 0, async function (done) { it('securitylabel_test_get_security_label_async_000', 0, async function (done) {
try { try {
let dataLevel = await securitylabel.getSecurityLabel(''); let dataLevel = await securityLabel.getSecurityLabel('');
expect(dataLevel == '').assertTrue(); expect(dataLevel == '').assertTrue();
done(); done();
} catch (e) { } catch (e) {
...@@ -351,7 +351,7 @@ describe('securitylabel', function () { ...@@ -351,7 +351,7 @@ describe('securitylabel', function () {
*/ */
it('securitylabel_test_get_security_label_async_001', 0, async function (done) { it('securitylabel_test_get_security_label_async_001', 0, async function (done) {
try { try {
let dataLevel = await securitylabel.getSecurityLabel('/data/test.txt'); let dataLevel = await securityLabel.getSecurityLabel('/data/test.txt');
expect(dataLevel == '').assertTrue(); expect(dataLevel == '').assertTrue();
done(); done();
} catch (e) { } catch (e) {
...@@ -372,7 +372,7 @@ describe('securitylabel', function () { ...@@ -372,7 +372,7 @@ describe('securitylabel', function () {
*/ */
it('securitylabel_test_get_security_label_async_002', 0, async function (done) { it('securitylabel_test_get_security_label_async_002', 0, async function (done) {
try { try {
await securitylabel.getSecurityLabel(); await securityLabel.getSecurityLabel();
expect(null).assertFail(); expect(null).assertFail();
done(); done();
} catch (e) { } catch (e) {
...@@ -396,7 +396,7 @@ describe('securitylabel', function () { ...@@ -396,7 +396,7 @@ describe('securitylabel', function () {
fileio.openSync(fpath, 0o102, 0o666); fileio.openSync(fpath, 0o102, 0o666);
try { try {
securitylabel.getSecurityLabel(fpath, '', function(err, dataLevel) { securityLabel.getSecurityLabel(fpath, '', function(err, dataLevel) {
done(); done();
}); });
} catch (e) { } catch (e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册