Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
acd88de1
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看板
提交
acd88de1
编写于
10月 09, 2022
作者:
L
liushuling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
整改XTS用例
Signed-off-by:
N
liushuling
<
liushuling1@huawei.com
>
上级
29670233
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
97 addition
and
10 deletion
+97
-10
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
...sTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
+97
-10
未找到文件。
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
浏览文件 @
acd88de1
...
...
@@ -32,6 +32,7 @@ var GrantStatus = {
const
RESULT_SUCCESS
=
0
;
const
RESULT_FAIL
=
-
1
;
const
TIMEOUT
=
5000
;
const
ERR_PARAM_INVALID
=
12100001
;
const
DEFAULT_PERMISSION_FALG
=
0
;
var
permissionNameUser
=
"
ohos.permission.ALPHA
"
;
...
...
@@ -176,10 +177,11 @@ describe('AccessTokenTest', function () {
*/
it
(
'
Test_verifyAccessTokenSync_002
'
,
0
,
function
(){
console
.
info
(
"
Test_verifyAccessTokenSync_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
atManager
.
verifyAccessTokenSync
(
0
,
permissionNameUser
);
console
.
info
(
"
Test_verifyAccessTokenSync_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
try
{
atManager
.
verifyAccessTokenSync
(
0
,
permissionNameUser
);
}
catch
(
error
)
{
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
/**
...
...
@@ -189,10 +191,11 @@ describe('AccessTokenTest', function () {
*/
it
(
'
Test_verifyAccessTokenSync_003
'
,
0
,
function
(){
console
.
info
(
"
Test_verifyAccessTokenSync_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
atManager
.
verifyAccessTokenSync
(
tokenID
,
""
);
console
.
info
(
"
Test_verifyAccessTokenSync_003 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
try
{
atManager
.
verifyAccessTokenSync
(
tokenID
,
""
);
}
catch
(
error
)
{
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
/**
...
...
@@ -207,9 +210,93 @@ describe('AccessTokenTest', function () {
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
var
result
=
atManager
.
verifyAccessTokenSync
(
tokenID
,
permissionName
);
console
.
info
(
"
Test_verifyAccessTokenSync_004 tokenID
"
+
tokenID
+
"
-
"
+
result
)
try
{
atManager
.
verifyAccessTokenSync
(
tokenID
,
permissionName
);
}
catch
(
error
)
{
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
/**
* @tc.number Test_checkAccessToken_001
* @tc.name Test atManager.checkAccessToken.
* @tc.desc After the installation, user_grant permission is not granted by default(Promise).
*/
it
(
'
Test_checkAccessToken_001
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_verifyAccessToken_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
checkAccessToken
(
tokenID
,
permissionNameUser
);
console
.
info
(
"
Test_checkAccessToken_001 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
})
/**
* @tc.number Test_checkAccessToken_002
* @tc.name Test atManager.checkAccessToken.
* @tc.desc After the installation, system_grant permission is granted by default(Promise).
*/
it
(
'
Test_checkAccessToken_002
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
checkAccessToken
(
tokenID
,
permissionNameSystem
);
console
.
info
(
"
Test_checkAccessToken_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
done
();
})
/**
* @tc.number Test_checkAccessToken_003
* @tc.name Test atManager.checkAccessToken.
* @tc.desc Test invalid TokenID(0)(Promise).
*/
it
(
'
Test_checkAccessToken_003
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
await
atManager
.
checkAccessToken
(
0
,
permissionNameUser
)
.
catch
((
err
)
=>
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
})
done
();
})
/**
* @tc.number Test_checkAccessToken_004
* @tc.name Test atManager.checkAccessToken.
* @tc.desc Test invalid permission(empty)(Promise).
*/
it
(
'
Test_checkAccessToken_004
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_004 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
await
atManager
.
checkAccessToken
(
tokenID
,
""
)
.
catch
((
err
)
=>
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
})
done
();
})
/**
* @tc.number Test_checkAccessToken_005
* @tc.name Test atManager.checkAccessToken.
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
*/
it
(
'
Test_checkAccessToken_005
'
,
0
,
async
function
(
done
){
console
.
info
(
"
Test_checkAccessToken_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
await
atManager
.
checkAccessToken
(
tokenID
,
permissionName
)
.
catch
((
err
)
=>
{
expect
(
err
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
})
done
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录