CustomData.test.js 60.6 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
/*
 * 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'

export default function ActsAccountCustomData() {
    describe('ActsAccountCustomData', function () {

        /*
        * @tc.number    : ActsAccountCustomData_0100
23 24
        * @tc.name      : The correct calls setCustomData and getCustomData get the value
        * @tc.desc      : The setCustomData setting valueis called when the forwarding parameters
25
        *                 are correct, and then getCustomData is called for the value(callback)
1
15829070344 已提交
26 27 28 29 30 31 32 33
        */
        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);
34 35
                appAccountManager.setCustomData("account_name_0100", "key1", "value1", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_0100 err:" + JSON.stringify(err));
1
15829070344 已提交
36
                    expect(err).assertEqual(null);
37 38 39
                    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 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
                        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
55 56
        * @tc.name      : The correct calls setCustomData and getCustomData get the value
        * @tc.desc      : The setCustomData setting value is called when the forwarding parameters
57
        *                 are correct, and then getCustomData is called for the value(promise)
1
15829070344 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71
        */
        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();
            }
72
            console.debug("====>setCustomData ActsAccountCustomData_0200 start====");
1
15829070344 已提交
73
            try{
74
                await appAccountManager.setCustomData("account_name_0200", "key2", "value2");
1
15829070344 已提交
75 76
            }
            catch(err){
77
                console.error("====>setCustomData ActsAccountCustomData_0200 err:" + JSON.stringify(err));
1
15829070344 已提交
78 79 80
                expect().assertFail();
                done();
            }
81
            console.debug("====>getCustomData ActsAccountCustomData_0200 start====");
1
15829070344 已提交
82
            try{
83
                var data = await appAccountManager.getCustomData("account_name_0200", "key2");
1
15829070344 已提交
84 85
            }
            catch(err){
86
                console.error("====>getCustomData ActsAccountCustomData_0200 err:" + JSON.stringify(err));
1
15829070344 已提交
87 88 89
                expect().assertFail();
                done();
            }
90
            console.debug("====>getCustomData ActsAccountCustomData_0200 data:" + JSON.stringify(data));
1
15829070344 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
            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
108
        * @tc.desc      : Call getCustomData directly to get value without calling setCustomData(callback)
1
15829070344 已提交
109 110 111 112 113 114 115 116
        */
        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);
117 118 119
                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 已提交
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
                    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
135
        * @tc.desc      : Call getCustomData directly to get value without calling setCustomData(promise)
1
15829070344 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
        */
        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{
151 152
                await appAccountManager.getCustomData("account_name_0400", "key4");
                console.error("====>getCustomData fail ActsAccountCustomData_0400====");
1
15829070344 已提交
153 154 155 156
                expect().assertFail();
                done();
            }
            catch(err){
157
                console.debug("====>getCustomData ActsAccountCustomData_0400 err:" + JSON.stringify(err));
1
15829070344 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
                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
175
        * @tc.name      : Call getCustomData to get value when passing in the error parameter
176
        * @tc.desc      : After calling setCustomData setting value correctly,
177
        *                 call the getCustomData of the pass error to check if you get the value(callback)
1
15829070344 已提交
178 179 180 181 182 183 184 185
        */
        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);
186 187
                appAccountManager.setCustomData("account_name_0500", "key5", "value5", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_0500 err:" + JSON.stringify(err));
1
15829070344 已提交
188
                    expect(err).assertEqual(null);
189 190 191
                    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 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204 205
                        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
206
        * @tc.name      : Call getCustomData to get value when passing in the error parameter
207
        * @tc.desc      : After calling setCustomData setting value correctly,
208
        *                 call the getCustomData of the pass error to check if you get the value(promise)
1
15829070344 已提交
209 210 211 212 213 214 215 216 217 218 219 220 221 222
        */
        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();
            }
223
            await appAccountManager.setCustomData("account_name_0600", "key6", "value6");
1
15829070344 已提交
224
            try{
225
                var data = await appAccountManager.getCustomData("account_name_0600", "keyerr");
1
15829070344 已提交
226 227
            }
            catch(err){
228
                console.debug("====>getCustomData 0600 err:" + JSON.stringify(err));
1
15829070344 已提交
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
                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
246 247
        * @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
248
        *                 is called,the setting of the value is different if the call getCustomData
1
15829070344 已提交
249 250 251 252 253 254 255 256 257
        *                 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);
258 259
                appAccountManager.setCustomData("account_name_0700", "key7", "value7", (err)=>{
                    console.debug("====>setCustomDatafir first time 0700 err:" + JSON.stringify(err));
1
15829070344 已提交
260
                    expect(err).assertEqual(null);
261 262
                    appAccountManager.setCustomData("account_name_0700", "key7", "newvalue7", (err)=>{
                        console.debug("====>setCustomDatafir second time 0700 err:" + JSON.stringify(err));
1
15829070344 已提交
263
                        expect(err).assertEqual(null);
264 265 266
                        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 已提交
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
                            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
283 284
        * @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
285
        *                 is called,the setting of the value is different if the call getCustomData
1
15829070344 已提交
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
        *                 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{
301 302
                await appAccountManager.setCustomData("account_name_0800","key8","value8");
                await appAccountManager.setCustomData("account_name_0800","key8","newvalue8");
1
15829070344 已提交
303
            }catch(err){
304
                console.error("====>setCustomData ActsAccountCustomData_0800 err:" + JSON.stringify(err));
1
15829070344 已提交
305 306 307 308
                expect().assertFail();
                done();
            }
            try{
309
                var data = await appAccountManager.getCustomData("account_name_0800", "key8");
1
15829070344 已提交
310 311
            }
            catch(err){
312
                console.error("====>getCustomData ActsAccountCustomData_0800 err:" + JSON.stringify(err));
1
15829070344 已提交
313 314 315
                expect().assertFail();
                done();
            }
316
            console.debug("====>getCustomData ActsAccountCustomData_0800 data:" + JSON.stringify(data));
1
15829070344 已提交
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
            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
333 334
        * @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
335
        *                 is called,the setting of the value is same if the call getCustomData
1
15829070344 已提交
336 337 338 339 340 341 342 343 344
        *                 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);
345 346
                appAccountManager.setCustomData("account_name_0900", "key9", "value9", (err)=>{
                    console.debug("====>setCustomData first time 0900 err:" + JSON.stringify(err));
1
15829070344 已提交
347
                    expect(err).assertEqual(null);
348 349
                    appAccountManager.setCustomData("account_name_0900", "key9", "value9", (err)=>{
                        console.debug("====>setCustomData second time 0900 err:" + JSON.stringify(err));
1
15829070344 已提交
350
                        expect(err).assertEqual(null);
351 352 353
                        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 已提交
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
                            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
370 371
        * @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
372
        *                 is called,the setting of the value is same if the call getCustomData
1
15829070344 已提交
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
        *                 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{
389 390
                await appAccountManager.setCustomData("account_name_1000", "key10", "value10");
                await appAccountManager.setCustomData("account_name_1000", "key10", "value10");
1
15829070344 已提交
391 392
            }
            catch(err){
393
                console.error("====>setCustomData ActsAccountCustomData_1000 err:" + JSON.stringify(err));
1
15829070344 已提交
394 395 396 397
                expect().assertFail();
                done();
            }
            try{
398
                var data = await appAccountManager.getCustomData("account_name_1000", "key10");
1
15829070344 已提交
399 400
            }
            catch(err){
401
                console.error("====>getCustomData ActsAccountCustomData_1000 err:" + JSON.stringify(err));
1
15829070344 已提交
402 403 404
                expect().assertFail();
                done();
            }
405
            console.debug("====>getCustomData 1000 data:" + JSON.stringify(data));
1
15829070344 已提交
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
            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
422 423
        * @tc.name      : Call multiple setCustomData calls multiple times getCustomData gets the value separately
        * @tc.desc      : Call setCustomData setting value again after calling setCustomData setting
424
        *                 different value, and then call getCustomData twice to get the set value(callback)
1
15829070344 已提交
425 426 427 428 429 430 431 432
        */
        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);
433 434
                appAccountManager.setCustomData("account_name_1100", "key11_first", "value11_first", (err)=>{
                    console.debug("====>setCustomData first time 1100 err:" + JSON.stringify(err));
1
15829070344 已提交
435
                    expect(err).assertEqual(null);
436 437
                    appAccountManager.setCustomData("account_name_1100", "key11_second", "value11_second", (err)=>{
                        console.debug("====>setCustomData second time 1100 err:" + JSON.stringify(err));
1
15829070344 已提交
438
                        expect(err).assertEqual(null);
439 440 441
                        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 已提交
442 443
                            expect(err).assertEqual(null);
                            expect(data).assertEqual("value11_first");
444 445 446
                            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 已提交
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
                                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
463 464
        * @tc.name      : Call multiple setCustomData calls multiple times getCustomData gets the value separately
        * @tc.desc      : Call setCustomData setting value again after calling setCustomData setting
465
        *                 different value, and then call getCustomData twice to get the set value(promise)
1
15829070344 已提交
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
        */
        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{
481 482
                await appAccountManager.setCustomData("account_name_1200", "key12_first", "value12_first");
                await appAccountManager.setCustomData("account_name_1200", "key12_second", "value12_second");
1
15829070344 已提交
483 484
            }
            catch(err){
485
                console.error("====>setCustomData ActsAccountCustomData_1200 err:" + JSON.stringify(err));
1
15829070344 已提交
486 487 488 489
                expect().assertFail();
                done();
            }
            try{
490 491
                var dataFir = await appAccountManager.getCustomData("account_name_1200", "key12_first");
                var dataSec = await appAccountManager.getCustomData("account_name_1200", "key12_second");
1
15829070344 已提交
492 493
            }
            catch(err){
494
                console.error("====>getCustomData ActsAccountCustomData_1200 err:" + JSON.stringify(err));
1
15829070344 已提交
495 496 497
                expect().assertFail();
                done();
            }
498
            console.debug("====>ActsAccountCustomData_1200 getCustomData dataFir:" + JSON.stringify(dataFir));
1
15829070344 已提交
499
            expect(dataFir).assertEqual("value12_first");
500
            console.debug("====>ActsAccountCustomData_1200 getCustomData dataSec:" + JSON.stringify(dataSec));
1
15829070344 已提交
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
            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
517 518
        * @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)
1
15829070344 已提交
519 520 521 522 523 524 525 526
        */
        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);
527 528
                appAccountManager.setCustomData("account_name_1300", "", "value13", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_1300 err:" + JSON.stringify(err));
1
15829070344 已提交
529 530 531 532 533 534 535 536 537 538 539 540 541
                    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
542 543
        * @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)
1
15829070344 已提交
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
        */
        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{
559
                await appAccountManager.setCustomData("account_name_1400", "", "value14");
1
15829070344 已提交
560 561
            }
            catch(err){
562
                console.debug("====>setCustomData ActsAccountCustomData_1400 err:" + JSON.stringify(err));
1
15829070344 已提交
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
                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
580 581
        * @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)
1
15829070344 已提交
582 583 584 585 586 587 588 589 590 591 592 593 594
        */
        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);
595 596
                appAccountManager.setCustomData("account_name_1500", keyOverSize, "value15", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_1500 err:" + JSON.stringify(err));
1
15829070344 已提交
597 598 599 600 601 602 603 604 605 606 607 608 609
                    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
610 611
        * @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)
1
15829070344 已提交
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
        */
        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{
631
                await appAccountManager.setCustomData("account_name_1600", keyOverSize, "value16");
1
15829070344 已提交
632 633
            }
            catch(err){
634
                console.debug("====>setCustomData ActsAccountCustomData_1600 err:" + JSON.stringify(err));
1
15829070344 已提交
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
                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
652 653
        * @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)
1
15829070344 已提交
654 655 656 657 658 659 660 661
        */
        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);
662 663
                appAccountManager.setCustomData("account_name_1700", " ", "value17", (err)=>{
                    console.debug("====>ActsAccountCustomData_1700 setCustomData:" + JSON.stringify(err));
1
15829070344 已提交
664
                    expect(err).assertEqual(null);
665 666 667
                    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 已提交
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682
                        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
683 684
        * @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)
1
15829070344 已提交
685 686 687 688 689 690 691 692 693 694 695 696 697 698
        */
        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();
            }
699
            await appAccountManager.setCustomData("account_name_1800", " ", "value18");
1
15829070344 已提交
700
            try{
701
                var data = await appAccountManager.getCustomData("account_name_1800", " ");
1
15829070344 已提交
702 703
            }
            catch(err){
704
                console.error("====>setCustomData ActsAccountCustomData_1800 fail err:" + JSON.stringify(err));
1
15829070344 已提交
705 706 707
                expect().assertFail();
                done();
            }
708
            console.debug("====>getCustomData ActsAccountCustomData_1800 data:" + JSON.stringify(data));
1
15829070344 已提交
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
            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
725 726
        * @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)
1
15829070344 已提交
727 728 729 730 731 732 733 734
        */
        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);
735 736
                appAccountManager.setCustomData("account_name_1900", "key19", "", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_1900 err:" + JSON.stringify(err));
1
15829070344 已提交
737
                    expect(err).assertEqual(null);
738 739 740
                    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 已提交
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
                        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
756 757
        * @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)
1
15829070344 已提交
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
        */
        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{
773
                await appAccountManager.setCustomData("account_name_2000", "key20", "");
1
15829070344 已提交
774 775
            }
            catch(err){
776
                console.error("====>setCustomData ActsAccountCustomData_2000 err:" + JSON.stringify(err));
1
15829070344 已提交
777 778 779 780
                expect().assertFail();
                done();
            }
            try{
781
                var data = await appAccountManager.getCustomData("account_name_2000", "key20");
1
15829070344 已提交
782 783
            }
            catch(err){
784
                console.error("====>getCustomData 2000 err:" + JSON.stringify(err));
1
15829070344 已提交
785 786 787
                expect().assertFail();
                done();
            }
788
            console.debug("====>getCustomData ActsAccountCustomData_2000 data:" + JSON.stringify(data));
1
15829070344 已提交
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804
            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
805 806
        * @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)
1
15829070344 已提交
807 808 809 810 811 812 813 814 815 816 817 818
        */
        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);
819 820
                appAccountManager.setCustomData("account_name_2100", "key21", valueOverSize, (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2100 err:" + JSON.stringify(err));
1
15829070344 已提交
821 822 823 824 825 826 827 828 829 830 831 832 833
                    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
834 835
        * @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)
1
15829070344 已提交
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853
        */
        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{
854
                await appAccountManager.setCustomData("account_name_2200", "key22", valueOverSize);
1
15829070344 已提交
855 856
            }
            catch(err){
857
                console.debug("====>setCustomData ActsAccountCustomData_2200 err:" + JSON.stringify(err));
1
15829070344 已提交
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
                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
875 876
        * @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)
1
15829070344 已提交
877 878 879 880 881 882 883 884
        */
        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);
885 886
                appAccountManager.setCustomData("account_name_2300", "key23", " ", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2300 err:" + JSON.stringify(err));
1
15829070344 已提交
887
                    expect(err).assertEqual(null);
888 889 890
                    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 已提交
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905
                        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
906 907
        * @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)
1
15829070344 已提交
908 909 910 911 912 913 914 915 916 917 918 919 920 921
        */
        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();
            }
922
            await appAccountManager.setCustomData("account_name_2400", "key24", " ");
1
15829070344 已提交
923
            try{
924
                var data = await appAccountManager.getCustomData("account_name_2400", "key24");
1
15829070344 已提交
925 926
            }
            catch(err){
927
                console.error("====>getCustomData 2400 fail err:" + JSON.stringify(err));
1
15829070344 已提交
928 929 930
                expect().assertFail();
                done();
            }
931
            console.debug("====>getCustomData 2400 err:" + JSON.stringify(data));
1
15829070344 已提交
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947
            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
948 949
        * @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)
1
15829070344 已提交
950 951 952 953 954 955 956 957
        */
        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);
958 959
                appAccountManager.setCustomData("", "key25", "value25", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2500 err:" + JSON.stringify(err));
1
15829070344 已提交
960 961 962 963 964 965 966 967 968 969 970 971 972
                    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
973 974
        * @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)
1
15829070344 已提交
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989
        */
        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{
990
                await appAccountManager.setCustomData("", "key26", "value26");
1
15829070344 已提交
991 992
            }
            catch(err){
993
                console.debug("====>setCustomData ActsAccountCustomData_2600 err:" + JSON.stringify(err));
1
15829070344 已提交
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
                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
1011 1012
        * @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)
1
15829070344 已提交
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
        */
        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);
1025 1026
                appAccountManager.setCustomData(nameOverSize, "key27", "value27", (err)=>{
                    console.debug("====>ActsAccountCustomData_2700 setCustomData:" + JSON.stringify(err));
1
15829070344 已提交
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039
                    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
1040 1041
        * @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)
1
15829070344 已提交
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060
        */
        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{
1061
                await appAccountManager.setCustomData(nameOverSize, "key28", "value28");
1
15829070344 已提交
1062 1063
            }
            catch(err){
1064
                console.debug("====>setCustomData ActsAccountCustomData_2800 err:" + JSON.stringify(err));
1
15829070344 已提交
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081
                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
1082 1083
        * @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)
1
15829070344 已提交
1084 1085 1086 1087 1088 1089
        */
        it('ActsAccountCustomData_2900', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_2900 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
            appAccountManager.createAccount(" ", (err)=>{
1090 1091
                console.debug("====>createAccount ActsAccountCustomData_2900 err:" + JSON.stringify(err));
                expect(err).assertEqual(null);
1092 1093
                appAccountManager.setCustomData(" ", "key29", "value29", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_2900 err:" + JSON.stringify(err));
1094
                    expect(err).assertEqual(null);
1095 1096 1097
                    appAccountManager.getCustomData(" ", "key29", (err, data)=>{
                        console.debug("====>getCustomData 2900 err:" + JSON.stringify(err));
                        console.debug("====>getCustomData 2900 data:" + JSON.stringify(data));
1098 1099 1100 1101 1102 1103 1104
                        expect(err).assertEqual(null);
                        expect(data).assertEqual("value29");
                        appAccountManager.removeAccount(" ", (err)=>{
                            console.error("====>removeAccount ActsAccountCustomData_2900 err:" + JSON.stringify(err));
                            expect(err).assertEqual(null);
                            done();
                        });
1
15829070344 已提交
1105 1106 1107 1108 1109 1110 1111
                    });
                });
            });
        });

        /*
        * @tc.number    : ActsAccountCustomData_3000
1112 1113
        * @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)
1
15829070344 已提交
1114 1115 1116 1117 1118
        */
        it('ActsAccountCustomData_3000', 0, async function (done) {
            console.debug("====>ActsAccountCustomData_3000 start====");
            var appAccountManager = account.createAppAccountManager();
            console.debug("====>creat finish====");
1119
            try {
1
15829070344 已提交
1120
                await appAccountManager.createAccount(" ");
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130
                await appAccountManager.setCustomData(" ", "key30", "value30");
                var data = await appAccountManager.getCustomData(" ", "key30");
                console.error("====>getCustomData ActsAccountCustomData_3000 data:" + JSON.stringify(data));
                expect(data).assertEqual("value30");
                await appAccountManager.removeAccount(" ");
                done();
            } catch (err) {
                console.error("====>ActsAccountCustomData_3000 fail err:" + JSON.stringify(err));
                expect().assertFail();
                done();
1
15829070344 已提交
1131 1132 1133 1134 1135 1136
            }
        })


        /*
        * @tc.number    : ActsAccountCustomData_3100
1137 1138
        * @tc.name      : The correct calls setCustomData and getCustomData get the value
        * @tc.desc      : The setCustomData setting valueis called when the forwarding parameters
1139
        *                 are correct, and then getCustomData is called for the value(callback)
1
15829070344 已提交
1140 1141 1142 1143 1144 1145 1146 1147
        */
        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);
1148 1149
                appAccountManager.setCustomData("account_name_3100", "key31", "value31", (err)=>{
                    console.debug("====>setCustomData ActsAccountCustomData_3100 err:" + JSON.stringify(err));
1
15829070344 已提交
1150
                    expect(err).assertEqual(null);
1151 1152
                    var result = appAccountManager.getCustomDataSync("account_name_3100", "key31")
                    console.debug("====>getCustomData ActsAccountCustomData_3100 result:" + JSON.stringify(result));
1
15829070344 已提交
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164
                    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();
                    });
                });
            });
        });
    })
}