Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
da63edb3
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看板
未验证
提交
da63edb3
编写于
8月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9731 【OpenHarmony 4.0.11.1】【安全子系统】New Use Cases for useriam XTS
Merge pull request !9731 from qiaozzzh/0811_1
上级
2f542fc2
9dcf9a8a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
728 addition
and
0 deletion
+728
-0
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Enum.test.js
...function_test/userauthpart2/src/main/js/test/Enum.test.js
+80
-0
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Execute.test.js
...ction_test/userauthpart2/src/main/js/test/Execute.test.js
+549
-0
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/List.test.js
...function_test/userauthpart2/src/main/js/test/List.test.js
+6
-0
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/SignNormalNotAccessBiometricExecute.test.js
.../main/js/test/SignNormalNotAccessBiometricExecute.test.js
+93
-0
未找到文件。
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Enum.test.js
0 → 100644
浏览文件 @
da63edb3
/*
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
,
Level
}
from
'
@ohos/hypium
'
import
userAuth
from
'
@ohos.userIAM.userAuth
'
export
default
function
signNormalNotAccessBiometricEnumExecute
()
{
describe
(
'
signNormalNotAccessBiometricEnumExecute
'
,
function
()
{
/*
* @tc.number : Security_IAM_userAuthType_Kit_Func_0084
* @tc.name : execute_enum_userAuthType
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_userAuthType_Kit_Func_0084
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_userAuthType_Kit_Func_0084 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
UserAuthType
.
PIN
);
expect
(
2
).
assertEqual
(
userAuth
.
UserAuthType
.
FACE
);
expect
(
4
).
assertEqual
(
userAuth
.
UserAuthType
.
FINGERPRINT
);
console
.
info
(
'
Security_IAM_userAuthType_Kit_Func_0084 end
'
);
done
();
})
/*
* @tc.number : Security_IAM_widgetNotice_Kit_Func_0085
* @tc.name : execute_enum_windowModeType
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_widgetNotice_Kit_Func_0085
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
'
Security_IAM_widgetNotice_Kit_Func_0085 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
WindowModeType
.
DIALOG_BOX
);
expect
(
2
).
assertEqual
(
userAuth
.
WindowModeType
.
FULLSCREEN
);
console
.
info
(
'
Security_IAM_widgetNotice_Kit_Func_0085 end
'
);
done
();
})
/*
* @tc.number : Security_IAM_widgetNotice_Kit_Func_0086
* @tc.name : execute_enum_noticeType
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_widgetNotice_Kit_Func_0086
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_widgetNotice_Kit_Func_0086 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
NoticeType
.
WIDGET_NOTICE
);
console
.
info
(
'
Security_IAM_widgetNotice_Kit_Func_0086 end
'
);
done
();
})
/*
* @tc.number : Security_IAM_userAuthResultCode_Kit_Func_0087
* @tc.name : execute_enum_userAuthResultCode
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_userAuthResultCode_Kit_Func_0087
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
'
Security_IAM_userAuthResultCode_Kit_Func_0087 start
'
);
expect
(
12500011
).
assertEqual
(
userAuth
.
UserAuthResultCode
.
CANCELED_FROM_WIDGET
);
console
.
info
(
'
Security_IAM_userAuthResultCode_Kit_Func_0087 end
'
);
done
();
})
});
};
\ No newline at end of file
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Execute.test.js
0 → 100644
浏览文件 @
da63edb3
/*
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
,
Level
}
from
'
@ohos/hypium
'
import
userAuth
from
'
@ohos.userIAM.userAuth
'
const
authParamDefault
=
{
challenge
:
new
Uint8Array
([
49
,
49
,
49
,
49
,
49
,
49
]),
authType
:
[
userAuth
.
UserAuthType
.
PIN
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL1
,
};
const
widgetParamDefault
=
{
title
:
'
使用密码验证
'
,
};
export
default
function
signNormalAccessBiometricExecute
()
{
describe
(
'
signNormalAccessBiometricExecute
'
,
function
()
{
function
userAuthPromise
(...
args
){
return
new
Promise
((
resolve
,
reject
)
=>
{
try
{
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
args
[
0
],
args
[
1
]);
userAuthInstance
.
on
(
'
result
'
,
{
callback
:
(
onResult
)
=>
{
console
.
info
(
`
${
args
[
2
]}
callback
${
onResult
}
`
);
console
.
info
(
'
onResult.token is
'
+
onResult
.
token
);
console
.
info
(
'
onResult.authType is
'
+
onResult
.
authType
);
expect
(
onResult
.
result
).
assertEqual
(
args
[
3
]);
resolve
();
}
});
userAuthInstance
.
start
();
}
catch
(
e
)
{
console
.
info
(
`
${
args
[
2
]}
fail
${
e
.
code
}
`
);
expect
(
null
).
assertFail
();
reject
();
}
})
}
/*
* @tc.number : Security_IAM_getUserAuthInstance_Func_0043
* @tc.name : execute_getUserAuthInstance_params_onResult_offResult_start_cancel
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_getUserAuthInstance_Func_0043
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0043 start
"
);
const
authParams
=
[
{
...
authParamDefault
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FACE
]
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FINGERPRINT
]
},
{
...
authParamDefault
,
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL2
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FACE
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL2
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FINGERPRINT
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL2
},
{
...
authParamDefault
,
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL3
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FINGERPRINT
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL3
},
{
...
authParamDefault
,
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL4
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FACE
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL3
}
];
let
stepIndex
=
1
;
for
(
let
index
=
0
;
index
<
authParams
.
length
;
index
++
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0043 authParams:
"
+
JSON
.
stringify
(
authParams
[
index
]));
await
userAuthPromise
(
authParams
[
index
],
widgetParamDefault
,
'
Security_IAM_getUserAuthInstance_Func_0043 step
'
+
stepIndex
,
userAuth
.
UserAuthResultCode
.
NOT_ENROLLED
);
stepIndex
++
;
}
const
notSupportTLParams
=
[
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FACE
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL4
},
{
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FINGERPRINT
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL4
}
];
for
(
let
index
=
0
;
index
<
notSupportTLParams
.
length
;
index
++
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0043 notSupportTLParams:
"
+
JSON
.
stringify
(
notSupportTLParams
[
index
]));
await
userAuthPromise
(
notSupportTLParams
[
index
],
widgetParamDefault
,
'
Security_IAM_getUserAuthInstance_Func_0043 step
'
+
stepIndex
,
userAuth
.
UserAuthResultCode
.
NOT_ENROLLED
);
stepIndex
++
;
}
// 补充到60个字符
let
widgetParams
=
[
{
title
:
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
,
},
{
title
:
'
使用密码验证
'
,
navigationButtonText
:
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
,
}
];
for
(
let
index
=
0
;
index
<
widgetParams
.
length
;
index
++
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0043 widgetParams:
"
+
JSON
.
stringify
(
widgetParams
[
index
]));
await
userAuthPromise
({
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FACE
]
},
widgetParams
[
index
],
'
Security_IAM_getUserAuthInstance_Func_0043 step
'
+
stepIndex
,
userAuth
.
UserAuthResultCode
.
NOT_ENROLLED
);
stepIndex
++
;
}
done
();
});
/*
* @tc.number : Security_IAM_getUserAuthInstance_Func_0107
* @tc.name : execute_getUserAuthInstance_params
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_getUserAuthInstance_Func_0107
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0107 start
"
);
const
authParamWithoutType
=
{
challenge
:
new
Uint8Array
([
49
,
49
,
49
,
49
,
49
,
49
]),
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL1
,
};
const
authParamWithoutTL
=
{
challenge
:
new
Uint8Array
([
49
,
49
,
49
,
49
,
49
,
49
]),
authType
:
[
userAuth
.
UserAuthType
.
PIN
]
};
const
authTestParams
=
[
{
authParam
:
{
authType
:
[
userAuth
.
UserAuthType
.
PIN
],
authTrustLevel
:
userAuth
.
AuthTrustLevel
.
ATL1
,
},
ret
:
401
},
{
authParam
:
{
...
authParamDefault
,
challenge
:
null
,
},
ret
:
401
},
{
authParam
:
{
...
authParamDefault
,
challenge
:
new
Uint8Array
([
'
aaa
'
]),
},
ret
:
0
},
{
authParam
:
{
...
authParamWithoutType
},
ret
:
401
},
{
authParam
:
{
...
authParamWithoutType
,
authType
:
null
,
},
ret
:
401
},
{
authParam
:
{
...
authParamWithoutType
,
authType
:
[
5
],
},
ret
:
userAuth
.
UserAuthResultCode
.
TYPE_NOT_SUPPORT
},
{
authParam
:
{
...
authParamWithoutType
,
authType
:
[
-
1
],
},
ret
:
userAuth
.
UserAuthResultCode
.
TYPE_NOT_SUPPORT
},
{
authParam
:
{
...
authParamWithoutType
,
authType
:
[
'
a
'
]
},
ret
:
401
},
{
authParam
:
{
...
authParamWithoutTL
},
ret
:
401
},
{
authParam
:
{
...
authParamWithoutTL
,
authTrustLevel
:
null
,
},
ret
:
401
},
{
authParam
:
{
...
authParamWithoutTL
,
authTrustLevel
:
-
1
,
},
ret
:
userAuth
.
UserAuthResultCode
.
TRUST_LEVEL_NOT_SUPPORT
},
{
authParam
:
{
...
authParamWithoutTL
,
authTrustLevel
:
'
a
'
,
},
ret
:
401
}
];
let
stepIndex
=
1
;
for
(
let
index
=
0
;
index
<
authTestParams
.
length
;
index
++
)
{
try
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0107 authTestParams:
"
+
JSON
.
stringify
(
authTestParams
[
index
]));
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authTestParams
[
index
].
authParam
,
widgetParamDefault
);
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0107 step
${
stepIndex
}
success`
);
if
(
authTestParams
[
index
].
ret
===
0
)
{
expect
(
userAuthInstance
).
not
().
assertNull
();
}
else
{
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0107 step
${
stepIndex
}
fail
${
e
.
code
}
`
);
if
(
authTestParams
[
index
].
ret
===
0
)
{
expect
(
null
).
assertFail
();
}
else
{
expect
(
e
.
code
).
assertEqual
(
authTestParams
[
index
].
ret
);
}
}
stepIndex
++
;
}
const
widgetTestParams
=
[
{
widgetParam
:
{
title
:
'
使用密码验证
'
,
navigationButtonText
:
1
},
ret
:
401
},
{
widgetParam
:
{
title
:
'
使用密码验证
'
,
navigationButtonText
:
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijj
'
,
},
ret
:
401
},
{
widgetParam
:
{
navigationButtonText
:
'
确定
'
,
},
ret
:
401
},
{
widgetParam
:
{
title
:
null
,
navigationButtonText
:
'
确定
'
,
},
ret
:
401
},
{
widgetParam
:
{
title
:
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
'
+
'
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijj
'
,
navigationButtonText
:
'
确定
'
,
},
ret
:
401
},
];
for
(
let
index
=
0
;
index
<
widgetTestParams
.
length
;
index
++
)
{
try
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0107 widgetTestParams:
"
+
JSON
.
stringify
(
widgetTestParams
[
index
]));
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
({
...
authParamDefault
,
authType
:
[
userAuth
.
UserAuthType
.
FACE
]
},
widgetTestParams
[
index
].
widgetParam
);
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0107 step
${
stepIndex
}
success`
);
if
(
widgetTestParams
[
index
].
ret
===
0
)
{
expect
(
userAuthInstance
).
not
().
assertNull
();
}
else
{
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0107 step
${
stepIndex
}
fail
${
e
.
code
}
`
);
if
(
widgetTestParams
[
index
].
ret
===
0
)
{
expect
(
null
).
assertFail
();
}
else
{
expect
(
e
.
code
).
assertEqual
(
widgetTestParams
[
index
].
ret
);
}
}
stepIndex
++
;
}
done
();
});
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0004
* @tc.name : execute_userAuthInstance_on_is_aaaa_null_undefined
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0004
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0004 start
"
);
const
eventParams
=
[
{
type
:
"
aaaa
"
,
cb
:
{
callback
:(
result
)
=>
{}
}
},
{
type
:
null
,
cb
:
{
callback
:(
result
)
=>
{}
}
},
{
type
:
0
,
cb
:
0
},
{
type
:
"
result
"
,
cb
:
0
},
{
type
:
"
result
"
,
cb
:
null
}
];
for
(
let
index
=
0
;
index
<
eventParams
.
length
;
index
++
)
{
try
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0004 eventParams:
"
+
JSON
.
stringify
(
eventParams
[
index
]));
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
if
(
eventParams
[
index
].
type
===
0
)
{
userAuthInstance
.
on
();
}
else
if
(
eventParams
[
index
].
cb
===
0
)
{
userAuthInstance
.
on
(
eventParams
[
index
].
type
);
}
else
{
userAuthInstance
.
on
(
eventParams
[
index
].
type
,
eventParams
[
index
].
cb
);
}
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0004 step
${
index
+
1
}
success`
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0004 step
${
index
+
1
}
fail
${
e
.
code
}
`
);
expect
(
e
.
code
).
assertEqual
(
401
);
}
}
done
();
});
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0005
* @tc.name : execute_userAuthInstance_off_is_aaaa_null_undefined_callbackUndefined
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0005
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0005 start
"
);
const
eventParams
=
[
{
type
:
"
aaaa
"
,
cb
:
{
callback
:(
result
)
=>
{}
}
},
{
type
:
null
,
cb
:
{
callback
:(
result
)
=>
{}
}
},
{
type
:
0
,
cb
:
0
},
{
type
:
"
result
"
,
cb
:
null
}
];
for
(
let
index
=
0
;
index
<
eventParams
.
length
;
index
++
)
{
try
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0005 eventParams:
"
+
JSON
.
stringify
(
eventParams
[
index
]));
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
if
(
eventParams
[
index
].
type
===
0
)
{
userAuthInstance
.
off
();
}
else
if
(
eventParams
[
index
].
cb
===
0
)
{
userAuthInstance
.
off
(
eventParams
[
index
].
type
);
}
else
{
userAuthInstance
.
off
(
eventParams
[
index
].
type
,
eventParams
[
index
].
cb
);
}
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0005 step
${
index
+
1
}
success`
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0005 step
${
index
+
1
}
fail
${
e
.
code
}
`
);
expect
(
e
.
code
).
assertEqual
(
401
);
}
}
done
();
});
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0007
* @tc.name : execute_userAuthInstance_start_is_aaaa_null
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0007
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0007 start
"
);
const
startParams
=
[
"
aaaa
"
,
null
];
for
(
let
index
=
0
;
index
<
startParams
.
length
;
index
++
)
{
try
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0007 startParams:
"
+
JSON
.
stringify
(
startParams
[
index
]));
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
start
(
startParams
[
index
]);
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0007 step
${
index
+
1
}
success`
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0007 step
${
index
+
1
}
fail
${
e
.
code
}
`
);
expect
(
e
.
code
).
assertEqual
(
401
);
}
}
done
();
});
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0009
* @tc.name : execute_userAuthInstance_cancel_is_aaaa_null
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0009
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0009 start
"
);
const
cancelParams
=
[
"
aaaa
"
,
null
];
for
(
let
index
=
0
;
index
<
cancelParams
.
length
;
index
++
)
{
try
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0009 cancelParams:
"
+
JSON
.
stringify
(
cancelParams
[
index
]));
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
start
();
userAuthInstance
.
cancel
(
cancelParams
[
index
]);
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0009 step
${
index
+
1
}
success`
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_UserAuthInstance_Func_0009 step
${
index
+
1
}
fail
${
e
.
code
}
`
);
expect
(
e
.
code
).
assertEqual
(
401
);
}
}
done
();
});
/*
* @tc.number : Security_IAM_getUserAuthInstance_Func_0088
* @tc.name : execute_userAuthInstance_off
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_getUserAuthInstance_Func_0088
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0088 start
"
);
try
{
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
off
();
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0088 step1 success`
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0088 step1 fail
${
e
.
code
}
`
);
expect
(
e
.
code
).
assertEqual
(
401
);
}
done
();
});
/*
* @tc.number : Security_IAM_getUserAuthInstance_Func_0089
* @tc.name : execute_userAuthInstance_cancel
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_getUserAuthInstance_Func_0089
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_getUserAuthInstance_Func_0089 start
"
);
try
{
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
off
();
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0089 step$1 success`
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_getUserAuthInstance_Func_0089 step1 fail
${
e
.
code
}
`
);
expect
(
e
.
code
).
assertEqual
(
401
);
}
done
();
});
});
};
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/List.test.js
浏览文件 @
da63edb3
...
@@ -14,7 +14,13 @@
...
@@ -14,7 +14,13 @@
*/
*/
import
userauthTest
from
'
./Security_IAM_PIN_Kit_CallbackJsunit.test.js
'
import
userauthTest
from
'
./Security_IAM_PIN_Kit_CallbackJsunit.test.js
'
import
userauthTest_API9
from
'
./Security_IAM_FUNC_Jsunit.test.js
'
import
userauthTest_API9
from
'
./Security_IAM_FUNC_Jsunit.test.js
'
import
signNormalAccessBiometricExecute
from
'
./Execute.test.js
'
import
signNormalNotAccessBiometricEnumExecute
from
'
./Enum.test.js
'
import
signNormalNotAccessBiometricExecute
from
'
./SignNormalNotAccessBiometricExecute.test.js
'
export
default
function
testsuite
()
{
export
default
function
testsuite
()
{
userauthTest
()
userauthTest
()
userauthTest_API9
()
userauthTest_API9
()
signNormalAccessBiometricExecute
()
signNormalNotAccessBiometricEnumExecute
()
signNormalNotAccessBiometricExecute
()
}
}
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/SignNormalNotAccessBiometricExecute.test.js
0 → 100644
浏览文件 @
da63edb3
/*
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
,
Level
}
from
'
@ohos/hypium
'
import
userAuth
from
'
@ohos.userIAM.userAuth
'
const
authParamDefault
=
{
challenge
:
new
Uint8Array
([
49
,
49
,
49
,
49
,
49
,
49
]),
authType
:
[
1
],
authTrustLevel
:
10000
,
};
const
widgetParamDefault
=
{
title
:
'
使用密码验证
'
,
};
export
default
function
signNormalNotAccessBiometricExecute
()
{
describe
(
'
signNormalNotAccessBiometricExecute
'
,
function
()
{
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0042
* @tc.name : execute_userAuthInstance_on_off_result
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0042
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0042 start
"
);
try
{
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{}
});
userAuthInstance
.
off
(
"
result
"
,
{
callback
:
(
result
)
=>
{}
});
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0042 success
"
);
expect
(
userAuthInstance
).
not
().
assertNull
();
}
catch
(
e
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0042 fail
"
+
e
.
code
);
expect
(
null
).
assertFail
();
}
done
();
});
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0050
* @tc.name : execute_userAuthInstance_start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0050
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0050 start
"
);
try
{
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
start
();
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0050 success
"
);
}
catch
(
e
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0050 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
}
done
();
});
/*
* @tc.number : Security_IAM_UserAuthInstance_Func_0090
* @tc.name : execute_userAuthInstance_cancel
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level.LEVEL2
*/
it
(
'
Security_IAM_UserAuthInstance_Func_0090
'
,
Level
.
LEVEL2
,
async
function
(
done
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0090 start
"
);
try
{
const
userAuthInstance
=
userAuth
.
getUserAuthInstance
(
authParamDefault
,
widgetParamDefault
);
userAuthInstance
.
cancel
();
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0090 success
"
);
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
info
(
"
Security_IAM_UserAuthInstance_Func_0090 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuth
.
UserAuthResultCode
.
GENERAL_ERROR
);
}
done
();
});
});
};
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录