提交 6f8da1a1 编写于 作者: 1 15829070344 提交者: 何海涛

fixed 5a4a88c2 from https://gitee.com/murphy1984/acts/pulls/6198

【账号】新增接口属性补缺
Signed-off-by: N15829070344 <hehaitao5@huawei.com>
Change-Id: I4df9dcd7cc41962935369a60b325c235a8c2f6ee
上级 543e7d8b
...@@ -39,19 +39,19 @@ export default function ActsDAGetSetTest() { ...@@ -39,19 +39,19 @@ export default function ActsDAGetSetTest() {
* @tc.name Test query the distribruted id by callback. * @tc.name Test query the distribruted id by callback.
* @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality by callback.
*/ */
it('ActsDistributedAccountDeviceId_0100', 0, async function(done){ it('ActsDADeviceId_0100', 0, async function(done){
console.log("====>test query distribtued id start"); console.log("====>ActsDADeviceId_0100 test query distribtued id start");
const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; //'12345'sha256的值 const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; //'12345'sha256的值
const accountAbility = account.getDistributedAccountAbility(); const accountAbility = account.getDistributedAccountAbility();
accountAbility.setOsAccountDistributedInfo(LOGININFO, (err)=>{ accountAbility.setOsAccountDistributedInfo(LOGININFO, (err)=>{
console.log("====>set distributedInfo err:" + JSON.stringify(err)); console.log("====>ActsDADeviceId_0100 set distributedInfo err:" + JSON.stringify(err));
accountAbility.getOsAccountDistributedInfo((err, distributedInfo)=>{ accountAbility.getOsAccountDistributedInfo((err, distributedInfo)=>{
console.log("====>get distributedInfo err:" + JSON.stringify(err)); console.log("====>ActsDADeviceId_0100 get distributedInfo err:" + JSON.stringify(err));
console.log("====>get distributedInfo:" + JSON.stringify(distributedInfo)); console.log("====>ActsDADeviceId_0100 get distributedInfo:" + JSON.stringify(distributedInfo));
expect(distributedInfo.name).assertEqual('ZhangSan'); expect(distributedInfo.name).assertEqual('ZhangSan');
expect(distributedInfo.id).assertEqual(distributedId); expect(distributedInfo.id).assertEqual(distributedId);
accountAbility.setOsAccountDistributedInfo(LOGOUTINFO, (err)=>{ accountAbility.setOsAccountDistributedInfo(LOGOUTINFO, (err)=>{
console.debug('====>ActsDistributedAccountDeviceId_0100 logout_result:'+ JSON.stringify(err)) console.debug('====>ActsDADeviceId_0100 logout_result:'+ JSON.stringify(err))
expect(err).assertEqual(null) expect(err).assertEqual(null)
console.log("====>test query distribtued id end"); console.log("====>test query distribtued id end");
done(); done();
...@@ -65,10 +65,10 @@ export default function ActsDAGetSetTest() { ...@@ -65,10 +65,10 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.getDistributedAccountAbility. * @tc.name Test distributedAccount.getDistributedAccountAbility.
* @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality. * @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality.
*/ */
it('account_getDistributedAccountAbility_test', 0, async function (done) { it('getDistributedAccountAbility_test', 0, async function (done) {
var ret = false; var ret = false;
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
console.debug("====>account_getDistributedAccountAbility_test result:" + JSON.stringify(accountAbility)) console.debug("====>getDistributedAccountAbility_test result:" + JSON.stringify(accountAbility))
if(accountAbility !== null){ if(accountAbility !== null){
ret = true; ret = true;
} }
...@@ -81,10 +81,10 @@ export default function ActsDAGetSetTest() { ...@@ -81,10 +81,10 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.getOsAccountDistributedInfo. * @tc.name Test distributedAccount.getOsAccountDistributedInfo.
* @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality. * @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality.
*/ */
it('account_getOsAccountDistributedInfo_test001', 0, async function (done) { it('getOsAccountDistributedInfo_test001', 0, async function (done) {
let accountAbility = account.getDistributedAccountAbility() let accountAbility = account.getDistributedAccountAbility()
accountAbility.getOsAccountDistributedInfo().then(function (data) { accountAbility.getOsAccountDistributedInfo().then(function (data) {
console.debug('====>account_getOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) console.debug('====>getOsAccountDistributedInfo_test001 data:' + JSON.stringify(data))
expect(data.name).assertEqual('ohosAnonymousName') expect(data.name).assertEqual('ohosAnonymousName')
expect(data.id).assertEqual('ohosAnonymousUid') expect(data.id).assertEqual('ohosAnonymousUid')
done(); done();
...@@ -96,11 +96,11 @@ export default function ActsDAGetSetTest() { ...@@ -96,11 +96,11 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.getOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.getOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_getOsAccountDistributedInfo_test002', 0, async function (done) { it('getOsAccountDistributedInfo_test002', 0, async function (done) {
let accountAbility = account.getDistributedAccountAbility() let accountAbility = account.getDistributedAccountAbility()
accountAbility.getOsAccountDistributedInfo(function (err, data) { accountAbility.getOsAccountDistributedInfo(function (err, data) {
console.debug('====>account_getOsAccountDistributedInfo_test002 err:' + JSON.stringify(err)) console.debug('====>getOsAccountDistributedInfo_test002 err:' + JSON.stringify(err))
console.debug('====>account_getOsAccountDistributedInfo_test002 data:' + JSON.stringify(data)) console.debug('====>getOsAccountDistributedInfo_test002 data:' + JSON.stringify(data))
expect(err).assertEqual(null) expect(err).assertEqual(null)
expect(data.name).assertEqual('ohosAnonymousName') expect(data.name).assertEqual('ohosAnonymousName')
expect(data.id).assertEqual('ohosAnonymousUid') expect(data.id).assertEqual('ohosAnonymousUid')
...@@ -113,7 +113,7 @@ export default function ActsDAGetSetTest() { ...@@ -113,7 +113,7 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.setOsAccountDistributedInfo. * @tc.name Test distributedAccount.setOsAccountDistributedInfo.
* @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality. * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality.
*/ */
it('account_setOsAccountDistributedInfo_test001', 0, async function (done) { it('setOsAccountDistributedInfo_test001', 0, async function (done) {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -123,7 +123,7 @@ export default function ActsDAGetSetTest() { ...@@ -123,7 +123,7 @@ export default function ActsDAGetSetTest() {
}; };
accountAbility.setOsAccountDistributedInfo(obj).then(function () { accountAbility.setOsAccountDistributedInfo(obj).then(function () {
accountAbility.getOsAccountDistributedInfo(function (data) { accountAbility.getOsAccountDistributedInfo(function (data) {
console.debug('====>account_setOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) console.debug('====>setOsAccountDistributedInfo_test001 data:' + JSON.stringify(data))
expect(data.name).assertEqual('ZhangSan') expect(data.name).assertEqual('ZhangSan')
expect(data.id).assertEqual('12345') expect(data.id).assertEqual('12345')
let obj = { let obj = {
...@@ -137,7 +137,7 @@ export default function ActsDAGetSetTest() { ...@@ -137,7 +137,7 @@ export default function ActsDAGetSetTest() {
}); });
}); });
accountAbility.getOsAccountDistributedInfo(function (data) { accountAbility.getOsAccountDistributedInfo(function (data) {
console.debug('====>account_setOsAccountDistributedInfo_test001 get data:' + JSON.stringify(data)) console.debug('====>setOsAccountDistributedInfo_test001 get data:' + JSON.stringify(data))
expect(data).assertEqual(null) expect(data).assertEqual(null)
done(); done();
}) })
...@@ -148,7 +148,7 @@ export default function ActsDAGetSetTest() { ...@@ -148,7 +148,7 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_setOsAccountDistributedInfo_test002', 0, async function (done) { it('setOsAccountDistributedInfo_test002', 0, async function (done) {
var accountAbility = account.getDistributedAccountAbility() var accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -158,7 +158,7 @@ export default function ActsDAGetSetTest() { ...@@ -158,7 +158,7 @@ export default function ActsDAGetSetTest() {
}; };
accountAbility.setOsAccountDistributedInfo(obj, function () { accountAbility.setOsAccountDistributedInfo(obj, function () {
accountAbility.getOsAccountDistributedInfo(function (err, data) { accountAbility.getOsAccountDistributedInfo(function (err, data) {
console.debug("====>account_setOsAccountDistributedInfo_test002 data:" + JSON.stringify(data)) console.debug("====>setOsAccountDistributedInfo_test002 data:" + JSON.stringify(data))
expect(data.name).assertEqual('ZhangSan') expect(data.name).assertEqual('ZhangSan')
expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
let obj = { let obj = {
...@@ -179,7 +179,7 @@ export default function ActsDAGetSetTest() { ...@@ -179,7 +179,7 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_setOsAccountDistributedInfo_test003', 0, function () { it('setOsAccountDistributedInfo_test003', 0, function () {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -188,9 +188,9 @@ export default function ActsDAGetSetTest() { ...@@ -188,9 +188,9 @@ export default function ActsDAGetSetTest() {
scalableData:{} scalableData:{}
}; };
accountAbility.setOsAccountDistributedInfo(obj, function (result) { accountAbility.setOsAccountDistributedInfo(obj, function (result) {
console.debug("====>account_setOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result)) console.debug("====>setOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result))
accountAbility.getOsAccountDistributedInfo(obj).then(function (data) { accountAbility.getOsAccountDistributedInfo(obj).then(function (data) {
console.debug("====>account_setOsAccountDistributedInfo_test003 data:" + JSON.stringify(data)) console.debug("====>setOsAccountDistributedInfo_test003 data:" + JSON.stringify(data))
expect(data.name).assertNull() expect(data.name).assertNull()
done(); done();
}) })
...@@ -202,7 +202,7 @@ export default function ActsDAGetSetTest() { ...@@ -202,7 +202,7 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_setOsAccountDistributedInfo_test004', 0, function () { it('setOsAccountDistributedInfo_test004', 0, function () {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -211,10 +211,10 @@ export default function ActsDAGetSetTest() { ...@@ -211,10 +211,10 @@ export default function ActsDAGetSetTest() {
scalableData:{} scalableData:{}
}; };
accountAbility.setOsAccountDistributedInfo(obj, function (err) { accountAbility.setOsAccountDistributedInfo(obj, function (err) {
console.debug("====>account_setOsAccountDistributedInfo_test004 update_err:" + JSON.stringify(err)) console.debug("====>setOsAccountDistributedInfo_test004 update_err:" + JSON.stringify(err))
accountAbility.getOsAccountDistributedInfo(function (err, data) { accountAbility.getOsAccountDistributedInfo(function (err, data) {
console.debug("====>account_setOsAccountDistributedInfo_test004 query_err:" + JSON.stringify(err)) console.debug("====>setOsAccountDistributedInfo_test004 query_err:" + JSON.stringify(err))
console.debug("====>account_setOsAccountDistributedInfo_test004 query_data:" + JSON.stringify(data)) console.debug("====>setOsAccountDistributedInfo_test004 query_data:" + JSON.stringify(data))
expect(data.name).assertEqual('ZhangSan') expect(data.name).assertEqual('ZhangSan')
expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
let obj = { let obj = {
...@@ -235,7 +235,7 @@ export default function ActsDAGetSetTest() { ...@@ -235,7 +235,7 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_setOsAccountDistributedInfo_test005', 0, function () { it('setOsAccountDistributedInfo_test005', 0, function () {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -244,10 +244,10 @@ export default function ActsDAGetSetTest() { ...@@ -244,10 +244,10 @@ export default function ActsDAGetSetTest() {
scalableData:{age:'12'} scalableData:{age:'12'}
}; };
accountAbility.setOsAccountDistributedInfo(obj, function (err) { accountAbility.setOsAccountDistributedInfo(obj, function (err) {
console.debug("====>account_setOsAccountDistributedInfo_test005 update_err:" + JSON.stringify(err)) console.debug("====>setOsAccountDistributedInfo_test005 update_err:" + JSON.stringify(err))
accountAbility.getOsAccountDistributedInfo(function (err, data) { accountAbility.getOsAccountDistributedInfo(function (err, data) {
console.debug("====>account_setOsAccountDistributedInfo_test005 query_err:" + JSON.stringify(err)) console.debug("====>setOsAccountDistributedInfo_test005 query_err:" + JSON.stringify(err))
console.debug("====>account_setOsAccountDistributedInfo_test005 query_data:" + JSON.stringify(data)) console.debug("====>setOsAccountDistributedInfo_test005 query_data:" + JSON.stringify(data))
expect(data.scalableData.age).assertEqual('12') expect(data.scalableData.age).assertEqual('12')
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -267,7 +267,7 @@ export default function ActsDAGetSetTest() { ...@@ -267,7 +267,7 @@ export default function ActsDAGetSetTest() {
* @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_setOsAccountDistributedInfo_test006', 0, function () { it('setOsAccountDistributedInfo_test006', 0, function () {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -276,10 +276,10 @@ export default function ActsDAGetSetTest() { ...@@ -276,10 +276,10 @@ export default function ActsDAGetSetTest() {
scalableData:{age:'12'} scalableData:{age:'12'}
}; };
accountAbility.setOsAccountDistributedInfo(obj, function (err) { accountAbility.setOsAccountDistributedInfo(obj, function (err) {
console.debug("====>account_setOsAccountDistributedInfo_test006 update_err:" + JSON.stringify(err)) console.debug("====>setOsAccountDistributedInfo_test006 update_err:" + JSON.stringify(err))
accountAbility.getOsAccountDistributedInfo(function (err, data) { accountAbility.getOsAccountDistributedInfo(function (err, data) {
console.debug("====>account_setOsAccountDistributedInfo_test006 query_err:" + JSON.stringify(err)) console.debug("====>setOsAccountDistributedInfo_test006 query_err:" + JSON.stringify(err))
console.debug("====>account_setOsAccountDistributedInfo_test006 query_data:" + JSON.stringify(data)) console.debug("====>setOsAccountDistributedInfo_test006 query_data:" + JSON.stringify(data))
expect(data.scalableData.age).assertEqual('12') expect(data.scalableData.age).assertEqual('12')
let obj = { let obj = {
id: '12345', id: '12345',
......
...@@ -147,7 +147,7 @@ export default function AccountTest() { ...@@ -147,7 +147,7 @@ export default function AccountTest() {
}) })
/** /**
* @tc.number SUB_Account_distributedAccount_JS_API_0500 * @tc.number SUB_Account_distributedAccount_JS_API_0200
* @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
*/ */
...@@ -182,7 +182,7 @@ export default function AccountTest() { ...@@ -182,7 +182,7 @@ export default function AccountTest() {
* @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_updateOsAccountDistributedInfo_test003', 0, function () { it('account_updateOsAccountDistributedInfo_test003', 0, async function (done) {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let data = null let data = null
let obj = { let obj = {
...@@ -195,7 +195,7 @@ export default function AccountTest() { ...@@ -195,7 +195,7 @@ export default function AccountTest() {
console.debug("====>account_updateOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result)) console.debug("====>account_updateOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result))
accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) { accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) {
console.debug("====>account_updateOsAccountDistributedInfo_test003 data:" + JSON.stringify(data)) console.debug("====>account_updateOsAccountDistributedInfo_test003 data:" + JSON.stringify(data))
expect(data.name).assertNull() expect(data.name).assertEqual("ohosAnonymousName")
done(); done();
}) })
}); });
...@@ -206,7 +206,7 @@ export default function AccountTest() { ...@@ -206,7 +206,7 @@ export default function AccountTest() {
* @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback. * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
* @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback. * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
*/ */
it('account_updateOsAccountDistributedInfo_test004', 0, function () { it('account_updateOsAccountDistributedInfo_test004', 0, async function (done) {
const accountAbility = account.getDistributedAccountAbility() const accountAbility = account.getDistributedAccountAbility()
let obj = { let obj = {
id: '12345', id: '12345',
...@@ -227,7 +227,7 @@ export default function AccountTest() { ...@@ -227,7 +227,7 @@ export default function AccountTest() {
event: 'Ohos.account.event.LOGOFF' event: 'Ohos.account.event.LOGOFF'
}; };
accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) { accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
expect(err).assert(undefined) expect(err).assertEqual(undefined)
done(); done();
}); });
}); });
......
...@@ -427,7 +427,7 @@ export default function ActsAccountAuthToken() { ...@@ -427,7 +427,7 @@ export default function ActsAccountAuthToken() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.deleteAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{ appAccountManager.deleteAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{
console.debug("====>ActsAccountAuthToken_7800 deleteAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountAuthToken_7800 deleteAuthToken err:" + JSON.stringify(err));
expect(err.code == 12400004).assertEqual(true); expect(err).assertEqual(null);
appAccountManager.getAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{ appAccountManager.getAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{
console.debug("====>ActsAccountAuthToken_7800 getAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountAuthToken_7800 getAuthToken err:" + JSON.stringify(err));
console.debug("====>ActsAccountAuthToken_7800 getAuthToken data:" + data); console.debug("====>ActsAccountAuthToken_7800 getAuthToken data:" + data);
...@@ -453,19 +453,14 @@ export default function ActsAccountAuthToken() { ...@@ -453,19 +453,14 @@ export default function ActsAccountAuthToken() {
console.debug("====>ActsAccountAuthToken_7900 setAuthToken start===="); console.debug("====>ActsAccountAuthToken_7900 setAuthToken start====");
await appAccountManager.setAuthToken("account_promise_empty_authType","authType","promise_empty_authType_token"); await appAccountManager.setAuthToken("account_promise_empty_authType","authType","promise_empty_authType_token");
console.debug("====>ActsAccountAuthToken_7900 deleteAuthToken start===="); console.debug("====>ActsAccountAuthToken_7900 deleteAuthToken start====");
try{ await appAccountManager.deleteAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token");
await appAccountManager.deleteAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token"); console.debug("====>ActsAccountAuthToken_7900 getAuthToken start====");
}catch(err){ var data = await appAccountManager.getAuthToken("account_promise_empty_authType",OWNERSELF,"authType");
console.debug('====>ActsAccountAuthToken_7900 deleteAuthToken err:' + JSON.stringify(err)) expect(data).assertEqual("promise_empty_authType_token");
expect(err.code == 12400004).assertEqual(true); console.debug("====>ActsAccountAuthToken_7900 removeAccount start====");
console.debug("====>ActsAccountAuthToken_7900 getAuthToken start===="); await appAccountManager.removeAccount("account_promise_empty_authType");
var data = await appAccountManager.getAuthToken("account_promise_empty_authType",OWNERSELF,"authType"); console.debug("====>ActsAccountAuthToken_7900 end====");
expect(data).assertEqual("promise_empty_authType_token"); done();
console.debug("====>ActsAccountAuthToken_7900 removeAccount start====");
await appAccountManager.removeAccount("account_promise_empty_authType");
console.debug("====>ActsAccountAuthToken_7900 end====");
done();
}
}); });
...@@ -489,7 +484,7 @@ export default function ActsAccountAuthToken() { ...@@ -489,7 +484,7 @@ export default function ActsAccountAuthToken() {
expect(data).assertEqual("callback_setSameAuthType_token2"); expect(data).assertEqual("callback_setSameAuthType_token2");
appAccountManager.deleteAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{ appAccountManager.deleteAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{
console.debug("====>ActsAccountAuthToken_8000 deleteAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountAuthToken_8000 deleteAuthToken err:" + JSON.stringify(err));
expect(err.code == 12400004).assertEqual(true); expect(err).assertEqual(null);
appAccountManager.removeAccount("account_callback_setSameAuthType",(err)=>{ appAccountManager.removeAccount("account_callback_setSameAuthType",(err)=>{
console.debug("====>ActsAccountAuthToken_8000 removeAccount err:" + JSON.stringify(err)); console.debug("====>ActsAccountAuthToken_8000 removeAccount err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -1338,15 +1333,14 @@ export default function ActsAccountAuthToken() { ...@@ -1338,15 +1333,14 @@ export default function ActsAccountAuthToken() {
try{ try{
console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 start===="); console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 start====");
await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token");
expect().assertFail()
}catch(err){ }catch(err){
expect(err.code == 12400004).assertEqual(true);
console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err));
expect(err.code == 12400004).assertEqual(true);
} }
try{ try{
console.debug("====>getAuthToken ActsAccountAuthToken_2200 start===="); console.debug("====>getAuthToken ActsAccountAuthToken_2200 start====");
var data = await appAccountManager.getAuthToken("account_promise_repeatDelete",OWNERSELF,"authType"); var data = await appAccountManager.getAuthToken("account_promise_repeatDelete",OWNERSELF,"authType");
expect().assertFail() done();
} }
catch(err){ catch(err){
console.debug("====>getAuthToken ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); console.debug("====>getAuthToken ActsAccountAuthToken_2200 err:" + JSON.stringify(err));
...@@ -2427,7 +2421,7 @@ export default function ActsAccountAuthToken() { ...@@ -2427,7 +2421,7 @@ export default function ActsAccountAuthToken() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.deleteAuthToken("account_callback_delete_space", OWNERSELF,"authType", "",(err)=>{ appAccountManager.deleteAuthToken("account_callback_delete_space", OWNERSELF,"authType", "",(err)=>{
console.debug("====>ActsAccountAuthToken_6900 deleteAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountAuthToken_6900 deleteAuthToken err:" + JSON.stringify(err));
expect(err.code == 12400004).assertEqual(true) expect(err).assertEqual(null)
appAccountManager.getAuthToken("account_callback_delete_space", OWNERSELF, "authType",(err,data)=>{ appAccountManager.getAuthToken("account_callback_delete_space", OWNERSELF, "authType",(err,data)=>{
console.debug("====>ActsAccountAuthToken_6900 getAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountAuthToken_6900 getAuthToken err:" + JSON.stringify(err));
console.debug("====>ActsAccountAuthToken_6900 getAuthToken data:" + data); console.debug("====>ActsAccountAuthToken_6900 getAuthToken data:" + data);
...@@ -2453,22 +2447,14 @@ export default function ActsAccountAuthToken() { ...@@ -2453,22 +2447,14 @@ export default function ActsAccountAuthToken() {
console.debug("====>ActsAccountAuthToken_7000 setAuthToken start===="); console.debug("====>ActsAccountAuthToken_7000 setAuthToken start====");
await appAccountManager.setAuthToken("account_promise_delete_space","authType","account_promise_delete_space_token"); await appAccountManager.setAuthToken("account_promise_delete_space","authType","account_promise_delete_space_token");
console.debug("====>ActsAccountAuthToken_7000 deleteAuthToken start===="); console.debug("====>ActsAccountAuthToken_7000 deleteAuthToken start====");
try{ await appAccountManager.deleteAuthToken("account_promise_delete_space",OWNERSELF,"authType","");
await appAccountManager.deleteAuthToken("account_promise_delete_space",OWNERSELF,"authType",""); console.debug("====>ActsAccountAuthToken_7000 getAuthToken start====");
expect().assertFail(); var data = await appAccountManager.getAuthToken("account_promise_delete_space",OWNERSELF,"authType");
done(); expect(data).assertEqual("account_promise_delete_space_token");
}catch(err){ console.debug("====>ActsAccountAuthToken_7000 removeAccount start====");
expect(err.code == 12400004).assertEqual(true) await appAccountManager.removeAccount("account_promise_delete_space");
console.debug("====>ActsAccountAuthToken_7000 getAuthToken start===="); console.debug("====>ActsAccountAuthToken_7000 end====");
var data = await appAccountManager.getAuthToken("account_promise_delete_space",OWNERSELF,"authType"); done();
expect(data).assertEqual("account_promise_delete_space_token");
console.debug("====>ActsAccountAuthToken_7000 removeAccount start====");
await appAccountManager.removeAccount("account_promise_delete_space");
console.debug("====>ActsAccountAuthToken_7000 end====");
done();
}
}); });
it('ActsAccountAuthToken_9200', 0, async function (done) { it('ActsAccountAuthToken_9200', 0, async function (done) {
......
...@@ -33,7 +33,21 @@ export default function ActsAccountAppAccess() { ...@@ -33,7 +33,21 @@ export default function ActsAccountAppAccess() {
console.info(`sleep #{time} over ...`) console.info(`sleep #{time} over ...`)
}) })
} }
beforeAll(async function (done) { beforeAll(async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1500)
done(); done();
}); });
/* /*
...@@ -575,25 +589,11 @@ export default function ActsAccountAppAccess() { ...@@ -575,25 +589,11 @@ export default function ActsAccountAppAccess() {
/* /*
* @tc.number : ActsAccountSelectAccountByOptions_0100 * @tc.number : ActsAccountSelectAccountByOptions_0100
* @tc.name : Verify Credential callback form * @tc.name : selectAccountsByOptions callback form
* @tc.desc : * @tc.desc :
*/ */
it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) { it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1000)
console.debug("====>ActsAccountSelectAccountByOptions_0100 start===="); console.debug("====>ActsAccountSelectAccountByOptions_0100 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
var select_options = {allowedAccounts:[{"name":name,"owner":owner}]} var select_options = {allowedAccounts:[{"name":name,"owner":owner}]}
...@@ -624,25 +624,11 @@ export default function ActsAccountAppAccess() { ...@@ -624,25 +624,11 @@ export default function ActsAccountAppAccess() {
/* /*
* @tc.number : ActsAccountSelectAccountByOptions_0100 * @tc.number : ActsAccountSelectAccountByOptions_0100
* @tc.name : Verify Credential callback form * @tc.name : selectAccountsByOptions callback form
* @tc.desc : * @tc.desc :
*/ */
it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) { it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1000)
console.debug("====>ActsAccountSelectAccountByOptions_0200 start===="); console.debug("====>ActsAccountSelectAccountByOptions_0200 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
var select_options = {allowedOwners: [owner]} var select_options = {allowedOwners: [owner]}
...@@ -674,25 +660,11 @@ export default function ActsAccountAppAccess() { ...@@ -674,25 +660,11 @@ export default function ActsAccountAppAccess() {
/* /*
* @tc.number : ActsAccountSelectAccountByOptions_0100 * @tc.number : ActsAccountSelectAccountByOptions_0100
* @tc.name : Verify Credential callback form * @tc.name : selectAccountsByOptions callback form
* @tc.desc : * @tc.desc :
*/ */
it('ActsAccountSelectAccountByOptions_0300', 0, async function (done) { it('ActsAccountSelectAccountByOptions_0300', 0, async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1500)
console.debug("====>ActsAccountSelectAccountByOptions_0300 start===="); console.debug("====>ActsAccountSelectAccountByOptions_0300 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
var options = {requiredLabels: ["male", "30-40"]} var options = {requiredLabels: ["male", "30-40"]}
...@@ -721,5 +693,57 @@ export default function ActsAccountAppAccess() { ...@@ -721,5 +693,57 @@ export default function ActsAccountAppAccess() {
}); });
}); });
/*
* @tc.number : ActsAccountCreateAccountImplicitly_0100
* @tc.name : createAccountImplicitly callback form, options
* @tc.desc :
*/
it('ActsAccountCreateAccountImplicitly_0100', 0, async function (done) {
console.debug("====>ActsAccountCreateAccountImplicitly_0100 start====");
var appAccountManager = account.createAppAccountManager();
var options = {authType: "PIN"}
console.debug("====>start finish====");
appAccountManager.createAccountImplicitly("com.example.accountauthenticator", options, {
onResult: async (resultCode, resultData)=>{
console.debug("====>ActsAccountCreateAccountImplicitly_0100 resultcode:" + JSON.stringify(resultCode));
expect(resultCode).assertEqual(0)
console.debug("====>ActsAccountCreateAccountImplicitly_0100 resultData:" + JSON.stringify(resultData));
expect(resultData.account.name).assertEqual("createNewAccountName")
expect(resultData.account.owner).assertEqual("com.example.accountauthenticator")
done();
},
onRequestRedirected:null,
onRequestContinued: function(){
console.debug("====>ActsAccountCreateAccountImplicitly_0100 onRequestContinued")
}
});
});
/*
* @tc.number : ActsAccountCreateAccountImplicitly_0200
* @tc.name : createAccountImplicitly callback form, options
* @tc.desc :
*/
it('ActsAccountCreateAccountImplicitly_0200', 0, async function (done) {
console.debug("====>ActsAccountCreateAccountImplicitly_0100 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>start finish====");
appAccountManager.createAccountImplicitly("com.example.accountauthenticator", {
onResult: async (resultCode, resultData)=>{
console.debug("====>ActsAccountCreateAccountImplicitly_0200 resultcode:" + JSON.stringify(resultCode));
expect(resultCode).assertEqual(0)
console.debug("====>ActsAccountCreateAccountImplicitly_0200 resultData:" + JSON.stringify(resultData));
expect(resultData.account.name).assertEqual("createNewAccountName")
expect(resultData.account.owner).assertEqual("com.example.accountauthenticator")
done();
},
onRequestRedirected:null,
onRequestContinued: function(){
console.debug("====>ActsAccountCreateAccountImplicitly_0200 onRequestContinued")
}
});
});
}) })
} }
\ No newline at end of file
...@@ -314,137 +314,6 @@ export default function ActsAccountOnOff() { ...@@ -314,137 +314,6 @@ export default function ActsAccountOnOff() {
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 1000);
}); });
/*
* @tc.number : ActsAccountOnOff_0700
* @tc.name : Subscribe/unsubscribe to the change event of application
* @tc.desc : Received the account information change to the authorized account of the subscription to cancel
* the only authorized account
*/
it('ActsAccountOnOff_0700', 0, async function (done) {
testInit();
console.debug("====>ActsAccountOnOff_0700 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add account ActsAccountOnOff_0700 start");
await appAccountManager.createAccount("onoff_disable");
console.debug("====>enableAppAccess ActsAccountOnOff_0700 start");
await appAccountManager.setAppAccess("onoff_disable", "com.example.actsaccountsceneonoff", true);
function unSubscriberCallback(err){
console.debug("====>unsubscribe 0700 err:" + JSON.stringify(err));
}
function removeAccountCallback(err){
console.debug("====>delete account 0700 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
done();
}
function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0700 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_set_disable");
expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback);
appAccountManager.removeAccount("onoff_disable", removeAccountCallback);
}
function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err));
setTimeout(async function (){
console.debug("====>disableAppAccess start====");
try{
await appAccountManager.setAccess("onoff_disable", "com.example.actsaccountsceneonoff", false);
}
catch(err){
console.error("====>disableAppAccess fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}
console.debug("====>disableAppAccess finish====");
}, 500)
}
var commonEventSubscribeInfo = {
events: ["account_on_set_disable"]
}
var subscriber
commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){
subscriber = data;
commonevent.subscribe(subscriber, subscriberCallback);
console.debug("====>subscribe ActsAccountOnOff_0700 finish====")
});
var commonEventPublishData = {
code: 13
}
setTimeout(function (){
console.debug("====>publish event account_on_change 0700====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000);
});
/*
* @tc.number : ActsAccountOnOff_0900
* @tc.name : Subscribe/unsubscribe to the change event of application
* @tc.desc : Receiving account information after adding two accounts to the app, subscribing to itself,
* and changing one of the associatal data
*/
it('ActsAccountOnOff_0900', 0, async function (done) {
console.debug("====>ActsAccountOnOff_0900 start====");
let dataMap = new Map();
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
console.debug("====>add first account ActsAccountOnOff_0900 start");
await appAccountManager.createAccount("onoff_self_first");
console.debug("====>add second account ActsAccountOnOff_0900 start");
await appAccountManager.createAccount("onoff_self_second");
console.debug("====>on ActsAccountOnOff_0900 start");
function changeOnCallback(data){
console.debug("====>receive change 0900 data:" + JSON.stringify(data));
console.debug("====>data.length:" + data.length);
for (let i = 0, len = data.length; i < len; i++) {
dataMap.set(data[i].name, data[i].owner)
}
expect(dataMap.has("onoff_self_first")).assertTrue();
if (dataMap.has("onoff_self_first")) {
let data = dataMap.get("onoff_self_first");
console.debug("====>the account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountoperatetest");
}
expect(dataMap.has("onoff_self_second")).assertTrue();
if (dataMap.has("onoff_self_second")) {
let data = dataMap.get("onoff_self_second");
console.debug("====>the account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountoperatetest");
}
appAccountManager.off('accountChange', function (){
console.debug("====>off ActsAccountOnOff_0900 finish====");
appAccountManager.removeAccount("onoff_self_first", (err)=>{
console.debug("====>delete first account 0900 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
appAccountManager.removeAccount("onoff_self_second", (err)=>{
console.debug("====>delete second account 0900 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsAccountOnOff_0900 end====");
done();
});
});
});
}
try{
appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnCallback);
}
catch(err){
console.error("====>on ActsAccountOnOff_0900 err:" + JSON.stringify(err));
expect().assertFail();
done();
}
console.debug("====>setCustomData start====");
try{
await appAccountManager.setCustomData("onoff_self_second", "change_key", "change_value");
}
catch(err){
console.error("====>setCustomData fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}
});
}) })
} }
\ No newline at end of file
...@@ -32,7 +32,21 @@ export default function ActsAccountAppAccess() { ...@@ -32,7 +32,21 @@ export default function ActsAccountAppAccess() {
console.info(`sleep #{time} over ...`) console.info(`sleep #{time} over ...`)
}) })
} }
beforeAll(async function (done) { beforeAll(async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1000)
done(); done();
}); });
beforeEach(async function (done) { beforeEach(async function (done) {
...@@ -41,8 +55,8 @@ export default function ActsAccountAppAccess() { ...@@ -41,8 +55,8 @@ export default function ActsAccountAppAccess() {
var accounts = await appAccountManager.getAllAccountByOwner(owner) var accounts = await appAccountManager.getAllAccountByOwner(owner)
for (i=0;i<accounts.length;i++){ for (i=0;i<accounts.length;i++){
var localName = accounts[i].name var localName = accounts[i].name
if(localName != 'zhangsan'){ if(localName == 'zhangsan'){
await appAccountManager.removeOsAccount(localName) await appAccountManager.removeAccount(localName)
} }
} }
done(); done();
...@@ -447,13 +461,13 @@ export default function ActsAccountAppAccess() { ...@@ -447,13 +461,13 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountVerifyCredential_0100 add_account_err:" + JSON.stringify(err)); console.debug("====>ActsAccountVerifyCredential_0100 add_account_err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.verifyCredential(name, owner, options, { appAccountManager.verifyCredential(name, owner, options, {
onResult:(resultCode, resultData)=>{ onResult: async (resultCode, resultData)=>{
console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode)); console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode));
expect(resultCode).assertEqual(0) expect(resultCode).assertEqual(0)
console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultData:" + JSON.stringify(resultData)); console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultData:" + JSON.stringify(resultData));
expect(resultData.booleanResult).assertEqual(true) expect(resultData.booleanResult).assertEqual(true)
try{ try{
appAccountManager.deleteAccount(name) await appAccountManager.deleteAccount(name)
console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_success') console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_success')
done(); done();
} }
...@@ -465,8 +479,8 @@ export default function ActsAccountAppAccess() { ...@@ -465,8 +479,8 @@ export default function ActsAccountAppAccess() {
}, },
onRequestRedirected:null, onRequestRedirected:null,
onRequestContinued: function(){ onRequestContinued: function(){
console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_onRequestContinued") console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_onRequestContinued")
} }
}); });
}); });
}); });
...@@ -484,38 +498,30 @@ export default function ActsAccountAppAccess() { ...@@ -484,38 +498,30 @@ export default function ActsAccountAppAccess() {
appAccountManager.addAccount(name, (err)=>{ appAccountManager.addAccount(name, (err)=>{
console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountVerifyCredential_0200 add_account_data:" + JSON.stringify(data)); appAccountManager.verifyCredential(name, owner, {
try{ onResult: async (resultCode, resultData)=>{
appAccountManager.verifyCredential(name, owner, { console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode));
onResult:(resultCode, resultData)=>{ expect(resultCode).assertEqual(0)
console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode)); console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultData:" + JSON.stringify(resultData));
expect(resultCode).assertEqual(0) expect(resultData.booleanResult).assertEqual(false)
console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultData:" + JSON.stringify(resultData)); try{
expect(resultData.booleanResult).assertEqual(false) await appAccountManager.deleteAccount(name)
try{ console.debug('====>ActsAccountVerifyCredential_0200 removeAccount_success')
appAccountManager.deleteAccount(name) done();
console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_success') }
done(); catch{
} console.debug('====>ActsAccountVerifyCredential_0200 removeAccount_err')
catch{ expect().assertFail()
console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_err') }
expect().assertFail() done();
} },
done(); onRequestRedirected:null,
}, onRequestContinued: function(){
onRequestRedirected:null, console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_onRequestContinued")
onRequestContinued: function(){ }
console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_onRequestContinued") });
}
});
}catch(err){
console.debug('====>====>ActsAccountVerifyCredential_0200 err:'+JSON.stringify(err))
expect().assertFail();
done();
}
}); });
}); });
/* /*
* @tc.number : ActsAccountSetAuthenticatorProperties_0100 * @tc.number : ActsAccountSetAuthenticatorProperties_0100
* @tc.name : Verify Credential callback form, options * @tc.name : Verify Credential callback form, options
...@@ -530,13 +536,13 @@ export default function ActsAccountAppAccess() { ...@@ -530,13 +536,13 @@ export default function ActsAccountAppAccess() {
appAccountManager.addAccount(name, (err)=>{ appAccountManager.addAccount(name, (err)=>{
console.debug("====>ActsAccountSetAuthenticatorProperties_0100 add_account_err:" + JSON.stringify(err)); console.debug("====>ActsAccountSetAuthenticatorProperties_0100 add_account_err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.setAuthenticatorProperties(owner, options, { appAccountManager.setAuthenticatorProperties(owner, options, {
onResult:(resultCode, resultData)=>{ onResult: async (resultCode, resultData)=>{
console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode));
expect(resultCode).assertEqual(10016) expect(resultCode).assertEqual(10016)
console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData)); console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData));
try{ try{
appAccountManager.deleteAccount(name) await appAccountManager.deleteAccount(name)
console.debug('====>ActsAccountSetAuthenticatorProperties_0100 deleteAccount_success') console.debug('====>ActsAccountSetAuthenticatorProperties_0100 deleteAccount_success')
done(); done();
} }
...@@ -568,12 +574,12 @@ export default function ActsAccountAppAccess() { ...@@ -568,12 +574,12 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountSetAuthenticatorProperties_0200 add_account_err:" + JSON.stringify(err)); console.debug("====>ActsAccountSetAuthenticatorProperties_0200 add_account_err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.setAuthenticatorProperties(owner, { appAccountManager.setAuthenticatorProperties(owner, {
onResult:(resultCode, resultData)=>{ onResult: async (resultCode, resultData)=>{
console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode));
expect(resultCode).assertEqual(10016) expect(resultCode).assertEqual(10016)
console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData)); console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData));
try{ try{
appAccountManager.deleteAccount(name) await appAccountManager.deleteAccount(name)
console.debug('====>ActsAccountSetAuthenticatorProperties_0200 deleteAccount_success') console.debug('====>ActsAccountSetAuthenticatorProperties_0200 deleteAccount_success')
done(); done();
} }
...@@ -598,19 +604,6 @@ export default function ActsAccountAppAccess() { ...@@ -598,19 +604,6 @@ export default function ActsAccountAppAccess() {
*/ */
it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) { it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1000) await sleep(1000)
console.debug("====>ActsAccountSelectAccountByOptions_0100 start===="); console.debug("====>ActsAccountSelectAccountByOptions_0100 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
...@@ -646,21 +639,7 @@ export default function ActsAccountAppAccess() { ...@@ -646,21 +639,7 @@ export default function ActsAccountAppAccess() {
* @tc.desc : * @tc.desc :
*/ */
it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) { it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1000)
console.debug("====>ActsAccountSelectAccountByOptions_0200 start===="); console.debug("====>ActsAccountSelectAccountByOptions_0200 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
var select_options = {allowedOwners: [owner]} var select_options = {allowedOwners: [owner]}
...@@ -697,20 +676,6 @@ export default function ActsAccountAppAccess() { ...@@ -697,20 +676,6 @@ export default function ActsAccountAppAccess() {
*/ */
it('ActsAccountSelectAccountByOptions_0300', 0, async function (done) { it('ActsAccountSelectAccountByOptions_0300', 0, async function (done) {
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.accountauthenticator",
abilityName: "com.example.accountauthenticator.MainAbility",
action: "action1",
parameters:
{},
},
},
)
await sleep(1000)
console.debug("====>ActsAccountSelectAccountByOptions_0300 start===="); console.debug("====>ActsAccountSelectAccountByOptions_0300 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
var options = {requiredLabels: ["male", "30-40"]} var options = {requiredLabels: ["male", "30-40"]}
......
...@@ -427,7 +427,7 @@ export default function ActsAccountOAuthToken() { ...@@ -427,7 +427,7 @@ export default function ActsAccountOAuthToken() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.deleteOAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{ appAccountManager.deleteOAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{
console.debug("====>ActsAccountOAuthToken_7800 deleteOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7800 deleteOAuthToken err:" + JSON.stringify(err));
expect(err.code !=0).assertEqual(true); expect(err).assertEqual(null);
appAccountManager.getOAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{ appAccountManager.getOAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{
console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken err:" + JSON.stringify(err));
console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken data:" + data); console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken data:" + data);
...@@ -453,19 +453,14 @@ export default function ActsAccountOAuthToken() { ...@@ -453,19 +453,14 @@ export default function ActsAccountOAuthToken() {
console.debug("====>ActsAccountOAuthToken_7900 setOAuthToken start===="); console.debug("====>ActsAccountOAuthToken_7900 setOAuthToken start====");
await appAccountManager.setOAuthToken("account_promise_empty_authType","authType","promise_empty_authType_token"); await appAccountManager.setOAuthToken("account_promise_empty_authType","authType","promise_empty_authType_token");
console.debug("====>ActsAccountOAuthToken_7900 deleteOAuthToken start===="); console.debug("====>ActsAccountOAuthToken_7900 deleteOAuthToken start====");
try{ await appAccountManager.deleteOAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token");
await appAccountManager.deleteOAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token"); console.debug("====>ActsAccountAuthToken_7900 getAuthToken start====");
}catch(err){ var data = await appAccountManager.getOAuthToken("account_promise_empty_authType",OWNERSELF,"authType");
console.debug('====>ActsAccountAuthToken_7900 deleteAuthToken err:' + JSON.stringify(err)) expect(data).assertEqual("promise_empty_authType_token");
expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsAccountAuthToken_7900 removeAccount start====");
console.debug("====>ActsAccountAuthToken_7900 getAuthToken start===="); await appAccountManager.deleteAccount("account_promise_empty_authType");
var data = await appAccountManager.getOAuthToken("account_promise_empty_authType",OWNERSELF,"authType"); console.debug("====>ActsAccountAuthToken_7900 end====");
expect(data).assertEqual("promise_empty_authType_token"); done();
console.debug("====>ActsAccountAuthToken_7900 removeAccount start====");
await appAccountManager.deleteAccount("account_promise_empty_authType");
console.debug("====>ActsAccountAuthToken_7900 end====");
done();
}
}); });
...@@ -489,7 +484,7 @@ export default function ActsAccountOAuthToken() { ...@@ -489,7 +484,7 @@ export default function ActsAccountOAuthToken() {
expect(data).assertEqual("callback_setSameAuthType_token2"); expect(data).assertEqual("callback_setSameAuthType_token2");
appAccountManager.deleteOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{ appAccountManager.deleteOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{
console.debug("====>ActsAccountOAuthToken_8000 deleteOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8000 deleteOAuthToken err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true); expect(err).assertEqual(null);
appAccountManager.deleteAccount("account_callback_setSameAuthType",(err)=>{ appAccountManager.deleteAccount("account_callback_setSameAuthType",(err)=>{
console.debug("====>ActsAccountOAuthToken_8000 deleteAccount err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8000 deleteAccount err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -2429,7 +2424,7 @@ export default function ActsAccountOAuthToken() { ...@@ -2429,7 +2424,7 @@ export default function ActsAccountOAuthToken() {
try{ try{
appAccountManager.deleteOAuthToken("account_callback_delete_space",OWNERSELF,"authType","",(err)=>{ appAccountManager.deleteOAuthToken("account_callback_delete_space",OWNERSELF,"authType","",(err)=>{
console.debug("====>ActsAccountOAuthToken_6900 deleteOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_6900 deleteOAuthToken err:" + JSON.stringify(err));
expect(err.code == 12400004).assertEqual(true) expect(err).assertEqual(null)
appAccountManager.getOAuthToken("account_callback_delete_space",OWNERSELF,"authType",(err,data)=>{ appAccountManager.getOAuthToken("account_callback_delete_space",OWNERSELF,"authType",(err,data)=>{
console.debug("====>ActsAccountOAuthToken_6900 getAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_6900 getAuthToken err:" + JSON.stringify(err));
console.debug("====>ActsAccountOAuthToken_6900 getAuthToken data:" + data); console.debug("====>ActsAccountOAuthToken_6900 getAuthToken data:" + data);
...@@ -2459,18 +2454,14 @@ export default function ActsAccountOAuthToken() { ...@@ -2459,18 +2454,14 @@ export default function ActsAccountOAuthToken() {
console.debug("====>ActsAccountOAuthToken_7000 setOAuthToken start===="); console.debug("====>ActsAccountOAuthToken_7000 setOAuthToken start====");
await appAccountManager.setOAuthToken("account_promise_delete_space","authType","account_promise_delete_space_token"); await appAccountManager.setOAuthToken("account_promise_delete_space","authType","account_promise_delete_space_token");
console.debug("====>ActsAccountOAuthToken_7000 deleteOAuthToken start===="); console.debug("====>ActsAccountOAuthToken_7000 deleteOAuthToken start====");
try{ await appAccountManager.deleteOAuthToken("account_promise_delete_space",OWNERSELF,"authType","");
await appAccountManager.deleteOAuthToken("account_promise_delete_space",OWNERSELF,"authType",""); console.debug("====>ActsAccountOAuthToken_7000 getOAuthToken start====");
}catch(err){ var data = await appAccountManager.getOAuthToken("account_promise_delete_space",OWNERSELF,"authType");
expect(err.code != 0).assertEqual(true) expect(data).assertEqual("account_promise_delete_space_token");
console.debug("====>ActsAccountOAuthToken_7000 getOAuthToken start===="); console.debug("====>ActsAccountOAuthToken_7000 deleteAccount start====");
var data = await appAccountManager.getOAuthToken("account_promise_delete_space",OWNERSELF,"authType"); await appAccountManager.deleteAccount("account_promise_delete_space");
expect(data).assertEqual("account_promise_delete_space_token"); console.debug("====>ActsAccountOAuthToken_7000 end====");
console.debug("====>ActsAccountOAuthToken_7000 deleteAccount start===="); done();
await appAccountManager.deleteAccount("account_promise_delete_space");
console.debug("====>ActsAccountOAuthToken_7000 end====");
done();
}
}); });
it('ActsAccountOAuthToken_9200', 0, async function (done) { it('ActsAccountOAuthToken_9200', 0, async function (done) {
...@@ -2555,6 +2546,10 @@ export default function ActsAccountOAuthToken() { ...@@ -2555,6 +2546,10 @@ export default function ActsAccountOAuthToken() {
expect(account.Constants.KEY_CALLER_PID).assertEqual('callerPid'); expect(account.Constants.KEY_CALLER_PID).assertEqual('callerPid');
expect(account.Constants.KEY_CALLER_UID).assertEqual('callerUid'); expect(account.Constants.KEY_CALLER_UID).assertEqual('callerUid');
expect(account.Constants.KEY_CALLER_BUNDLE_NAME).assertEqual('callerBundleName'); expect(account.Constants.KEY_CALLER_BUNDLE_NAME).assertEqual('callerBundleName');
expect(account.Constants.ACTION_CREATE_ACCOUNT_IMPLICITLY).assertEqual('createAccountImplicitly');
expect(account.Constants.ACTION_AUTH).assertEqual('auth');
expect(account.Constants.ACTION_VERIFY_CREDENTIAL).assertEqual('verifyCredential');
expect(account.Constants.ACTION_SET_AUTHENTICATOR_PROPERTIES).assertEqual('setAuthenticatorProperties');
done(); done();
}); });
}); });
......
...@@ -30,7 +30,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -30,7 +30,7 @@ export default function ActsAccountChangeOnOff() {
console.info(`sleep #{time} over ...`) console.info(`sleep #{time} over ...`)
}) })
} }
beforeAll(async function (done) { beforeAll(async function (done) {
done(); done();
}); });
......
...@@ -105,19 +105,19 @@ export default function ActsGetMultipleAccounts() { ...@@ -105,19 +105,19 @@ export default function ActsGetMultipleAccounts() {
if (dataMap.has("accessibleAccount_this_application_first")) { if (dataMap.has("accessibleAccount_this_application_first")) {
let data = dataMap.get("accessibleAccount_this_application_first"); let data = dataMap.get("accessibleAccount_this_application_first");
console.debug("====>fifth account owner is: " + data); console.debug("====>fifth account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple"); expect(data).assertEqual("com.example.getmultipleaccountstest");
} }
expect(dataMap.has("accessibleAccount_this_application_second")).assertTrue(); expect(dataMap.has("accessibleAccount_this_application_second")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_second")) { if (dataMap.has("accessibleAccount_this_application_second")) {
let data = dataMap.get("accessibleAccount_this_application_second"); let data = dataMap.get("accessibleAccount_this_application_second");
console.debug("====>sixth account owner is: " + data); console.debug("====>sixth account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple"); expect(data).assertEqual("com.example.getmultipleaccountstest");
} }
expect(dataMap.has("accessibleAccount_this_application_third")).assertTrue(); expect(dataMap.has("accessibleAccount_this_application_third")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_third")) { if (dataMap.has("accessibleAccount_this_application_third")) {
let data = dataMap.get("accessibleAccount_this_application_third"); let data = dataMap.get("accessibleAccount_this_application_third");
console.debug("====>seventh account owner is: " + data); console.debug("====>seventh account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple"); expect(data).assertEqual("com.example.getmultipleaccountstest");
} }
console.debug("====>delete account start===="); console.debug("====>delete account start====");
await appAccountManager.removeAccount("accessibleAccount_this_application_first"); await appAccountManager.removeAccount("accessibleAccount_this_application_first");
......
...@@ -68,7 +68,7 @@ class MyAuthenticator extends account_appAccount.Authenticator { ...@@ -68,7 +68,7 @@ class MyAuthenticator extends account_appAccount.Authenticator {
let newAccountName = "createNewAccountName" let newAccountName = "createNewAccountName"
appAccountMgr.createAccount(newAccountName, (err) => { appAccountMgr.createAccount(newAccountName, (err) => {
let authResult = { let authResult = {
accountInfo: { account: {
name: newAccountName, name: newAccountName,
owner: "com.example.accountauthenticator" owner: "com.example.accountauthenticator"
} }
...@@ -80,7 +80,7 @@ class MyAuthenticator extends account_appAccount.Authenticator { ...@@ -80,7 +80,7 @@ class MyAuthenticator extends account_appAccount.Authenticator {
auth(name, authType, options, callback) { auth(name, authType, options, callback) {
console.log(TAG + "name: " + name + "authType: " + authType + ", options: " + JSON.stringify(options)) console.log(TAG + "name: " + name + "authType: " + authType + ", options: " + JSON.stringify(options))
let authResult = { let authResult = {
accountInfo: { account: {
name: name, name: name,
owner: "com.example.accountauthenticator" owner: "com.example.accountauthenticator"
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册