CustomData.test.js 61.5 KB
Newer Older
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 48
        * @tc.name      : The correct calls setCustomData and getCustomData get the value
        * @tc.desc      : The setCustomData setting valueis called when the forwarding parameters
49
        *                 are correct, and then getCustomData is called for the value(callback)
50 51 52 53 54 55 56 57
        */
        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);
58 59
                appAccountManager.setCustomData("account_name_0100", "key1", "value1", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_0100 err:" + JSON.stringify(err));
60
                    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));
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 80
        * @tc.name      : The correct calls setCustomData and getCustomData get the value
        * @tc.desc      : The setCustomData setting value is called when the forwarding parameters
81
        *                 are correct, and then getCustomData is called for the value(promise)
82 83 84 85 86 87 88 89 90 91 92 93 94 95
        */
        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();
            }
96
            console.debug("====>setCustomData ActsAccountCustomData_0200 start====");
97
            try{
98
                await appAccountManager.setCustomData("account_name_0200", "key2", "value2");
99 100
            }
            catch(err){
101
                console.error("====>setCustomData ActsAccountCustomData_0200 err:" + JSON.stringify(err));
102 103 104
                expect().assertFail();
                done();
            }
105
            console.debug("====>getCustomData ActsAccountCustomData_0200 start====");
106
            try{
107
                var data = await appAccountManager.getCustomData("account_name_0200", "key2");
108 109
            }
            catch(err){
110
                console.error("====>getCustomData ActsAccountCustomData_0200 err:" + JSON.stringify(err));
111 112 113
                expect().assertFail();
                done();
            }
114
            console.debug("====>getCustomData ActsAccountCustomData_0200 data:" + JSON.stringify(data));
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 setCustomData(callback)
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));
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 setCustomData(promise)
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====");
177 178 179 180
                expect().assertFail();
                done();
            }
            catch(err){
181
                console.debug("====>getCustomData ActsAccountCustomData_0400 err:" + JSON.stringify(err));
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
200
        * @tc.desc      : After calling setCustomData setting value correctly,
201
        *                 call the getCustomData of the pass error to check if you get the value(callback)
202 203 204 205 206 207 208 209
        */
        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);
210 211
                appAccountManager.setCustomData("account_name_0500", "key5", "value5", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_0500 err:" + JSON.stringify(err));
212
                    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));
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
231
        * @tc.desc      : After calling setCustomData setting value correctly,
232
        *                 call the getCustomData of the pass error to check if you get the value(promise)
233 234 235 236 237 238 239 240 241 242 243 244 245 246
        */
        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();
            }
247
            await appAccountManager.setCustomData("account_name_0600", "key6", "value6");
248
            try{
249
                var data = await appAccountManager.getCustomData("account_name_0600", "keyerr");
250 251
            }
            catch(err){
252
                console.debug("====>getCustomData 0600 err:" + JSON.stringify(err));
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 271
        * @tc.name      : Whether getCustomData can get the correct value when calling setCustomData multiple times
        * @tc.desc      : When the first setCustomData is called and the second setCustomData
272
        *                 is called,the setting of the value is different if the call getCustomData
273 274 275 276 277 278 279 280 281
        *                 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);
282 283
                appAccountManager.setCustomData("account_name_0700", "key7", "value7", (err)=>{
                    console.debug("====>setCustomDatafir first time 0700 err:" + JSON.stringify(err));
284
                    expect(err).assertEqual(null);
285 286
                    appAccountManager.setCustomData("account_name_0700", "key7", "newvalue7", (err)=>{
                        console.debug("====>setCustomDatafir second time 0700 err:" + JSON.stringify(err));
287
                        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));
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 308
        * @tc.name      : Whether getCustomData can get the correct value when calling setCustomData multiple times
        * @tc.desc      : When the first setCustomData is called and the second setCustomData
309
        *                 is called,the setting of the value is different if the call getCustomData
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
        *                 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{
325 326
                await appAccountManager.setCustomData("account_name_0800","key8","value8");
                await appAccountManager.setCustomData("account_name_0800","key8","newvalue8");
327
            }catch(err){
328
                console.error("====>setCustomData ActsAccountCustomData_0800 err:" + JSON.stringify(err));
329 330 331 332
                expect().assertFail();
                done();
            }
            try{
333
                var data = await appAccountManager.getCustomData("account_name_0800", "key8");
334 335
            }
            catch(err){
336
                console.error("====>getCustomData ActsAccountCustomData_0800 err:" + JSON.stringify(err));
337 338 339
                expect().assertFail();
                done();
            }
340
            console.debug("====>getCustomData ActsAccountCustomData_0800 data:" + JSON.stringify(data));
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 358
        * @tc.name      : Whether getCustomData can get the correct value when calling setCustomData multiple times
        * @tc.desc      : When the first setCustomData is called and the second setCustomData
359
        *                 is called,the setting of the value is same if the call getCustomData
360 361 362 363 364 365 366 367 368
        *                 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);
369 370
                appAccountManager.setCustomData("account_name_0900", "key9", "value9", (err)=>{
                    console.debug("====>setCustomData first time 0900 err:" + JSON.stringify(err));
371
                    expect(err).assertEqual(null);
372 373
                    appAccountManager.setCustomData("account_name_0900", "key9", "value9", (err)=>{
                        console.debug("====>setCustomData second time 0900 err:" + JSON.stringify(err));
374
                        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));
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 395
        * @tc.name      : Whether getCustomData can get the correct value when calling setCustomData multiple times
        * @tc.desc      : When the first setCustomData is called and the second setCustomData
396
        *                 is called,the setting of the value is same if the call getCustomData
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
        *                 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{
413 414
                await appAccountManager.setCustomData("account_name_1000", "key10", "value10");
                await appAccountManager.setCustomData("account_name_1000", "key10", "value10");
415 416
            }
            catch(err){
417
                console.error("====>setCustomData ActsAccountCustomData_1000 err:" + JSON.stringify(err));
418 419 420 421
                expect().assertFail();
                done();
            }
            try{
422
                var data = await appAccountManager.getCustomData("account_name_1000", "key10");
423 424
            }
            catch(err){
425
                console.error("====>getCustomData ActsAccountCustomData_1000 err:" + JSON.stringify(err));
426 427 428
                expect().assertFail();
                done();
            }
429
            console.debug("====>getCustomData 1000 data:" + JSON.stringify(data));
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 447
        * @tc.name      : Call multiple setCustomData calls multiple times getCustomData gets the value separately
        * @tc.desc      : Call setCustomData setting value again after calling setCustomData setting
448
        *                 different value, and then call getCustomData twice to get the set value(callback)
449 450 451 452 453 454 455 456
        */
        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);
457 458
                appAccountManager.setCustomData("account_name_1100", "key11_first", "value11_first", (err)=>{
                    console.debug("====>setCustomData first time 1100 err:" + JSON.stringify(err));
459
                    expect(err).assertEqual(null);
460 461
                    appAccountManager.setCustomData("account_name_1100", "key11_second", "value11_second", (err)=>{
                        console.debug("====>setCustomData second time 1100 err:" + JSON.stringify(err));
462
                        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));
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));
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 488
        * @tc.name      : Call multiple setCustomData calls multiple times getCustomData gets the value separately
        * @tc.desc      : Call setCustomData setting value again after calling setCustomData setting
489
        *                 different value, and then call getCustomData twice to get the set value(promise)
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
        */
        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{
505 506
                await appAccountManager.setCustomData("account_name_1200", "key12_first", "value12_first");
                await appAccountManager.setCustomData("account_name_1200", "key12_second", "value12_second");
507 508
            }
            catch(err){
509
                console.error("====>setCustomData ActsAccountCustomData_1200 err:" + JSON.stringify(err));
510 511 512 513
                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");
516 517
            }
            catch(err){
518
                console.error("====>getCustomData ActsAccountCustomData_1200 err:" + JSON.stringify(err));
519 520 521
                expect().assertFail();
                done();
            }
522
            console.debug("====>ActsAccountCustomData_1200 getCustomData dataFir:" + JSON.stringify(dataFir));
523
            expect(dataFir).assertEqual("value12_first");
524
            console.debug("====>ActsAccountCustomData_1200 getCustomData dataSec:" + JSON.stringify(dataSec));
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
            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
541 542
        * @tc.name      : setCustomData setting value is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting value when the incoming parameter KEY is wrong(callback)
543 544 545 546 547 548 549 550
        */
        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);
551 552
                appAccountManager.setCustomData("account_name_1300", "", "value13", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_1300 err:" + JSON.stringify(err));
553 554 555 556 557 558 559 560 561 562 563 564 565
                    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
566 567
        * @tc.name      : setCustomData setting value is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting value when the incoming parameter KEY is wrong(promise)
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
        */
        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{
583
                await appAccountManager.setCustomData("account_name_1400", "", "value14");
584 585
            }
            catch(err){
586
                console.debug("====>setCustomData ActsAccountCustomData_1400 err:" + JSON.stringify(err));
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
                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
604 605
        * @tc.name      : setCustomData setting key is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting key when the incoming parameter KEY is wrong(callback)
606 607 608 609 610 611 612 613 614 615 616 617 618
        */
        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);
619 620
                appAccountManager.setCustomData("account_name_1500", keyOverSize, "value15", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_1500 err:" + JSON.stringify(err));
621 622 623 624 625 626 627 628 629 630 631 632 633
                    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
634 635
        * @tc.name      : setCustomData setting key is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting key when the incoming parameter KEY is wrong(promise)
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
        */
        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{
655
                await appAccountManager.setCustomData("account_name_1600", keyOverSize, "value16");
656 657
            }
            catch(err){
658
                console.debug("====>setCustomData ActsAccountCustomData_1600 err:" + JSON.stringify(err));
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
                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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming key is a space(callback)
678 679 680 681 682 683 684 685
        */
        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);
686 687
                appAccountManager.setCustomData("account_name_1700", " ", "value17", (err)=>{
                    console.debug("====>ActsAccountCustomData_1700 setCustomData:" + JSON.stringify(err));
688
                    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));
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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming key is a space(promise)
709 710 711 712 713 714 715 716 717 718 719 720 721 722
        */
        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();
            }
723
            await appAccountManager.setCustomData("account_name_1800", " ", "value18");
724
            try{
725
                var data = await appAccountManager.getCustomData("account_name_1800", " ");
726 727
            }
            catch(err){
728
                console.error("====>setCustomData ActsAccountCustomData_1800 fail err:" + JSON.stringify(err));
729 730 731
                expect().assertFail();
                done();
            }
732
            console.debug("====>getCustomData ActsAccountCustomData_1800 data:" + JSON.stringify(data));
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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming value is null(callback)
751 752 753 754 755 756 757 758
        */
        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);
759 760
                appAccountManager.setCustomData("account_name_1900", "key19", "", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_1900 err:" + JSON.stringify(err));
761
                    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));
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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming value is null(promise)
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796
        */
        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{
797
                await appAccountManager.setCustomData("account_name_2000", "key20", "");
798 799
            }
            catch(err){
800
                console.error("====>setCustomData ActsAccountCustomData_2000 err:" + JSON.stringify(err));
801 802 803 804
                expect().assertFail();
                done();
            }
            try{
805
                var data = await appAccountManager.getCustomData("account_name_2000", "key20");
806 807
            }
            catch(err){
808
                console.error("====>getCustomData 2000 err:" + JSON.stringify(err));
809 810 811
                expect().assertFail();
                done();
            }
812
            console.debug("====>getCustomData ActsAccountCustomData_2000 data:" + JSON.stringify(data));
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
            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
829 830
        * @tc.name      : setCustomData setting value is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting value when the incoming parameter value is wrong(callback)
831 832 833 834 835 836 837 838 839 840 841 842
        */
        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);
843 844
                appAccountManager.setCustomData("account_name_2100", "key21", valueOverSize, (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2100 err:" + JSON.stringify(err));
845 846 847 848 849 850 851 852 853 854 855 856 857
                    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
858 859
        * @tc.name      : setCustomData setting value is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting value when the incoming parameter value is wrong(promise)
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877
        */
        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{
878
                await appAccountManager.setCustomData("account_name_2200", "key22", valueOverSize);
879 880
            }
            catch(err){
881
                console.debug("====>setCustomData ActsAccountCustomData_2200 err:" + JSON.stringify(err));
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
                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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming value is a space(callback)
901 902 903 904 905 906 907 908
        */
        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);
909 910
                appAccountManager.setCustomData("account_name_2300", "key23", " ", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2300 err:" + JSON.stringify(err));
911
                    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));
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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming value is a space(promise)
932 933 934 935 936 937 938 939 940 941 942 943 944 945
        */
        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();
            }
946
            await appAccountManager.setCustomData("account_name_2400", "key24", " ");
947
            try{
948
                var data = await appAccountManager.getCustomData("account_name_2400", "key24");
949 950
            }
            catch(err){
951
                console.error("====>getCustomData 2400 fail err:" + JSON.stringify(err));
952 953 954
                expect().assertFail();
                done();
            }
955
            console.debug("====>getCustomData 2400 err:" + JSON.stringify(data));
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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming name is null(callback)
974 975 976 977 978 979 980 981
        */
        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);
982 983
                appAccountManager.setCustomData("", "key25", "value25", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2500 err:" + JSON.stringify(err));
984 985 986 987 988 989 990 991 992 993 994 995 996
                    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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming name is null(promise)
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
        */
        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{
1014
                await appAccountManager.setCustomData("", "key26", "value26");
1015 1016
            }
            catch(err){
1017
                console.debug("====>setCustomData ActsAccountCustomData_2600 err:" + JSON.stringify(err));
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
                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
1035 1036
        * @tc.name      : setCustomData setting name is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting name when the incoming parameter name is wrong(callback)
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
        */
        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);
1049 1050
                appAccountManager.setCustomData(nameOverSize, "key27", "value27", (err)=>{
                    console.debug("====>ActsAccountCustomData_2700 setCustomData:" + JSON.stringify(err));
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
                    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
1064 1065
        * @tc.name      : setCustomData setting name is called when the argument is wrong
        * @tc.desc      : Call setCustomData setting name when the incoming parameter name is wrong(promise)
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084
        */
        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{
1085
                await appAccountManager.setCustomData(nameOverSize, "key28", "value28");
1086 1087
            }
            catch(err){
1088
                console.debug("====>setCustomData ActsAccountCustomData_2800 err:" + JSON.stringify(err));
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105
                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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming name is a space(callback)
1108 1109 1110 1111 1112 1113 1114 1115
        */
        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);
1116 1117
                appAccountManager.setCustomData(" ", "key29", "value29", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2900 err:" + JSON.stringify(err));
1118
                    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));
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      : setCustomData and getCustomData are called when the argument is spaced
        * @tc.desc      : Call setCustomData and then getCustomData when the incoming name is a space(promise)
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146
        */
        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{
1147
                    await appAccountManager.setCustomData(" ", "key30", "value30");
1148 1149
                }
                catch(err){
1150
                    console.error("====>setCustomData ActsAccountCustomData_3000 err:" + JSON.stringify(err));
1151 1152
                    expect(err.code != 0).assertEqual(true);
                    try{
1153
                        await appAccountManager.getCustomData(" ", "key30");
1154 1155
                    }
                    catch(err){
1156
                        console.error("====>getCustomData ActsAccountCustomData_3000 err:" + JSON.stringify(err));
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 1169
        * @tc.name      : The correct calls setCustomData and getCustomData get the value
        * @tc.desc      : The setCustomData setting valueis called when the forwarding parameters
1170
        *                 are correct, and then getCustomData is called for the value(callback)
1171 1172 1173 1174 1175 1176 1177 1178
        */
        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);
1179 1180
                appAccountManager.setCustomData("account_name_3100", "key31", "value31", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_3100 err:" + JSON.stringify(err));
1181
                    expect(err).assertEqual(null);
1182 1183
                    var result = appAccountManager.getCustomDataSync("account_name_3100", "key31")
                    console.debug("====>getCustomData ActsAccountCustomData_3100 result:" + JSON.stringify(result));
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();
                    });
                });
            });
        });
    })
}