Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
869db973
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
869db973
编写于
3月 17, 2023
作者:
崔
崔超
提交者:
Gitee
3月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[xts-acts][access_token][master]补充xts用例
Signed-off-by:
N
崔超
<
cuichao16@huawei.com
>
上级
b0ca8538
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
126 addition
and
2 deletion
+126
-2
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
...sTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
+126
-2
未找到文件。
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
浏览文件 @
869db973
...
...
@@ -65,7 +65,7 @@ describe('AccessTokenTest', function () {
}
}
/**
/**
* @tc.number Test_verifyAccessToken_001
* @tc.name Test atManager.verifyAccessToken.
* @tc.desc After the installation, user_grant permission is not granted by default(Promise).
...
...
@@ -143,6 +143,39 @@ describe('AccessTokenTest', function () {
done
();
})
/**
* @tc.number Test_verifyAccessToken_006
* @tc.name Test atManager.verifyAccessToken.
* @tc.desc Test Error tokenID(Promise).
*/
it
(
'
Test_verifyAccessToken_006
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_verifyAccessToken_006 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIONS
"
;
var
result
=
await
atManager
.
verifyAccessToken
(
1111111111
,
permissionName
);
console
.
info
(
"
Test_verifyAccessToken_006 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
})
/**
* @tc.number Test_verifyAccessToken_007
* @tc.name Test atManager.verifyAccessToken.
* @tc.desc Test Error permission(Promise).
*/
it
(
'
Test_verifyAccessToken_007
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_verifyAccessToken_007 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIO
"
;
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionName
);
console
.
info
(
"
Test_verifyAccessToken_007 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
})
/**
* @tc.number Test_verifyAccessTokenSync_0000
...
...
@@ -222,6 +255,42 @@ describe('AccessTokenTest', function () {
}
})
/**
* @tc.number Test_verifyAccessTokenSync_0500
* @tc.name Test_verifyAccessTokenSync_005.
* @tc.desc Test Error tokenID(Promise).
*/
it
(
'
Test_verifyAccessTokenSync_005
'
,
0
,
function
(){
console
.
info
(
"
Test_verifyAccessTokenSync_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIONS
"
;
try
{
atManager
.
verifyAccessTokenSync
(
1111111111
,
permissionName
);
}
catch
(
error
)
{
console
.
info
(
"
Test_verifyAccessTokenSync_005 tokenID
"
+
JSON
.
stringify
(
error
))
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
/**
* @tc.number Test_verifyAccessTokenSync_0600
* @tc.name Test_verifyAccessTokenSync_006.
* @tc.desc Test Error permission(Promise).
*/
it
(
'
Test_verifyAccessTokenSync_006
'
,
0
,
function
(){
console
.
info
(
"
Test_verifyAccessTokenSync_006 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIO
"
;
try
{
atManager
.
verifyAccessTokenSync
(
tokenID
,
permissionName
);
}
catch
(
error
)
{
console
.
info
(
"
Test_verifyAccessTokenSync_006 tokenID
"
+
JSON
.
stringify
(
error
))
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
/**
* @tc.number Test_checkAccessToken_001
* @tc.name Test atManager.checkAccessToken.
...
...
@@ -314,6 +383,61 @@ describe('AccessTokenTest', function () {
})
/**
* @tc.number Test_checkAccessToken_006
* @tc.name Test atManager.checkAccessToken.
* @tc.desc After the installation, user_grant permission is not granted by default(Promise).
*/
it
(
'
Test_checkAccessToken_006
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_006 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
try
{
atManager
.
checkAccessToken
(
tokenID
,
permissionNameUser
);
}
catch
(
error
)
{
console
.
info
(
"
Test_checkAccessToken_006 tokenID
"
+
JSON
.
stringify
(
error
))
expect
(
error
.
code
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
}
done
();
})
/**
* @tc.number Test_checkAccessToken_007
* @tc.name Test atManager.checkAccessToken.
* @tc.desc Test Error tokenID(Promise).
*/
it
(
'
Test_checkAccessToken_007
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_007 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIONS
"
;
try
{
atManager
.
checkAccessToken
(
1111111111
,
permissionName
)
}
catch
(
err
)
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
done
();
})
/**
* @tc.number Test_checkAccessToken_008
* @tc.name Test atManager.checkAccessToken.
* @tc.desc Test Error permission(Promise).
*/
it
(
'
Test_checkAccessToken_008
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_008 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.GRANT_SENSITIVE_PERMISSIO
"
;
try
{
atManager
.
checkAccessToken
(
tokenID
,
permissionName
)
}
catch
(
err
)
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
done
();
})
/**
* @tc.number Test_requestPermissionsFromUser_0100
* @tc.name Test_requestPermissionsFromUser_001.
* @tc.desc RequestPermissionsFromUser normal scenario(Promise).
...
...
@@ -402,6 +526,6 @@ describe('AccessTokenTest', function () {
}
done
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录