Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1f1ebe51
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看板
未验证
提交
1f1ebe51
编写于
7月 06, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 06, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4118 security】【xts_m0614】修改access_token用例userId获取方式
Merge pull request !4118 from 金海/monthly_20220614
上级
785d2563
7b11f587
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js
...st_Normal_js/src/main/js/default/test/AccessToken.test.js
+12
-12
未找到文件。
security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js
浏览文件 @
1f1ebe51
...
@@ -41,8 +41,8 @@ describe('AccessTokenTest', function () {
...
@@ -41,8 +41,8 @@ describe('AccessTokenTest', function () {
console
.
info
(
'
##########start AccessTokenTest
'
);
console
.
info
(
'
##########start AccessTokenTest
'
);
beforeAll
(
async
function
(
done
){
beforeAll
(
async
function
(
done
){
var
accountManager
=
osAccount
.
getAccountManager
();
var
accountManager
=
osAccount
.
getAccountManager
();
var
localled
=
await
accountManager
.
getOsAccountType
FromProcess
();
var
userId
=
await
accountManager
.
getOsAccountLocalId
FromProcess
();
var
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.security.access_token.normal
'
,
0
,
localle
d
);
var
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.security.access_token.normal
'
,
0
,
userI
d
);
tokenID
=
appInfo
.
accessTokenId
;
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
"
AccessTokenTest accessTokenId:
"
+
appInfo
.
accessTokenId
+
"
, name:
"
+
appInfo
.
name
console
.
info
(
"
AccessTokenTest accessTokenId:
"
+
appInfo
.
accessTokenId
+
"
, name:
"
+
appInfo
.
name
+
"
, bundleName:
"
+
appInfo
.
bundleName
)
+
"
, bundleName:
"
+
appInfo
.
bundleName
)
...
@@ -70,10 +70,10 @@ describe('AccessTokenTest', function () {
...
@@ -70,10 +70,10 @@ describe('AccessTokenTest', function () {
* @tc.desc After the installation, user_grant permission is not granted by default(Promise).
* @tc.desc After the installation, user_grant permission is not granted by default(Promise).
*/
*/
it
(
'
Test_verifyAccessToken_001
'
,
0
,
async
function
(
done
){
it
(
'
Test_verifyAccessToken_001
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_verifyAccessToken_001 start
"
);
console
.
info
(
"
Test_verifyAccessToken_001 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameUser
);
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameUser
);
console
.
log
(
"
Test_verifyAccessToken_001 tokenID
"
+
tokenID
+
"
-
"
+
result
)
console
.
info
(
"
Test_verifyAccessToken_001 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
done
();
...
@@ -85,10 +85,10 @@ describe('AccessTokenTest', function () {
...
@@ -85,10 +85,10 @@ describe('AccessTokenTest', function () {
* @tc.desc After the installation, system_grant permission is granted by default(Promise).
* @tc.desc After the installation, system_grant permission is granted by default(Promise).
*/
*/
it
(
'
Test_verifyAccessToken_002
'
,
0
,
async
function
(
done
){
it
(
'
Test_verifyAccessToken_002
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_verifyAccessToken_002 start
"
);
console
.
info
(
"
Test_verifyAccessToken_002 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameSystem
);
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionNameSystem
);
console
.
log
(
"
Test_verifyAccessToken_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
console
.
info
(
"
Test_verifyAccessToken_002 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_GRANTED
);
done
();
done
();
...
@@ -100,10 +100,10 @@ describe('AccessTokenTest', function () {
...
@@ -100,10 +100,10 @@ describe('AccessTokenTest', function () {
* @tc.desc Test invalid TokenID(0)(Promise).
* @tc.desc Test invalid TokenID(0)(Promise).
*/
*/
it
(
'
Test_verifyAccessToken_003
'
,
0
,
async
function
(
done
){
it
(
'
Test_verifyAccessToken_003
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_verifyAccessToken_003 start
"
);
console
.
info
(
"
Test_verifyAccessToken_003 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
verifyAccessToken
(
0
,
permissionNameUser
);
var
result
=
await
atManager
.
verifyAccessToken
(
0
,
permissionNameUser
);
console
.
log
(
"
Test_verifyAccessToken_003 tokenID
"
+
tokenID
+
"
-
"
+
result
)
console
.
info
(
"
Test_verifyAccessToken_003 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
done
();
...
@@ -115,10 +115,10 @@ describe('AccessTokenTest', function () {
...
@@ -115,10 +115,10 @@ describe('AccessTokenTest', function () {
* @tc.desc Test invalid permission(empty)(Promise).
* @tc.desc Test invalid permission(empty)(Promise).
*/
*/
it
(
'
Test_verifyAccessToken_004
'
,
0
,
async
function
(
done
){
it
(
'
Test_verifyAccessToken_004
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_verifyAccessToken_004 start
"
);
console
.
info
(
"
Test_verifyAccessToken_004 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
""
);
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
""
);
console
.
log
(
"
Test_verifyAccessToken_004 tokenID
"
+
tokenID
+
"
-
"
+
result
)
console
.
info
(
"
Test_verifyAccessToken_004 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
done
();
...
@@ -130,14 +130,14 @@ describe('AccessTokenTest', function () {
...
@@ -130,14 +130,14 @@ describe('AccessTokenTest', function () {
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
* @tc.desc Test invalid permission(length exceeds 256)(Promise).
*/
*/
it
(
'
Test_verifyAccessToken_005
'
,
0
,
async
function
(
done
){
it
(
'
Test_verifyAccessToken_005
'
,
0
,
async
function
(
done
){
console
.
log
(
"
Test_verifyAccessToken_005 start
"
);
console
.
info
(
"
Test_verifyAccessToken_005 start
"
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
var
permissionName
=
"
ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
+
"
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
"
;
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionName
);
var
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
permissionName
);
console
.
log
(
"
Test_verifyAccessToken_005 tokenID
"
+
tokenID
+
"
-
"
+
result
)
console
.
info
(
"
Test_verifyAccessToken_005 tokenID
"
+
tokenID
+
"
-
"
+
result
)
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
expect
(
result
).
assertEqual
(
GrantStatus
.
PERMISSION_DENIED
);
done
();
done
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录