提交 dd05c451 编写于 作者: H hu-jixiang1 提交者: 胡吉翔

fixed 7a003e2b from https://gitee.com/hu-jixiang1/xts_acts/pulls/3206

hujixiang1@huawei.com
Signed-off-by: Nhu-jixiang1 <hujixiang1@huawei.com>
Change-Id: Ide6c282a7befc34d98a41417ed06bfe13e6a8308
上级 f8d517ac
......@@ -31,11 +31,16 @@ function publicRegisterInputer(PinAuth,AuthSubType,Inputerdata){
try {
console.info('testFace publicRegisterInputer in try');
console.info('testFace publicRegisterInputer PinAuth = ' + PinAuth);
let GetAuthSubType = 0;
let registerresult = PinAuth.registerInputer({
onGetData: (AuthSubType, IInputData) => {
console.info('testFace faceDemo registerInputer AuthSubType');
console.info('testFace faceDemo registerInputer AuthSubType111');
IInputData.onSetData(AuthSubType, Inputerdata)
onGetData: (GetAuthSubType, IInputData) => {
if (GetAuthSubType == 0) {
console.info('testFace faceDemo registerInputer AuthSubType');
console.info('testFace faceDemo registerInputer AuthSubType111');
IInputData.onSetData(AuthSubType, Inputerdata)
} else {
IInputData.onSetData(GetAuthSubType, Inputerdata)
}
}
})
console.log("testFace publicRegisterInputer result is: " + registerresult);
......
......@@ -175,59 +175,6 @@ describe('userauthTest', function () {
}
})
/*
* @tc.number : Security_IAM_Face_AddCred_DFX_0104
* @tc.name : Can't add face with no pin
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('Security_IAM_Face_AddCred_DFX_0104', 2, async function (done) {
try {
publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
publicFC.publicOpenSession(UserIDM, function (data) {
let challenge = data;
console.info("Security_IAM_Face_AddCred_DFX_0104 challenge = " + challenge)
publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
publicFC.publicauth(UserAuth, challenge, AuthType.PIN, AuthTurstLevel.ATL1, function (data) {
console.info("Security_IAM_Face_AddCred_DFX_0104 info101 = " + JSON.stringify(data))
let token = data.authextr.token
CredentialInfoface2d.token = token
console.info("Security_IAM_Face_AddCred_DFX_0104 token = " + token)
publicFC.publicaddCredential(UserIDM, CredentialInfoface2d, function (data) {
console.info("Face_AddCred_DFX_0104 addfaceresult1 = " + JSON.stringify(data))
expect(ResultCode.SUCCESS).assertEqual(data.addCredresult);
publicFC.publicaddCredential(UserIDM, CredentialInfoface2d, function (data) {
console.info("Face_AddCred_DFX_0104 addfaceresult2 = " + JSON.stringify(data))
expect(ResultCode.FAIL).assertEqual(data.addCredresult);
publicFC.publicdelUser(UserIDM, token, function (data) {
let deluserresult = data.delUserresult
console.info("Security_IAM_Face_AddCred_DFX_0104 deluserresult =" + deluserresult)
publicFC.publicCloseSession(UserIDM, function (data) {
console.info("Security_IAM_Face_AddCred_DFX_0104 closesession = " + data)
publicFC.publicunRegisterInputer(PinAuth, function (data) {
console.info("Security_IAM_Face_AddCred_DFX_0104 unRegist = " + data)
done();
})
})
}, function (data) {
})
}, function (data) {
})
}, function (data) {
})
}, function (data) {
})
}, function (data) {
})
})
} catch (e) {
console.log("Security_IAM_Face_AddCred_DFX_0104 fail " + e);
expect(null).assertFail();
}
})
/*
* @tc.number : Security_IAM_Face_Delet_DFX_0104
* @tc.name : Delete face with no pin
......@@ -245,8 +192,8 @@ describe('userauthTest', function () {
publicFC.publicdelCred(UserIDM, "credentialId", "token", function (data) {
console.info("Security_IAM_Face_Delet_DFX_0104 info101 = " + JSON.stringify(data))
console.info("Security_IAM_Face_Delet_DFX_0104 delCredresult = " + data.delCredresult)
console.info("Security_IAM_Face_Delet_DFX_0104 ResultCode.FAIL = " + ResultCode.FAIL)
expect(ResultCode.Authfail).assertEqual(data.delCredresult);
console.info("Security_IAM_Face_Delet_DFX_0104 ResultCode.FAIL = " + ResultCode.GENERAL_ERROR)
expect(ResultCode.GENERAL_ERROR).assertEqual(data.delCredresult);
publicFC.publicCloseSession(UserIDM, function (data) {
console.info("Security_IAM_Face_Delet_DFX_0104 closesession = " + data)
publicFC.publicunRegisterInputer(PinAuth, function (data) {
......@@ -283,8 +230,8 @@ describe('userauthTest', function () {
let info102 = data
console.info("testFace Security_IAM_Face_Delet_DFX_0105 info102 = " + JSON.stringify(data))
console.info("testFace Security_IAM_Face_Delet_DFX_0105 delCredresult ="+ data.delCredresult);
console.info("testFace Face_Delet_DFX_0105 ResultCode.FAIL = " + ResultCode.Authfail);
expect(ResultCode.Authfail).assertEqual(info102.delCredresult);
console.info("testFace Face_Delet_DFX_0105 ResultCode.FAIL = " + ResultCode.GENERAL_ERROR);
expect(ResultCode.GENERAL_ERROR).assertEqual(info102.delCredresult);
publicFC.publicauth(UserAuth, challenge, AuthType.FACE, AuthTurstLevel.ATL1, function (data){
let info101 = data
console.info("testFace Security_IAM_Face_Delet_DFX_0105 info101 = " + JSON.stringify(data))
......@@ -406,62 +353,6 @@ describe('userauthTest', function () {
}
})
/*
* @tc.number : Security_IAM_Face_Auth_DFX_0104
* @tc.name : Auth face after delete pin
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 4
*/
it('Security_IAM_Face_Auth_DFX_0104', 4, async function (done) {
try {
publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
publicFC.publicOpenSession(UserIDM, function (data) {
let challenge = data
console.info("Security_IAM_Face_Auth_DFX_0104 challenge = " + challenge)
publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
publicFC.publicauth(UserAuth, challenge, AuthType.PIN, AuthTurstLevel.ATL1, function (data) {
let info101 = data
console.info("Security_IAM_Face_Auth_DFX_0104 info101 = " + JSON.stringify(data))
let token = info101.authextr.token
CredentialInfoface2d.token = token
console.info("Security_IAM_Face_Auth_DFX_0104 token = " + token)
publicFC.publicaddCredential(UserIDM, CredentialInfoface2d, function (data) {
let addfaceresult = data
console.info("Security_IAM_Face_Auth_DFX_0104 addfaceresult = " + JSON.stringify(data))
expect(ResultCode.SUCCESS).assertEqual(addfaceresult.addCredresult);
publicFC.publicdelUser(UserIDM, token, function (data) {
let deluserresult = data.delUserresult
console.info("Security_IAM_Face_Auth_DFX_0104 deluserresult = " + deluserresult)
publicFC.publicauth(UserAuth, challenge, AuthType.FACE, AuthTurstLevel.ATL1,
function (data) {
let info102 = data;
console.info("Security_IAM_Face_Auth_DFX_0104 info102 = " + JSON.stringify(data))
expect(ResultCode.FAIL).assertEqual(info102.authresult);
publicFC.publicCloseSession(UserIDM, function (data) {
console.info("Security_IAM_Face_Auth_DFX_0104 closesession = " + data)
publicFC.publicunRegisterInputer(PinAuth, function (data) {
console.info("Security_IAM_Face_Auth_DFX_0104 unRegist = " + data)
done();
})
})
}, function (data) {
})
}, function (data) {
})
}, function (data) {
})
}, function (data) {
})
}, function (data) {
})
})
} catch (e) {
console.log("Security_IAM_Face_Auth_DFX_0104 fail " + e);
expect(null).assertFail();
}
})
/*
* @tc.number : Security_IAM_Face_AddCred_DFX_0101
* @tc.name : Can't add face by old token
......@@ -558,9 +449,9 @@ describe('userauthTest', function () {
let wrongtoken = token + 'wrong';
publicFC.publicdelCred(UserIDM,credentialId,wrongtoken, function (data) {
console.info('testFace Face_Delet_DFX_0101 del=' + JSON.stringify(data));
console.info('testFace Face_Delet_DFX_0101 ResultCode.FAIL=' + ResultCode.FAIL);
console.info('testFace Face_Delet_DFX_0101 ResultCode.FAIL=' + ResultCode.GENERAL_ERROR);
delcredresult = data;
expect(ResultCode.Authfail).assertEqual(delcredresult.delCredresult);
expect(ResultCode.GENERAL_ERROR).assertEqual(delcredresult.delCredresult);
publicFC.publicdelUser(UserIDM,token, function (data) {
console.info('Face_Delet_DFX_0101 delUser= ' + JSON.stringify(data));
publicFC.publicCloseSession(UserIDM, function (data) {
......
......@@ -147,22 +147,16 @@ describe('userauthTest', function () {
publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, function (onresult) {
console.info('Face_AddCred_Func_0101 addCredential Result2=' + JSON.stringify(onresult));
addfaceresult = onresult;
expect(ResultCode.SUCCESS).assertEqual(addfaceresult.addCredresult);
expect(ResultCode.FAIL).assertEqual(addfaceresult.addCredresult);
publicFC.publicauth(UserAuth,challenge,AuthType.FACE,AuthTurstLevel.ATL1, function (data) {
console.info('testFace Face_AddCred_Func_0101 onResult = ' + JSON.stringify(data));
let faceauth101 = data;
expect(ResultCode.SUCCESS).assertEqual(faceauth101.authresult);
expect(ResultCode.FAIL).assertEqual(faceauth101.authresult);
publicFC.publicauthUser(
UserAuth,userID.User1,challenge,AuthType.FACE,AuthTurstLevel.ATL1,function (data) {
console.info('testFace Face_AddCred_Func_0101 onResult= ' + JSON.stringify(data));
faceauth101 = data;
expect(ResultCode.SUCCESS).assertEqual(faceauth101.authresult);
let credentialId = addfaceresult.credentialId;
let delcredresult ;
publicFC.publicdelCred(UserIDM,credentialId,token, function (data) {
console.info('testFace Face_AddCred_Func_0101 del=' + JSON.stringify(data));
delcredresult = data;
expect(ResultCode.SUCCESS).assertEqual(delcredresult.delCredresult);
expect(ResultCode.FAIL).assertEqual(faceauth101.authresult);
publicFC.publicdelUser(UserIDM,token, function (data) {
console.info('Face_AddCred_Func_0101 delUser= ' + JSON.stringify(data));
publicFC.publicCloseSession(UserIDM, function (data) {
......@@ -174,8 +168,6 @@ describe('userauthTest', function () {
})
}, function (data) {
})
}, function (onacquireinfo) {
})
}, function (onacquireinfo) {
})
}, function (onacquireinfo) {
......@@ -225,7 +217,7 @@ describe('userauthTest', function () {
await sleep(2500);
if(cancelresult == 1){
console.info('Face_AddCred_Func_0103 cancel1 authresult = ' + addfaceresult.addCredresult);
expect(ResultCode.SUCCESS).assertEqual(addfaceresult.addCredresult);
expect(ResultCode.FAIL).assertEqual(addfaceresult.addCredresult);
}else if(cancelresult == 0){
console.info('Face_AddCred_Func_0103 cancel0 authresult = ' + addfaceresult.addCredresult);
expect(ResultCode.CANCELED).assertEqual(addfaceresult.addCredresult);
......@@ -284,7 +276,7 @@ describe('userauthTest', function () {
publicFC.publicdelCred(UserIDM,credentialId,token1, function (data) {
console.info('testFace Face_AddCred_Func_0102 publicdelCred=' + JSON.stringify(data));
delcredresult = data;
expect(ResultCode.Authfail).assertEqual(delcredresult.delCredresult);
expect(ResultCode.GENERAL_ERROR).assertEqual(delcredresult.delCredresult);
publicFC.publicdelUser(UserIDM,token, function (data) {
console.info('testFace Face_AddCred_Func_0102 delUser= ' + JSON.stringify(data));
publicFC.publicCloseSession(UserIDM, function (data) {
......
......@@ -390,7 +390,7 @@ function delcrederror(inputer,done){
publicFC.publicdelCred(UserIDM, inputer, inputer, function (data) {
console.info('testFace delcrederror del=' + JSON.stringify(data));
delcredresult = data;
expect(ResultCode.Authfail).assertEqual(delcredresult.delCredresult);
expect(ResultCode.GENERAL_ERROR).assertEqual(delcredresult.delCredresult);
publicFC.publicdelUser(UserIDM,token, function (data) {
console.info('delcrederror delUser= ' + JSON.stringify(data));
publicFC.publicCloseSession(UserIDM, function (data) {
......
......@@ -210,82 +210,6 @@ describe('userauthTest', function () {
}
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0103
* @tc.name : Kit interface auth and cancel auth
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it('Security_IAM_PIN_Kit_Func_0103', 0, async function (done) {
try {
publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata)
let challenge ;
publicFC.publicOpenSession(UserIDM, function (data) {
console.info('AuthTest_0101 openSession challenge = ' + data);
challenge = data;
publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (onresult) {
console.info('AuthTest_0101 addCredential Result1 = ' + JSON.stringify(onresult));
let info101;
publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
console.info('AuthTest_0101 auth onResult = ' + JSON.stringify(data));
info101 = data;
let token = info101.authextr.token;
CredentialInfoface2d.token = token;
let addfaceresult;
publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, function (onresult) {
console.info('AuthTest_0101 addCredential Result2=' + JSON.stringify(onresult));
addfaceresult = onresult;
console.info('AuthTest_0101 publicaddCredential = ' + addfaceresult.addCredresult);
expect(ResultCode.SUCCESS).assertEqual(addfaceresult.addCredresult);
publicFC.publicauth(UserAuthKit,challenge,AuthType.FACE,10000, async function (data) {
let faceauth101 = data;
console.info('AuthTest_0101 publicauth = ' + faceauth101.authresult);
expect(ResultCode.SUCCESS).assertEqual(faceauth101.authresult);
let authresult;
let contextID = await publicFC.publicauth(UserAuthKit,challenge,AuthType.FACE,10000,
function (data) {
console.info('AuthTest_0101 addCredential Result2=' + JSON.stringify(data.authresult));
authresult = data.authresult;
}, function (onacquireinfo) {
})
let cancelresult = publicFC.publicgecancelAuth(UserAuthKit,contextID);
await sleep(2000);
if(cancelresult == 1){
console.info('AuthTest_0101 cancel = 1 authresult = ' + authresult);
expect(ResultCode.SUCCESS).assertEqual(authresult);
}else if(cancelresult == 0){
console.info('AuthTest_0101 cancel = 0 authresult = ' + authresult);
console.info('AuthTest_0101 cancel = 0 ResultCode.FAIL = ' + ResultCode.FAIL);
expect(ResultCode.CANCELED).assertEqual(authresult);
}
console.info('testFace AuthTest_0101 onResult = ' + JSON.stringify(data));
await publicFC.publicdelUser(UserIDM,token, function (data) {
console.info('AuthTest_0101 delUser = ' + JSON.stringify(data));
publicFC.publicCloseSession(UserIDM, function (data) {
console.info('AuthTest_0101 closeSession');
publicFC.publicunRegisterInputer(PinAuth, function (data) {
console.info('AuthTest_0101 unRegister');
done();
})
})
}, function (onacquireinfo) {
})
}, function (onacquireinfo) {
})
}, function (onacquireinfo) {
})
}, function (data) {
})
}, function (onacquireinfo) {
})
})
} catch (e) {
console.log("AuthTest_0101 fail " + e);
expect(null).assertFail();
}
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0104
* @tc.name : Kit interface enum AuthTrustLevel
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册