CustomData.test.js 62.1 KB
Newer Older
1
15829070344 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/*
 * 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.
 */
import account from '@ohos.account.appAccount'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'

const TIMEOUT = 5000;
const EACHTIMEOUT = 500;
export default function ActsAccountCustomData() {
    describe('ActsAccountCustomData', function () {
        function sleep(delay) {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve()
                }, delay)
            }).then(() => {
                console.info(`sleep #{time} over ...`)
            })
        }

        beforeAll(async function (done) {
            console.debug("====>beforeAll start====");
            await sleep(TIMEOUT);
            console.debug("====>beforeAll end====");
            done();
        })

        beforeEach(async function (done) {
            console.debug("====>beforeEach enter====");
            await sleep(EACHTIMEOUT);
            done();
        })

        /*
        * @tc.number    : ActsAccountCustomData_0100
47
        * @tc.name      : The correct calls setAssociatedData and getCustomData get the value
1
15829070344 已提交
48
        * @tc.desc      : The setAssociatedData setting valueis called when the forwarding parameters
49
        *                 are correct, and then getCustomData is called for the value(callback)
1
15829070344 已提交
50 51 52 53 54 55 56 57 58 59 60
        */
        it('ActsAccountCustomData_0100', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0100 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_0100",(err)=>{
                console.debug("====>add accountActsAccountCustomData_0100 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_0100", "key1", "value1", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_0100 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
61 62 63
                    appAccountManager.getCustomData("account_name_0100", "key1", (err, data)=>{
                        console.debug("====>getCustomData 0100 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 0100 data:" + JSON.stringify(data));
1
15829070344 已提交
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
                        expect(err).assertEqual(null);
                        expect(data).assertEqual("value1");
                        appAccountManager.removeAccount("account_name_0100", (err)=>{
                            console.debug("====>delete Account 0100 err:" + JSON.stringify(err));
                            expect(err).assertEqual(null);
                            console.debug("====>ActsAccountCustomData_0100 end====");
                            done();
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_0200
79
        * @tc.name      : The correct calls setAssociatedData and getCustomData get the value
1
15829070344 已提交
80
        * @tc.desc      : The setAssociatedData setting value is called when the forwarding parameters
81
        *                 are correct, and then getCustomData is called for the value(promise)
1
15829070344 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
        */
        it('ActsAccountCustomData_0200', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0200 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_0200 start====");
            try{
                await appAccountManager.createAccount("account_name_0200");
            }
            catch(err){
                console.error("====>add Account ActsAccountCustomData_0200 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>setAssociatedData ActsAccountCustomData_0200 start====");
            try{
                await appAccountManager.setAssociatedData("account_name_0200", "key2", "value2");
            }
            catch(err){
                console.error("====>setAssociatedData ActsAccountCustomData_0200 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
105
            console.debug("====>getCustomData ActsAccountCustomData_0200 start====");
1
15829070344 已提交
106
            try{
107
                var data = await appAccountManager.getCustomData("account_name_0200", "key2");
1
15829070344 已提交
108 109
            }
            catch(err){
110
                console.error("====>getCustomData ActsAccountCustomData_0200 err:" + JSON.stringify(err));
1
15829070344 已提交
111 112 113
                expect().assertFail();
                done();
            }
114
            console.debug("====>getCustomData ActsAccountCustomData_0200 data:" + JSON.stringify(data));
1
15829070344 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
            expect(data).assertEqual("value2");
            console.debug("====>delete account ActsAccountCustomData_0200 start====");
            try{
                await appAccountManager.removeAccount("account_name_0200");
            }
            catch(err){
                console.error("====>delete account 0200 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_0200 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_0300
        * @tc.name      : Get it directly without setting value
132
        * @tc.desc      : Call getCustomData directly to get value without calling setAssociatedData(callback)
1
15829070344 已提交
133 134 135 136 137 138 139 140
        */
        it('ActsAccountCustomData_0300', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0300 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_0300", (err)=>{
                console.debug("====>add account ActsAccountCustomData_0300 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
141 142 143
                appAccountManager.getCustomData("account_name_0300", "key3", (err, data)=>{
                    console.debug("====>getCustomData 0300 err:" + JSON.stringify(err));
                    console.debug("====>getCustomData 0300 data:" + JSON.stringify(data));
1
15829070344 已提交
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
                    expect(err.code != 0).assertEqual(true);
                    expect(data).assertEqual(null);
                    appAccountManager.removeAccount("account_name_0300", (err)=>{
                        console.debug("====>delete Account 0300 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_0300 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_0400
        * @tc.name      : Get it directly without setting value
159
        * @tc.desc      : Call getCustomData directly to get value without calling setAssociatedData(promise)
1
15829070344 已提交
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
        */
        it('ActsAccountCustomData_0400', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0400 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_0400 start====");
            try{
                await appAccountManager.createAccount("account_name_0400");
            }
            catch(err){
                console.error("====>add Account ActsAccountCustomData_0400 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
175 176
                await appAccountManager.getCustomData("account_name_0400", "key4");
                console.error("====>getCustomData fail ActsAccountCustomData_0400====");
1
15829070344 已提交
177 178 179 180
                expect().assertFail();
                done();
            }
            catch(err){
181
                console.debug("====>getCustomData ActsAccountCustomData_0400 err:" + JSON.stringify(err));
1
15829070344 已提交
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_0400 start====");
                try{
                    await appAccountManager.removeAccount("account_name_0400");
                }
                catch(err){
                    console.error("====>delete account 0400 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_0400 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_0500
199
        * @tc.name      : Call getCustomData to get value when passing in the error parameter
1
15829070344 已提交
200
        * @tc.desc      : After calling setAssociatedData setting value correctly,
201
        *                 call the getCustomData of the pass error to check if you get the value(callback)
1
15829070344 已提交
202 203 204 205 206 207 208 209 210 211 212
        */
        it('ActsAccountCustomData_0500', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0500 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_0500",(err)=>{
                console.debug("====>add account ActsAccountCustomData_0500 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_0500", "key5", "value5", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_0500 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
213 214 215
                    appAccountManager.getCustomData("account_name_0500", "keyerr", (err, data)=>{
                        console.debug("====>getCustomData 0500 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 0500 data:" + JSON.stringify(data));
1
15829070344 已提交
216 217 218 219 220 221 222 223 224 225 226 227 228 229
                        expect(err.code != 0).assertEqual(true);
                        appAccountManager.removeAccount("account_name_0500", (err)=>{
                            console.debug("====>delete Account 0500 err:" + JSON.stringify(err));
                            expect(err).assertEqual(null);
                            console.debug("====>ActsAccountCustomData_0500 end====");
                            done();
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_0600
230
        * @tc.name      : Call getCustomData to get value when passing in the error parameter
1
15829070344 已提交
231
        * @tc.desc      : After calling setAssociatedData setting value correctly,
232
        *                 call the getCustomData of the pass error to check if you get the value(promise)
1
15829070344 已提交
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
        */
        it('ActsAccountCustomData_0600', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0600 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_0600 start====");
            try{
                await appAccountManager.createAccount("account_name_0600");
            }
            catch(err){
                console.error("====>add Account ActsAccountCustomData_0600 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            await appAccountManager.setAssociatedData("account_name_0600", "key6", "value6");
            try{
249
                var data = await appAccountManager.getCustomData("account_name_0600", "keyerr");
1
15829070344 已提交
250 251
            }
            catch(err){
252
                console.debug("====>getCustomData 0600 err:" + JSON.stringify(err));
1
15829070344 已提交
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_0600 start====");
                try{
                    await appAccountManager.removeAccount("account_name_0600");
                }
                catch(err){
                    console.error("====>delete account 0600 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_0600 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_0700
270
        * @tc.name      : Whether getCustomData can get the correct value when calling setAssociatedData multiple times
1
15829070344 已提交
271
        * @tc.desc      : When the first setAssociatedData is called and the second setAssociatedData
272
        *                 is called,the setting of the value is different if the call getCustomData
1
15829070344 已提交
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
        *                 can get the second value(callback)
        */
        it('ActsAccountCustomData_0700', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0700 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_0700",(err)=>{
                console.debug("====>add account ActsAccountCustomData_0700 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_0700", "key7", "value7", (err)=>{
                    console.debug("====>setAssociatedDatafir first time 0700 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
                    appAccountManager.setAssociatedData("account_name_0700", "key7", "newvalue7", (err)=>{
                        console.debug("====>setAssociatedDatafir second time 0700 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
288 289 290
                        appAccountManager.getCustomData("account_name_0700", "key7", (err, data)=>{
                            console.debug("====>getCustomData 0700 err:" + JSON.stringify(err));
                            console.debug("====>getCustomData 0700 data:" + JSON.stringify(data));
1
15829070344 已提交
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
                            expect(err).assertEqual(null);
                            expect(data).assertEqual("newvalue7");
                            appAccountManager.removeAccount("account_name_0700", (err)=>{
                                console.debug("====>delete Account 0700 err:" + JSON.stringify(err));
                                expect(err).assertEqual(null);
                                console.debug("====>ActsAccountCustomData_0700 end====");
                                done();
                            });
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_0800
307
        * @tc.name      : Whether getCustomData can get the correct value when calling setAssociatedData multiple times
1
15829070344 已提交
308
        * @tc.desc      : When the first setAssociatedData is called and the second setAssociatedData
309
        *                 is called,the setting of the value is different if the call getCustomData
1
15829070344 已提交
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
        *                 can get the second value(promise)
        */
        it('ActsAccountCustomData_0800', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0800 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            try{
                await appAccountManager.createAccount("account_name_0800");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_0800 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_0800","key8","value8");
                await appAccountManager.setAssociatedData("account_name_0800","key8","newvalue8");
            }catch(err){
                console.error("====>setAssociatedData ActsAccountCustomData_0800 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
333
                var data = await appAccountManager.getCustomData("account_name_0800", "key8");
1
15829070344 已提交
334 335
            }
            catch(err){
336
                console.error("====>getCustomData ActsAccountCustomData_0800 err:" + JSON.stringify(err));
1
15829070344 已提交
337 338 339
                expect().assertFail();
                done();
            }
340
            console.debug("====>getCustomData ActsAccountCustomData_0800 data:" + JSON.stringify(data));
1
15829070344 已提交
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
            expect(data).assertEqual("newvalue8");
            console.debug("====>delete account ActsAccountCustomData_0800 start====");
            try{
                await appAccountManager.removeAccount("account_name_0800");
            }
            catch(err){
                console.error("====>delete account 0800 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_0800 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_0900
357
        * @tc.name      : Whether getCustomData can get the correct value when calling setAssociatedData multiple times
1
15829070344 已提交
358
        * @tc.desc      : When the first setAssociatedData is called and the second setAssociatedData
359
        *                 is called,the setting of the value is same if the call getCustomData
1
15829070344 已提交
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
        *                 can get the second value(callback)
        */
        it('ActsAccountCustomData_0900', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_0900 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_0900",(err)=>{
                console.debug("====>add account ActsAccountCustomData_0900 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_0900", "key9", "value9", (err)=>{
                    console.debug("====>setAssociatedData first time 0900 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
                    appAccountManager.setAssociatedData("account_name_0900", "key9", "value9", (err)=>{
                        console.debug("====>setAssociatedData second time 0900 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
375 376 377
                        appAccountManager.getCustomData("account_name_0900", "key9", (err, data)=>{
                            console.debug("====>getCustomData 0900 err:" + JSON.stringify(err));
                            console.debug("====>getCustomData 0900 data:" + JSON.stringify(data));
1
15829070344 已提交
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
                            expect(err).assertEqual(null);
                            expect(data).assertEqual("value9");
                            appAccountManager.removeAccount("account_name_0900", (err)=>{
                                console.debug("====>delete Account 0900 err:" + JSON.stringify(err));
                                expect(err).assertEqual(null);
                                console.debug("====>ActsAccountCustomData_0900 end====");
                                done();
                            });
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_1000
394
        * @tc.name      : Whether getCustomData can get the correct value when calling setAssociatedData multiple times
1
15829070344 已提交
395
        * @tc.desc      : When the first setAssociatedData is called and the second setAssociatedData
396
        *                 is called,the setting of the value is same if the call getCustomData
1
15829070344 已提交
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
        *                 can get the second value(promise)
        */
        it('ActsAccountCustomData_1000', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1000 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>createAccount ActsAccountCustomData_1000 start====");
            try{
                await appAccountManager.createAccount("account_name_1000");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_1000 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_1000", "key10", "value10");
                await appAccountManager.setAssociatedData("account_name_1000", "key10", "value10");
            }
            catch(err){
                console.error("====>setAssociatedData ActsAccountCustomData_1000 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
422
                var data = await appAccountManager.getCustomData("account_name_1000", "key10");
1
15829070344 已提交
423 424
            }
            catch(err){
425
                console.error("====>getCustomData ActsAccountCustomData_1000 err:" + JSON.stringify(err));
1
15829070344 已提交
426 427 428
                expect().assertFail();
                done();
            }
429
            console.debug("====>getCustomData 1000 data:" + JSON.stringify(data));
1
15829070344 已提交
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
            expect(data).assertEqual("value10");
            console.debug("====>delete account ActsAccountCustomData_1000 start====");
            try{
                await appAccountManager.removeAccount("account_name_1000");
            }
            catch(err){
                console.error("====>delete account 1000 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_1000 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_1100
446
        * @tc.name      : Call multiple setAssociatedData calls multiple times getCustomData gets the value separately
1
15829070344 已提交
447
        * @tc.desc      : Call setAssociatedData setting value again after calling setAssociatedData setting
448
        *                 different value, and then call getCustomData twice to get the set value(callback)
1
15829070344 已提交
449 450 451 452 453 454 455 456 457 458 459 460 461 462
        */
        it('ActsAccountCustomData_1100', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1100 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_1100",(err)=>{
                console.debug("====>add account ActsAccountCustomData_1100 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_1100", "key11_first", "value11_first", (err)=>{
                    console.debug("====>setAssociatedData first time 1100 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
                    appAccountManager.setAssociatedData("account_name_1100", "key11_second", "value11_second", (err)=>{
                        console.debug("====>setAssociatedData second time 1100 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
463 464 465
                        appAccountManager.getCustomData("account_name_1100", "key11_first", (err,data)=>{
                            console.debug("====>getCustomData key11_first 1100 err:" + JSON.stringify(err));
                            console.debug("====>getCustomData key11_first 1100 data:" + JSON.stringify(data));
1
15829070344 已提交
466 467
                            expect(err).assertEqual(null);
                            expect(data).assertEqual("value11_first");
468 469 470
                            appAccountManager.getCustomData("account_name_1100", "key11_second", (err,data)=>{
                                console.debug("====>getCustomData key11_second 1100 err:" + JSON.stringify(err));
                                console.debug("====>getCustomData key11_second 1100 data:" + JSON.stringify(data));
1
15829070344 已提交
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
                                expect(err).assertEqual(null);
                                expect(data).assertEqual("value11_second");
                                appAccountManager.removeAccount("account_name_1100", (err)=>{
                                    console.debug("====>delete Account 1100 err:" + JSON.stringify(err));
                                });
                                console.debug("====>ActsAccountCustomData_1100 end====");
                                done();
                            });
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_1200
487
        * @tc.name      : Call multiple setAssociatedData calls multiple times getCustomData gets the value separately
1
15829070344 已提交
488
        * @tc.desc      : Call setAssociatedData setting value again after calling setAssociatedData setting
489
        *                 different value, and then call getCustomData twice to get the set value(promise)
1
15829070344 已提交
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
        */
        it('ActsAccountCustomData_1200', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1200 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>createAccount ActsAccountCustomData_1200 start====");
            try{
                await appAccountManager.createAccount("account_name_1200");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_1200 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_1200", "key12_first", "value12_first");
                await appAccountManager.setAssociatedData("account_name_1200", "key12_second", "value12_second");
            }
            catch(err){
                console.error("====>setAssociatedData ActsAccountCustomData_1200 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
514 515
                var dataFir = await appAccountManager.getCustomData("account_name_1200", "key12_first");
                var dataSec = await appAccountManager.getCustomData("account_name_1200", "key12_second");
1
15829070344 已提交
516 517
            }
            catch(err){
518
                console.error("====>getCustomData ActsAccountCustomData_1200 err:" + JSON.stringify(err));
1
15829070344 已提交
519 520 521
                expect().assertFail();
                done();
            }
522
            console.debug("====>ActsAccountCustomData_1200 getCustomData dataFir:" + JSON.stringify(dataFir));
1
15829070344 已提交
523
            expect(dataFir).assertEqual("value12_first");
524
            console.debug("====>ActsAccountCustomData_1200 getCustomData dataSec:" + JSON.stringify(dataSec));
1
15829070344 已提交
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
            expect(dataSec).assertEqual("value12_second");
            console.debug("====>delete account ActsAccountCustomData_1200 start====");
            try{
                await appAccountManager.removeAccount("account_name_1200");
            }
            catch(err){
                console.error("====>delete account 1200 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_1200 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_1300
        * @tc.name      : setAssociatedData setting value is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting value when the incoming parameter KEY is wrong(callback)
        */
        it('ActsAccountCustomData_1300', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1300 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_1300", (err)=>{
                console.debug("====>add account ActsAccountCustomData_1300 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_1300", "", "value13", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_1300 err:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
                    appAccountManager.removeAccount("account_name_1300", (err)=>{
                        console.debug("====>delete account ActsAccountCustomData_1300 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_1300 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_1400
        * @tc.name      : setAssociatedData setting value is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting value when the incoming parameter KEY is wrong(promise)
        */
        it('ActsAccountCustomData_1400', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1400 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_1400 start====");
            try{
                await appAccountManager.createAccount("account_name_1400");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_1400 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_1400", "", "value14");
            }
            catch(err){
                console.debug("====>setAssociatedData ActsAccountCustomData_1400 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_1400 start====");
                try{
                    await appAccountManager.removeAccount("account_name_1400");
                }
                catch(err){
                    console.error("====>delete account 1400 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_1400 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_1500
        * @tc.name      : setAssociatedData setting key is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting key when the incoming parameter KEY is wrong(callback)
        */
        it('ActsAccountCustomData_1500', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1500 start====");
            var keyOverSize = "K"
            for(var i = 0;i < 256;i++)
            keyOverSize = keyOverSize + "K!@#";
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_1500", (err)=>{
                console.debug("====>add account ActsAccountCustomData_1500 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                console.debug("====>1500 keyOverSize.length:" + JSON.stringify(keyOverSize.length));
                expect(keyOverSize.length).assertEqual(1025);
                appAccountManager.setAssociatedData("account_name_1500", keyOverSize, "value15", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_1500 err:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
                    appAccountManager.removeAccount("account_name_1500", (err)=>{
                        console.debug("====>delete account ActsAccountCustomData_1500 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_1500 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_1600
        * @tc.name      : setAssociatedData setting key is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting key when the incoming parameter KEY is wrong(promise)
        */
        it('ActsAccountCustomData_1600', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1600 start====");
            var keyOverSize = "K"
            for(var i=0;i<256;i++)
            keyOverSize = keyOverSize + "K!@#";
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            expect(keyOverSize.length).assertEqual(1025);
            console.debug("====>add account ActsAccountCustomData_1600 start====");
            try{
                await appAccountManager.createAccount("account_name_1600");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_1600 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_1600", keyOverSize, "value16");
            }
            catch(err){
                console.debug("====>setAssociatedData ActsAccountCustomData_1600 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_1600 start====");
                try{
                    await appAccountManager.removeAccount("account_name_1600");
                }
                catch(err){
                    console.error("====>delete account 1600 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_1600 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_1700
676 677
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming key is a space(callback)
1
15829070344 已提交
678 679 680 681 682 683 684 685 686 687 688
        */
        it('ActsAccountCustomData_1700', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1700 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_1700", (err)=>{
                console.debug("====>add account ActsAccountCustomData_1700 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_1700", " ", "value17", (err)=>{
                    console.debug("====>ActsAccountCustomData_1700 setAssociatedData:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
689 690 691
                    appAccountManager.getCustomData("account_name_1700", " ", (err, data)=>{
                        console.debug("====>getCustomData 1700 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 1700 data:" + JSON.stringify(data));
1
15829070344 已提交
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
                        expect(err).assertEqual(null);
                        expect(data).assertEqual("value17");
                        appAccountManager.removeAccount("account_name_1700", (err)=>{
                            console.debug("====>delete Account 1700 err:" + JSON.stringify(err));
                            expect(err).assertEqual(null);
                            console.debug("====>ActsAccountCustomData_1700 end====");
                            done();
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_1800
707 708
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming key is a space(promise)
1
15829070344 已提交
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
        */
        it('ActsAccountCustomData_1800', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1800 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_1800 start====");
            try{
                await appAccountManager.createAccount("account_name_1800");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_1800 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            await appAccountManager.setAssociatedData("account_name_1800", " ", "value18");
            try{
725
                var data = await appAccountManager.getCustomData("account_name_1800", " ");
1
15829070344 已提交
726 727 728 729 730 731
            }
            catch(err){
                console.error("====>setAssociatedData ActsAccountCustomData_1800 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
732
            console.debug("====>getCustomData ActsAccountCustomData_1800 data:" + JSON.stringify(data));
1
15829070344 已提交
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
            expect(data).assertEqual("value18");
            console.debug("====>delete account ActsAccountCustomData_1800 start====");
            try{
                await appAccountManager.removeAccount("account_name_1800");
            }
            catch(err){
                console.error("====>delete account 1800 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_1800 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_1900
749 750
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming value is null(callback)
1
15829070344 已提交
751 752 753 754 755 756 757 758 759 760 761
        */
        it('ActsAccountCustomData_1900', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_1900 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_1900", (err)=>{
                console.debug("====>add account ActsAccountCustomData_1900 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_1900", "key19", "", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_1900 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
762 763 764
                    appAccountManager.getCustomData("account_name_1900", "key19", (err, data)=>{
                        console.debug("====>getCustomData 1900 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 1900 data:" + JSON.stringify(data));
1
15829070344 已提交
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
                        expect(err).assertEqual(null);
                        expect(data).assertEqual("");
                        appAccountManager.removeAccount("account_name_1900", (err)=>{
                            console.debug("====>delete Account 1900 err:" + JSON.stringify(err));
                            expect(err).assertEqual(null);
                            console.debug("====>ActsAccountCustomData_1900 end====");
                            done();
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_2000
780 781
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming value is null(promise)
1
15829070344 已提交
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804
        */
        it('ActsAccountCustomData_2000', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2000 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_2000 start====");
            try{
                await appAccountManager.createAccount("account_name_2000");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_2000 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_2000", "key20", "");
            }
            catch(err){
                console.error("====>setAssociatedData ActsAccountCustomData_2000 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
805
                var data = await appAccountManager.getCustomData("account_name_2000", "key20");
1
15829070344 已提交
806 807
            }
            catch(err){
808
                console.error("====>getCustomData 2000 err:" + JSON.stringify(err));
1
15829070344 已提交
809 810 811
                expect().assertFail();
                done();
            }
812
            console.debug("====>getCustomData ActsAccountCustomData_2000 data:" + JSON.stringify(data));
1
15829070344 已提交
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
            expect(data).assertEqual("");
            console.debug("====>delete account ActsAccountCustomData_2000 start====");
            try{
                await appAccountManager.removeAccount("account_name_2000");
            }
            catch(err){
                console.error("====>delete account 2000 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_2000 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_2100
        * @tc.name      : setAssociatedData setting value is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting value when the incoming parameter value is wrong(callback)
        */
        it('ActsAccountCustomData_2100', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2100 start====");
            var valueOverSize = "K"
            for(var i = 0;i < 256;i++)
            valueOverSize = valueOverSize + "K!@#";
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_2100",(err)=>{
                console.debug("====>add account ActsAccountCustomData_2100 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                expect(valueOverSize.length).assertEqual(1025);
                appAccountManager.setAssociatedData("account_name_2100", "key21", valueOverSize, (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_2100 err:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
                    appAccountManager.removeAccount("account_name_2100", (err)=>{
                        console.debug("====>delete Account ActsAccountCustomData_2100 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_2100 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_2200
        * @tc.name      : setAssociatedData setting value is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting value when the incoming parameter value is wrong(promise)
        */
        it('ActsAccountCustomData_2200', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2200 start====");
            var valueOverSize = "K"
            for(var i = 0;i < 256;i++)
            valueOverSize = valueOverSize + "K!@#";
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            expect(valueOverSize.length).assertEqual(1025);
            try{
                await appAccountManager.createAccount("account_name_2200");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_2200 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("account_name_2200", "key22", valueOverSize);
            }
            catch(err){
                console.debug("====>setAssociatedData ActsAccountCustomData_2200 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_2200 start====");
                try{
                    await appAccountManager.removeAccount("account_name_2200");
                }
                catch(err){
                    console.error("====>delete account 2200 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_2200 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_2300
899 900
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming value is a space(callback)
1
15829070344 已提交
901 902 903 904 905 906 907 908 909 910 911
        */
        it('ActsAccountCustomData_2300', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2300 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_2300", (err)=>{
                console.debug("====>add account ActsAccountCustomData_2300 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_2300", "key23", " ", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_2300 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
912 913 914
                    appAccountManager.getCustomData("account_name_2300", "key23", (err, data)=>{
                        console.debug("====>getCustomData 2300 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 2300 data:" + JSON.stringify(data));
1
15829070344 已提交
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
                        expect(err).assertEqual(null);
                        expect(data).assertEqual(" ");
                        appAccountManager.removeAccount("account_name_2300", (err)=>{
                            console.debug("====>delete Account 2300 err:" + JSON.stringify(err));
                            expect(err).assertEqual(null);
                            console.debug("====>ActsAccountCustomData_2300 end====");
                            done();
                        });
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_2400
930 931
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming value is a space(promise)
1
15829070344 已提交
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947
        */
        it('ActsAccountCustomData_2400', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2400 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>add account ActsAccountCustomData_2400 start====");
            try{
                await appAccountManager.createAccount("account_name_2400");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_2400 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            await appAccountManager.setAssociatedData("account_name_2400", "key24", " ");
            try{
948
                var data = await appAccountManager.getCustomData("account_name_2400", "key24");
1
15829070344 已提交
949 950
            }
            catch(err){
951
                console.error("====>getCustomData 2400 fail err:" + JSON.stringify(err));
1
15829070344 已提交
952 953 954
                expect().assertFail();
                done();
            }
955
            console.debug("====>getCustomData 2400 err:" + JSON.stringify(data));
1
15829070344 已提交
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
            expect(data).assertEqual(" ");
            console.debug("====>delete account ActsAccountCustomData_2400 start====");
            try{
                await appAccountManager.removeAccount("account_name_2400");
            }
            catch(err){
                console.error("====>delete account 2400 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            console.debug("====>ActsAccountCustomData_2400 end====");
            done();
        });

        /*
        * @tc.number    : ActsAccountCustomData_2500
972 973
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming name is null(callback)
1
15829070344 已提交
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996
        */
        it('ActsAccountCustomData_2500', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2500 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_2500", (err)=>{
                console.debug("====>add account ActsAccountCustomData_2500 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("", "key25", "value25", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_2500 err:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
                    appAccountManager.removeAccount("account_name_2500", (err)=>{
                        console.debug("====>delete Account ActsAccountCustomData_2500 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_2500 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_2600
997 998
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming name is null(promise)
1
15829070344 已提交
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105
        */
        it('ActsAccountCustomData_2600', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2600 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            console.debug("====>ActsAccountCustomData_2600 createAccount start====");
            try{
                await appAccountManager.createAccount("account_name_2600");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_2600 err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData("", "key26", "value26");
            }
            catch(err){
                console.debug("====>setAssociatedData ActsAccountCustomData_2600 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_2600 start====");
                try{
                    await appAccountManager.removeAccount("account_name_2600");
                }
                catch(err){
                    console.error("====>delete account 2600 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_2600 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_2700
        * @tc.name      : setAssociatedData setting name is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting name when the incoming parameter name is wrong(callback)
        */
        it('ActsAccountCustomData_2700', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2700 start====");
            var nameOverSize = "n"
            for(var i = 0;i < 256;i++)
            nameOverSize = nameOverSize+"name";
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_2700",(err)=>{
                console.debug("====>add account ActsAccountCustomData_2700 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                expect(nameOverSize.length).assertEqual(1025);
                appAccountManager.setAssociatedData(nameOverSize, "key27", "value27", (err)=>{
                    console.debug("====>ActsAccountCustomData_2700 setAssociatedData:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
                    appAccountManager.removeAccount("account_name_2700", (err)=>{
                        console.debug("====>delete Account ActsAccountCustomData_2700 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_2700 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_2800
        * @tc.name      : setAssociatedData setting name is called when the argument is wrong
        * @tc.desc      : Call setAssociatedData setting name when the incoming parameter name is wrong(promise)
        */
        it('ActsAccountCustomData_2800', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2800 start====");
            var nameOverSize = "n"
            for(var i = 0;i < 256;i++)
            nameOverSize = nameOverSize + "name";
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            expect(nameOverSize.length).assertEqual(1025);
            console.debug("====>add account ActsAccountCustomData_2800 start====");
            try{
                await appAccountManager.createAccount("account_name_2800");
            }
            catch(err){
                console.error("====>add account ActsAccountCustomData_2800 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
            }
            try{
                await appAccountManager.setAssociatedData(nameOverSize, "key28", "value28");
            }
            catch(err){
                console.debug("====>setAssociatedData ActsAccountCustomData_2800 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                console.debug("====>delete account ActsAccountCustomData_2800 start====");
                try{
                    await appAccountManager.removeAccount("account_name_2800");
                }
                catch(err){
                    console.error("====>delete account 2800 fail err:" + JSON.stringify(err));
                    expect().assertFail();
                    done();
                }
                console.debug("====>ActsAccountCustomData_2800 end====");
                done();
            }
        });

        /*
        * @tc.number    : ActsAccountCustomData_2900
1106 1107
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming name is a space(callback)
1
15829070344 已提交
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118
        */
        it('ActsAccountCustomData_2900', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2900 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount(" ", (err)=>{
                console.debug("====>add account ActsAccountCustomData_2900 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                appAccountManager.setAssociatedData(" ", "key29", "value29", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_2900 err:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
1119 1120 1121
                    appAccountManager.getCustomData(" ", "key29", (err, data)=>{
                        console.debug("====>getCustomData 2900 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 2900 data:" + JSON.stringify(data));
1
15829070344 已提交
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
                        expect(err.code != 0).assertEqual(true);
                        expect(data).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_2900 end====");
                        done();
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_3000
1133 1134
        * @tc.name      : setAssociatedData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setAssociatedData and then getCustomData when the incoming name is a space(promise)
1
15829070344 已提交
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
        */
        it('ActsAccountCustomData_3000', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_3000 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            try{
                await appAccountManager.createAccount(" ");
            }
            catch(err){
                console.debug("====>add account ActsAccountCustomData_3000 err:" + JSON.stringify(err));
                expect(err.code != 0).assertEqual(true);
                try{
                    await appAccountManager.setAssociatedData(" ", "key30", "value30");
                }
                catch(err){
                    console.error("====>setAssociatedData ActsAccountCustomData_3000 err:" + JSON.stringify(err));
                    expect(err.code != 0).assertEqual(true);
                    try{
1153
                        await appAccountManager.getCustomData(" ", "key30");
1
15829070344 已提交
1154 1155
                    }
                    catch(err){
1156
                        console.error("====>getCustomData ActsAccountCustomData_3000 err:" + JSON.stringify(err));
1
15829070344 已提交
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167
                        expect(err.code != 0).assertEqual(true);
                        console.debug("====>ActsAccountCustomData_3000 end====");
                        done();
                    }
                }
            }
        })


        /*
        * @tc.number    : ActsAccountCustomData_3100
1168
        * @tc.name      : The correct calls setAssociatedData and getCustomData get the value
1
15829070344 已提交
1169
        * @tc.desc      : The setAssociatedData setting valueis called when the forwarding parameters
1170
        *                 are correct, and then getCustomData is called for the value(callback)
1
15829070344 已提交
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
        */
        it('ActsAccountCustomData_3100', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_3100 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount("account_name_3100",(err)=>{
                console.debug("====>add ActsAccountCustomData_3100 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
                appAccountManager.setAssociatedData("account_name_3100", "key31", "value31", (err)=>{
                    console.debug("====>setAssociatedData ActsAccountCustomData_3100 err:" + JSON.stringify(err));
                    expect(err).assertEqual(null);
1182 1183
                    var result = appAccountManager.getCustomDataSync("account_name_3100", "key31")
                    console.debug("====>getCustomData ActsAccountCustomData_3100 result:" + JSON.stringify(result));
1
15829070344 已提交
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195
                    expect(result).assertEqual("value31");
                    appAccountManager.removeAccount("account_name_3100", (err)=>{
                        console.debug("====>delete Account 0100 err:" + JSON.stringify(err));
                        expect(err).assertEqual(null);
                        console.debug("====>ActsAccountCustomData_3100 end====");
                        done();
                    });
                });
            });
        });
    })
}