OsAccount.test.js 26.0 KB
Newer Older
J
jiyong_sd 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (C) 2021 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.
 */

16
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
J
jiyong_sd 已提交
17 18

import account from '@ohos.account.distributedAccount'
1
15829070344 已提交
19 20 21 22 23 24 25 26 27 28
const LOGININFO = {
    name: 'ZhangSan',
    id: '12345',
    event: "Ohos.account.event.LOGIN"
}
const LOGOUTINFO = {
    name: 'ZhangSan',
    id: '12345',
    event: "Ohos.account.event.LOGOUT"
}
J
jiyong_sd 已提交
29 30 31 32 33 34 35 36 37 38 39 40
export default function AccountTest() {
    describe('AccountTest', function () {
        beforeEach(function () {
        })
        afterEach(function () {
        })

        /**
        * @tc.number     ActsDistributedAccountDeviceId_0100
        * @tc.name       Test query the distribruted id by callback.
        * @tc.desc       Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
41
        it('ActsDistributedAccountDeviceId_0100', 0, async function(done){
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
            console.debug('====>ActsDistributedAccountDeviceId_0100 start====')
            try {
                console.log("====>test query distribtued id start");
                const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; //'12345'sha256的值
                const accountAbility = account.getDistributedAccountAbility();
                accountAbility.updateOsAccountDistributedInfo(LOGININFO, (err)=>{
                    console.log("====>update distributedInfo err:" + JSON.stringify(err));
                    accountAbility.queryOsAccountDistributedInfo((err, distributedInfo)=>{
                        console.log("====>query distributedInfo err:" + JSON.stringify(err));
                        console.log("====>query distributedInfo:" + JSON.stringify(distributedInfo));
                        expect(distributedInfo.name).assertEqual('ZhangSan');
                        expect(distributedInfo.id).assertEqual(distributedId);
                        console.debug('success')
                        accountAbility.updateOsAccountDistributedInfo(LOGOUTINFO, (err)=>{
                            console.debug('====>ActsDistributedAccountDeviceId_0100 logout_result:'+ JSON.stringify(err))
                            expect(err).assertEqual(undefined)
                            console.log("====>test query distribtued id end");
                            done();
                        })
1
15829070344 已提交
61
                    })
J
jiyong_sd 已提交
62
                })
63 64 65 66 67 68
            } catch (err){
                console.debug('====>ActsDistributedAccountDeviceId_0100 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }

J
jiyong_sd 已提交
69 70 71 72 73 74 75
        })

        /**
        * @tc.number     SUB_Account_distributedAccount_JS_API_0100
        * @tc.name       Test distributedAccount.getDistributedAccountAbility.
        * @tc.desc      Test distributedAccount.getDistributedAccountAbility API functionality.
        */
1
15829070344 已提交
76
        it('account_getDistributedAccountAbility_test', 0, async function (done) {
77 78 79 80 81 82 83 84 85 86 87 88 89 90
            console.debug('====>account_getDistributedAccountAbility_test start====')
            try {
                var ret = false;
                const accountAbility = account.getDistributedAccountAbility()
                console.debug("====>account_getDistributedAccountAbility_test result:" + JSON.stringify(accountAbility))
                if(accountAbility !== null){
                    ret = true;
                }
                expect(ret).assertTrue()
                done();
            } catch (err){
                console.debug('====>ActsDistributedAccountDeviceId_0100 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
J
jiyong_sd 已提交
91 92 93 94 95 96 97 98
            }
        })

        /**
        * @tc.number     SUB_Account_distributedAccount_JS_API_0200
        * @tc.name       Test distributedAccount.queryOsAccountDistributedInfo.
        * @tc.desc       Test distributedAccount.queryOsAccountDistributedInfo API functionality.
        */
1
15829070344 已提交
99
        it('account_queryOsAccountDistributedInfo_test001', 0, async function (done) {
100 101 102 103 104 105 106 107 108 109 110 111 112 113
            console.debug('====>account_queryOsAccountDistributedInfo_test001 start====')
            try {
                let accountAbility = account.getDistributedAccountAbility()
                accountAbility.queryOsAccountDistributedInfo().then(function (data) {
                    console.debug('====>account_queryOsAccountDistributedInfo_test001 data:' + JSON.stringify(data))
                    expect(data.name).assertEqual('ohosAnonymousName')
                    expect(data.id).assertEqual('ohosAnonymousUid')
                    done();
                });
            } catch (err){
                console.debug('====>account_queryOsAccountDistributedInfo_test001 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
114 115 116 117 118 119 120
        })

        /**
        * @tc.number     SUB_Account_distributedAccount_JS_API_0300
        * @tc.name       Test distributedAccount.queryOsAccountDistributedInfo by callback.
        * @tc.desc       Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
121
        it('account_queryOsAccountDistributedInfo_test002', 0, async function (done) {
122 123 124 125 126 127 128 129 130 131 132 133
            console.debug('====>account_queryOsAccountDistributedInfo_test002 start')
            try {
                let accountAbility = account.getDistributedAccountAbility()
                accountAbility.queryOsAccountDistributedInfo(function (err, data) {
                    console.debug('====>account_queryOsAccountDistributedInfo_test002 err:' + JSON.stringify(err))
                    console.debug('====>account_queryOsAccountDistributedInfo_test002 data:' + JSON.stringify(data))
                    expect(err).assertEqual(undefined)
                    expect(data.name).assertEqual('ohosAnonymousName')
                    expect(data.id).assertEqual('ohosAnonymousUid')
                    done();
                });
            } catch (err){
1
15829070344 已提交
134
                console.debug('====>account_queryOsAccountDistributedInfo_test002 err:' + JSON.stringify(err))
135 136 137
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
138 139 140 141 142 143 144
        })

        /**
        * @tc.number     SUB_Account_distributedAccount_JS_API_0400
        * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo.
        * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality.
        */
1
15829070344 已提交
145
        it('account_updateOsAccountDistributedInfo_test001', 0, async function (done) {
146
            console.debug('====>account_updateOsAccountDistributedInfo_test001 start====')
J
jiyong_sd 已提交
147
            const accountAbility = account.getDistributedAccountAbility()
1
15829070344 已提交
148
            let data = null
J
jiyong_sd 已提交
149 150 151 152 153 154
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
                scalableData:data
            };
155 156
            try {
                await accountAbility.updateOsAccountDistributedInfo(obj).then(function () {
157
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
158 159 160 161 162 163 164 165
                        console.debug('====>account_updateOsAccountDistributedInfo_test001 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
166
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
167
                            expect(err).assertEqual(undefined)
168
							done();
169
                        });
J
jiyong_sd 已提交
170 171
                    });
                });
172 173 174 175 176
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test001 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
177 178 179
        })

        /**
180
        * @tc.number     SUB_Account_distributedAccount_JS_API_0500
J
jiyong_sd 已提交
181 182 183
        * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
        * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
184
        it('account_updateOsAccountDistributedInfo_test002', 0,  async function (done)  {
185
            console.debug('====>account_updateOsAccountDistributedInfo_test002 start====')
1
15829070344 已提交
186
            var accountAbility = account.getDistributedAccountAbility()
J
jiyong_sd 已提交
187 188 189 190
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
1
15829070344 已提交
191
                scalableData:{}
J
jiyong_sd 已提交
192
            };
193 194
            try {
                accountAbility.updateOsAccountDistributedInfo(obj, function () {
195
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
196 197 198 199 200 201 202 203
                        console.debug("====>account_updateOsAccountDistributedInfo_test002 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
204 205
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
                            expect(err).assertEqual(undefined)
206 207
                            done();
                        });
J
jiyong_sd 已提交
208 209
                    });
                });
210 211 212 213 214
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test002 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
215
        })
1
15829070344 已提交
216

J
jiyong_sd 已提交
217
        /**
218
        * @tc.number     SUB_Account_distributedAccount_JS_API_0600
J
jiyong_sd 已提交
219 220 221
        * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
        * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
222
        it('account_updateOsAccountDistributedInfo_test003', 0, async function (done) {
223
            console.debug('====>account_updateOsAccountDistributedInfo_test003 start====')
J
jiyong_sd 已提交
224
            const accountAbility = account.getDistributedAccountAbility()
1
15829070344 已提交
225
            let data = null
J
jiyong_sd 已提交
226 227 228 229 230 231
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.TOKEN_INVALID',
                scalableData:data
            };
232
            try {
233
                accountAbility.updateOsAccountDistributedInfo(obj, async function (result) {
234
                    console.debug("====>account_updateOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result))
235
                    await accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) {
236 237 238 239 240 241 242 243 244 245
                        console.debug("====>account_updateOsAccountDistributedInfo_test003 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual("ohosAnonymousName")
                        done();
                    })
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test003 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
246
        })
1
15829070344 已提交
247

J
jiyong_sd 已提交
248
        /**
249
        * @tc.number     SUB_Account_distributedAccount_JS_API_0700
J
jiyong_sd 已提交
250 251 252
        * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
        * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
253
        it('account_updateOsAccountDistributedInfo_test004', 0, async function (done) {
254
            console.debug('====>account_updateOsAccountDistributedInfo_test004 start====')
J
jiyong_sd 已提交
255 256 257 258 259
            const accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
1
15829070344 已提交
260
                scalableData:{}
J
jiyong_sd 已提交
261
            };
262 263 264
            try {
                accountAbility.updateOsAccountDistributedInfo(obj, function (err) {
                    console.debug("====>account_updateOsAccountDistributedInfo_test004 update_err:" + JSON.stringify(err))
265
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
266 267 268 269 270 271 272 273 274
                        console.debug("====>account_updateOsAccountDistributedInfo_test004 query_err:" + JSON.stringify(err))
                        console.debug("====>account_updateOsAccountDistributedInfo_test004 query_data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOFF'
                        };
275
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
                            expect(err).assertEqual(undefined)
                            done();
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test004 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
        })

        /**
         * @tc.number     SUB_Account_distributedAccount_JS_API_0800
         * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo.
         * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality.
         */
        it('account_updateOsAccountDistributedInfo_test005', 0, async function (done) {
            console.debug('====>account_updateOsAccountDistributedInfo_test005 start====')
            const accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
                scalableData:undefined,
                nickname:undefined,
                avatar:undefined,
                status:undefined
            };
            try {
                await accountAbility.updateOsAccountDistributedInfo(obj).then(function () {
307
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
308 309 310 311 312 313 314 315 316 317 318 319
                        console.debug('====>account_updateOsAccountDistributedInfo_test005 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT',
                            scalableData:undefined,
                            nickname:undefined,
                            avatar:undefined,
                            status:undefined
                        };
320
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
                            expect(err).assertEqual(undefined)
                            done()
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test005 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
        })

        /**
         * @tc.number     SUB_Account_distributedAccount_JS_API_0900
         * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
         * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
         */
        it('account_updateOsAccountDistributedInfo_test006', 0,  async function (done)  {
            console.debug('====>account_updateOsAccountDistributedInfo_test006 start====')
            var accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
                scalableData:undefined,
                nickname:undefined,
                avatar:undefined,
                status:undefined
            };
            try {
                accountAbility.updateOsAccountDistributedInfo(obj, function () {
352
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
353 354 355 356 357 358 359 360
                        console.debug("====>account_updateOsAccountDistributedInfo_test006 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
361
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) {
362 363 364
                            expect(data).assertEqual(undefined)
                            done();
                        });
J
jiyong_sd 已提交
365 366
                    });
                });
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test006 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
        })

        /**
         * @tc.number     SUB_Account_distributedAccount_JS_API_1000
         * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo.
         * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality.
         */
        it('account_updateOsAccountDistributedInfo_test007', 0, async function (done) {
            console.debug('====>account_updateOsAccountDistributedInfo_test007 start====')
            const accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
                scalableData:null,
                nickname:null,
                avatar:null,
                status:null
            };
            try {
                await accountAbility.updateOsAccountDistributedInfo(obj).then(function () {
393
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
394 395 396 397 398 399 400 401
                        console.debug('====>account_updateOsAccountDistributedInfo_test007 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
402
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
                            expect(err).assertEqual(undefined)
                            done()
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test007 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
        })

        /**
         * @tc.number     SUB_Account_distributedAccount_JS_API_1100
         * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
         * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
         */
        it('account_updateOsAccountDistributedInfo_test008', 0,  async function (done)  {
            console.debug('====>account_updateOsAccountDistributedInfo_test008 start====')
            var accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
                scalableData:null,
                nickname:null,
                avatar:null,
                status:null
            };
            try {
                accountAbility.updateOsAccountDistributedInfo(obj, function () {
434
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
435 436 437 438 439 440 441 442
                        console.debug("====>account_updateOsAccountDistributedInfo_test008 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
443
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) {
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
                            expect(data).assertEqual(undefined)
                            done();
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test008 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
        })

        /**
         * @tc.number     SUB_Account_distributedAccount_JS_API_1200
         * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo.
         * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality.
         */
        it('account_updateOsAccountDistributedInfo_test009', 0, async function (done) {
            console.debug('====>account_updateOsAccountDistributedInfo_test009 start====')
            const accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN'
            };
            try {
                await accountAbility.updateOsAccountDistributedInfo(obj).then(function () {
471
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
472 473 474 475 476 477 478 479
                        console.debug('====>account_updateOsAccountDistributedInfo_test009 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
480
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
                            expect(err).assertEqual(undefined)
                            done()
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test009 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
        })

        /**
         * @tc.number     SUB_Account_distributedAccount_JS_API_1300
         * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
         * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
         */
        it('account_updateOsAccountDistributedInfo_test010', 0,  async function (done)  {
            console.debug('====>account_updateOsAccountDistributedInfo_test010 start====')
            var accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN'
            };
            try {
                accountAbility.updateOsAccountDistributedInfo(obj, function () {
508
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
509 510 511 512 513 514 515 516
                        console.debug("====>account_updateOsAccountDistributedInfo_test010 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
                        expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5')
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
517
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) {
518 519 520 521 522 523 524 525 526 527
                            expect(data).assertEqual(undefined)
                            done();
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test010 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
528 529 530
        })
    })
}