Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f05fd020
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看板
未验证
提交
f05fd020
编写于
10月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5828 整改XTS
Merge pull request !5828 from liushuling/master
上级
a12aeebf
928a825f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
110 addition
and
9 deletion
+110
-9
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
...sTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
+110
-9
未找到文件。
security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js
浏览文件 @
f05fd020
...
@@ -32,6 +32,7 @@ var GrantStatus = {
...
@@ -32,6 +32,7 @@ var GrantStatus = {
const
RESULT_SUCCESS
=
0
;
const
RESULT_SUCCESS
=
0
;
const
RESULT_FAIL
=
-
1
;
const
RESULT_FAIL
=
-
1
;
const
TIMEOUT
=
5000
;
const
TIMEOUT
=
5000
;
const
ERR_PARAM_INVALID
=
12100001
;
const
DEFAULT_PERMISSION_FALG
=
0
;
const
DEFAULT_PERMISSION_FALG
=
0
;
var
permissionNameUser
=
"
ohos.permission.ALPHA
"
;
var
permissionNameUser
=
"
ohos.permission.ALPHA
"
;
...
@@ -177,9 +178,12 @@ describe('AccessTokenTest', function () {
...
@@ -177,9 +178,12 @@ describe('AccessTokenTest', function () {
it
(
'
Test_verifyAccessTokenSync_002
'
,
0
,
function
(){
it
(
'
Test_verifyAccessTokenSync_002
'
,
0
,
function
(){
console
.
info
(
"
Test_verifyAccessTokenSync_002 start
"
);
console
.
info
(
"
Test_verifyAccessTokenSync_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
atManager
.
verifyAccessTokenSync
(
0
,
permissionNameUser
);
try
{
console
.
info
(
"
Test_verifyAccessTokenSync_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
atManager
.
verifyAccessTokenSync
(
0
,
permissionNameUser
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
}
catch
(
error
)
{
console
.
info
(
"
Test_verifyAccessTokenSync_002 tokenID
"
+
JSON
.
stringify
(
error
))
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
})
/**
/**
...
@@ -190,9 +194,12 @@ describe('AccessTokenTest', function () {
...
@@ -190,9 +194,12 @@ describe('AccessTokenTest', function () {
it
(
'
Test_verifyAccessTokenSync_003
'
,
0
,
function
(){
it
(
'
Test_verifyAccessTokenSync_003
'
,
0
,
function
(){
console
.
info
(
"
Test_verifyAccessTokenSync_003 start
"
);
console
.
info
(
"
Test_verifyAccessTokenSync_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
atManager
.
verifyAccessTokenSync
(
tokenID
,
""
);
try
{
console
.
info
(
"
Test_verifyAccessTokenSync_003 tokenID
"
+
tokenID
+
"
-
"
+
result
)
atManager
.
verifyAccessTokenSync
(
tokenID
,
""
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
}
catch
(
error
)
{
console
.
info
(
"
Test_verifyAccessTokenSync_003 tokenID
"
+
JSON
.
stringify
(
error
))
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
})
})
/**
/**
...
@@ -207,9 +214,103 @@ describe('AccessTokenTest', function () {
...
@@ -207,9 +214,103 @@ describe('AccessTokenTest', function () {
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
var
result
=
atManager
.
verifyAccessTokenSync
(
tokenID
,
permissionName
);
try
{
console
.
info
(
"
Test_verifyAccessTokenSync_004 tokenID
"
+
tokenID
+
"
-
"
+
result
)
atManager
.
verifyAccessTokenSync
(
tokenID
,
permissionName
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
}
catch
(
error
)
{
console
.
info
(
"
Test_verifyAccessTokenSync_004 tokenID
"
+
JSON
.
stringify
(
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_checkAccessToken_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
try
{
atManager
.
checkAccessToken
(
tokenID
,
permissionNameUser
);
}
catch
(
error
)
{
console
.
info
(
"
Test_checkAccessToken_001 tokenID
"
+
JSON
.
stringify
(
error
))
expect
(
error
.
code
).
assertEqual
(
ERR_PARAM_INVALID
);
}
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
();
try
{
var
result
=
await
atManager
.
checkAccessToken
(
tokenID
,
permissionNameSystem
);
console
.
info
(
"
Test_checkAccessToken_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
}
catch
(
error
)
{
console
.
info
(
"
Test_checkAccessToken_002 error code
"
+
error
.
code
+
"
error message
"
+
error
.
message
);
}
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
();
try
{
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
();
try
{
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
"
;
try
{
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录