OsAccount.test.js 26.1 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
            console.debug('====>ActsDistributedAccountDeviceId_0100 start====')
            try {
                console.log("====>test query distribtued id start");
                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');
1
123 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65
                        expect(distributedInfo.id !== 'ohosAnonymousUid').assertTrue()
                        let uid = distributedInfo.id
                        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(uid)
                            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();
                            })
66
                        })
1
15829070344 已提交
67
                    })
J
jiyong_sd 已提交
68
                })
69 70 71 72 73 74
            } catch (err){
                console.debug('====>ActsDistributedAccountDeviceId_0100 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }

J
jiyong_sd 已提交
75 76 77 78 79 80 81
        })

        /**
        * @tc.number     SUB_Account_distributedAccount_JS_API_0100
        * @tc.name       Test distributedAccount.getDistributedAccountAbility.
        * @tc.desc      Test distributedAccount.getDistributedAccountAbility API functionality.
        */
1
15829070344 已提交
82
        it('account_getDistributedAccountAbility_test', 0, async function (done) {
83 84 85 86 87 88 89 90 91 92 93 94 95 96
            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 已提交
97 98 99 100 101 102 103 104
            }
        })

        /**
        * @tc.number     SUB_Account_distributedAccount_JS_API_0200
        * @tc.name       Test distributedAccount.queryOsAccountDistributedInfo.
        * @tc.desc       Test distributedAccount.queryOsAccountDistributedInfo API functionality.
        */
1
15829070344 已提交
105
        it('account_queryOsAccountDistributedInfo_test001', 0, async function (done) {
106 107 108 109 110 111 112 113 114 115 116 117 118 119
            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 已提交
120 121 122 123 124 125 126
        })

        /**
        * @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 已提交
127
        it('account_queryOsAccountDistributedInfo_test002', 0, async function (done) {
128 129 130 131 132 133 134 135 136 137 138 139
            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 已提交
140
                console.debug('====>account_queryOsAccountDistributedInfo_test002 err:' + JSON.stringify(err))
141 142 143
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
144 145 146 147 148 149 150
        })

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

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

J
jiyong_sd 已提交
223
        /**
224
        * @tc.number     SUB_Account_distributedAccount_JS_API_0600
J
jiyong_sd 已提交
225 226 227
        * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
        * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
228
        it('account_updateOsAccountDistributedInfo_test003', 0, async function (done) {
229
            console.debug('====>account_updateOsAccountDistributedInfo_test003 start====')
J
jiyong_sd 已提交
230
            const accountAbility = account.getDistributedAccountAbility()
1
15829070344 已提交
231
            let data = null
J
jiyong_sd 已提交
232 233 234 235 236 237
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.TOKEN_INVALID',
                scalableData:data
            };
238
            try {
239
                accountAbility.updateOsAccountDistributedInfo(obj, async function (result) {
240
                    console.debug("====>account_updateOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result))
241
                    await accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) {
242 243 244 245 246 247 248 249 250 251
                        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 已提交
252
        })
1
15829070344 已提交
253

J
jiyong_sd 已提交
254
        /**
255
        * @tc.number     SUB_Account_distributedAccount_JS_API_0700
J
jiyong_sd 已提交
256 257 258
        * @tc.name       Test distributedAccount.updateOsAccountDistributedInfo by callback.
        * @tc.desc       Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
        */
1
15829070344 已提交
259
        it('account_updateOsAccountDistributedInfo_test004', 0, async function (done) {
260
            console.debug('====>account_updateOsAccountDistributedInfo_test004 start====')
J
jiyong_sd 已提交
261 262 263 264 265
            const accountAbility = account.getDistributedAccountAbility()
            let obj = {
                id: '12345',
                name: 'ZhangSan',
                event: 'Ohos.account.event.LOGIN',
1
15829070344 已提交
266
                scalableData:{}
J
jiyong_sd 已提交
267
            };
268 269 270
            try {
                accountAbility.updateOsAccountDistributedInfo(obj, function (err) {
                    console.debug("====>account_updateOsAccountDistributedInfo_test004 update_err:" + JSON.stringify(err))
271
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
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')
1
123 已提交
275
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
276 277 278 279 280
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOFF'
                        };
281
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
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 307 308 309 310 311 312
                            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 () {
313
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
314 315
                        console.debug('====>account_updateOsAccountDistributedInfo_test005 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
1
123 已提交
316
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
317 318 319 320 321 322 323 324 325
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT',
                            scalableData:undefined,
                            nickname:undefined,
                            avatar:undefined,
                            status:undefined
                        };
326
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
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 352 353 354 355 356 357
                            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 () {
358
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
359 360
                        console.debug("====>account_updateOsAccountDistributedInfo_test006 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
1
123 已提交
361
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
362 363 364 365 366
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
367
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) {
368 369 370
                            expect(data).assertEqual(undefined)
                            done();
                        });
J
jiyong_sd 已提交
371 372
                    });
                });
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
            } 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 () {
399
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
400 401
                        console.debug('====>account_updateOsAccountDistributedInfo_test007 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
1
123 已提交
402
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
403 404 405 406 407
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
408
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
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 434 435 436 437 438 439
                            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 () {
440
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
441 442
                        console.debug("====>account_updateOsAccountDistributedInfo_test008 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
1
123 已提交
443
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
444 445 446 447 448
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
449
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) {
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
                            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 () {
477
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
478 479
                        console.debug('====>account_updateOsAccountDistributedInfo_test009 data:' + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
1
123 已提交
480
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
481 482 483 484 485
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
486
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) {
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
                            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 () {
514
                    accountAbility.queryOsAccountDistributedInfo(async function (err, data) {
515 516
                        console.debug("====>account_updateOsAccountDistributedInfo_test010 data:" + JSON.stringify(data))
                        expect(data.name).assertEqual('ZhangSan')
1
123 已提交
517
                        expect(data.id !== 'ohosAnonymousUid').assertTrue()
518 519 520 521 522
                        let obj = {
                            id: '12345',
                            name: 'ZhangSan',
                            event: 'Ohos.account.event.LOGOUT'
                        };
523
                        await accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) {
524 525 526 527 528 529 530 531 532 533
                            expect(data).assertEqual(undefined)
                            done();
                        });
                    });
                });
            } catch (err){
                console.debug('====>account_updateOsAccountDistributedInfo_test010 err:' + JSON.stringify(err))
                expect().assertFail()
                done()
            }
J
jiyong_sd 已提交
534 535 536
        })
    })
}