Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4fdca903
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4fdca903
编写于
4月 28, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 28, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8556 [xts-acts][access_token][master]补充新增接口checkAccessTokenSync的XTS用例
Merge pull request !8556 from cwx1161213/master
上级
d0f0ac67
fa6732fb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
125 addition
and
0 deletion
+125
-0
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
...sTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
+125
-0
未找到文件。
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
浏览文件 @
4fdca903
...
...
@@ -436,6 +436,131 @@ describe('AccessTokenTest', function () {
done
();
})
/**
* @tc.number Test_checkAccessTokenSync_001
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc After the installation, user_grant permission is not granted by default(Promise).
*/
it
(
'
Test_checkAccessTokenSync_001
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
try
{
var
result
=
atManager
.
checkAccessTokenSync
(
tokenID
,
permissionNameUser
);
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
}
catch
(
err
)
{
console
.
info
(
"
Test_checkAccessTokenSync_001 tokenID
"
+
JSON
.
stringify
(
err
))
}
})
/**
* @tc.number Test_checkAccessTokenSync_002
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc After the installation, system_grant permission is granted by default(Promise).
*/
it
(
'
Test_checkAccessTokenSync_002
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
try
{
var
result
=
atManager
.
checkAccessTokenSync
(
tokenID
,
permissionNameSystem
);
console
.
info
(
"
Test_checkAccessTokenSync_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
done
();
}
catch
(
err
)
{
console
.
info
(
"
Test_checkAccessTokenSync_002 error code
"
+
err
.
code
+
"
error message
"
+
err
.
message
);
}
})
/**
* @tc.number Test_checkAccessTokenSync_003
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc Test invalid TokenID(0)(Promise).
*/
it
(
'
Test_checkAccessTokenSync_003
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
try
{
atManager
.
checkAccessTokenSync
(
0
,
permissionNameUser
)
}
catch
(
err
)
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
done
();
}
})
/**
* @tc.number Test_checkAccessTokenSync_004
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc Test invalid permission(empty)(Promise).
*/
it
(
'
Test_checkAccessTokenSync_004
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_004 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
try
{
atManager
.
checkAccessTokenSync
(
tokenID
,
""
)
}
catch
(
err
)
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
done
();
}
})
/**
* @tc.number Test_checkAccessTokenSync_005
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
*/
it
(
'
Test_checkAccessTokenSync_005
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
try
{
atManager
.
checkAccessTokenSync
(
tokenID
,
permissionName
)
}
catch
(
err
)
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
done
();
}
})
/**
* @tc.number Test_checkAccessTokenSync_006
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc Test Error tokenID(Promise).
*/
it
(
'
Test_checkAccessTokenSync_006
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_006 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIONS
"
;
try
{
var
result
=
atManager
.
checkAccessTokenSync
(
1111111111
,
permissionName
)
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
}
catch
(
err
)
{
console
.
info
(
"
Test_checkAccessTokenSync_006 tokenID
"
+
JSON
.
stringify
(
err
))
}
})
/**
* @tc.number Test_checkAccessTokenSync_007
* @tc.name Test atManager.checkAccessTokenSync.
* @tc.desc Test Error permission(Promise).
*/
it
(
'
Test_checkAccessTokenSync_007
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessTokenSync_007 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIO
"
;
try
{
var
result
=
atManager
.
checkAccessTokenSync
(
tokenID
,
permissionName
)
expect
(
result
).
assertEqual
(
RESULT_FAIL
);
done
();
}
catch
(
err
)
{
console
.
info
(
"
Test_checkAccessTokenSync_007 tokenID
"
+
JSON
.
stringify
(
err
))
}
})
/**
* @tc.number Test_requestPermissionsFromUser_0100
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录