beeb8a56e90ad96178783b33b5a024c0f33d2330
[platform/core/pim/libaccounts-svc.git] / TC / testcase / utc_account.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <tet_api.h>
18 #include <account.h>
19 #include <account-types.h>
20 #include <account-error.h>
21
22 #define TEST_PACKAGE_NAME               "com.samsung.facebook"
23
24 static void startup(void);
25 static void cleanup(void);
26
27 void (*tet_startup)(void) = startup;
28 void (*tet_cleanup)(void) = cleanup;
29
30 static void utc_account_connect_positive(void);
31 static void utc_account_connect_negative(void);
32 static void utc_account_create_positive(void);
33 static void utc_account_create_negative(void);
34 static void utc_account_destroy_positive(void);
35 static void utc_account_destroy_negative(void);
36 static void utc_account_insert_to_db_positive(void);
37 static void utc_account_insert_to_db_negative(void);
38 static void utc_account_delete_from_db_by_id_positive(void);
39 static void utc_account_delete_from_db_by_id_negative(void);
40 static void utc_account_delete_from_db_by_user_name_positive(void);
41 static void utc_account_delete_from_db_by_user_name_negative(void);
42 static void utc_account_delete_from_db_by_package_name_positive(void);
43 static void utc_account_delete_from_db_by_package_name_negative(void);
44 static void utc_account_update_to_db_by_id_positive(void);
45 static void utc_account_update_to_db_by_id_negative(void);
46 static void utc_account_update_to_db_by_user_name_positive(void);
47 static void utc_account_update_to_db_by_user_name_negative(void);
48 static void utc_account_update_sync_status_by_id_positive(void);
49 static void utc_account_update_sync_status_by_id_negative(void);
50 static void utc_account_get_account_id_positive(void);
51 static void utc_account_get_account_id_negative(void);
52 static void utc_account_get_user_name_positive(void);
53 static void utc_account_get_user_name_negative(void);
54 static void utc_account_set_user_name_positive(void);
55 static void utc_account_set_user_name_negative(void);
56 static void utc_account_get_display_name_positive(void);
57 static void utc_account_get_display_name_negative(void);
58 static void utc_account_set_display_name_positive(void);
59 static void utc_account_set_display_name_negative(void);
60 static void utc_account_get_capability_positive(void);
61 static void utc_account_get_capability_negative(void);
62 static void utc_account_set_capability_positive(void);
63 static void utc_account_set_capability_negative(void);
64 static void utc_account_get_icon_path_positive(void);
65 static void utc_account_get_icon_path_negative(void);
66 static void utc_account_set_icon_path_positive(void);
67 static void utc_account_set_icon_path_negative(void);
68 static void utc_account_get_domain_name_positive(void);
69 static void utc_account_get_domain_name_negative(void);
70 static void utc_account_set_domain_name_positive(void);
71 static void utc_account_set_domain_name_negative(void);
72 static void utc_account_get_email_address_positive(void);
73 static void utc_account_get_email_address_negative(void);
74 static void utc_account_set_email_address_positive(void);
75 static void utc_account_set_email_address_negative(void);
76 static void utc_account_get_package_name_positive(void);
77 static void utc_account_get_package_name_negative(void);
78 static void utc_account_set_package_name_positive(void);
79 static void utc_account_set_package_name_negative(void);
80 static void utc_account_get_access_token_positive(void);
81 static void utc_account_get_access_token_negative(void);
82 static void utc_account_set_access_token_positive(void);
83 static void utc_account_set_access_token_negative(void);
84 static void utc_account_get_user_text_positive(void);
85 static void utc_account_get_user_text_negative(void);
86 static void utc_account_set_user_text_positive(void);
87 static void utc_account_set_user_text_negative(void);
88 static void utc_account_get_user_int_positive(void);
89 static void utc_account_get_user_int_negative(void);
90 static void utc_account_set_user_int_positive(void);
91 static void utc_account_set_user_int_negative(void);
92 static void utc_account_get_auth_type_positive(void);
93 static void utc_account_get_auth_type_negative(void);
94 static void utc_account_set_auth_type_positive(void);
95 static void utc_account_set_auth_type_negative(void);
96 static void utc_account_get_secret_positive(void);
97 static void utc_account_get_secret_negative(void);
98 static void utc_account_set_secret_positive(void);
99 static void utc_account_set_secret_negative(void);
100 static void utc_account_get_sync_support_positive(void);
101 static void utc_account_get_sync_support_negative(void);
102 static void utc_account_set_sync_support_positive(void);
103 static void utc_account_set_sync_support_negative(void);
104 static void utc_account_get_source_positive(void);
105 static void utc_account_get_source_negative(void);
106 static void utc_account_set_source_positive(void);
107 static void utc_account_set_source_negative(void);
108 static void utc_account_foreach_account_from_db_positive(void);
109 static void utc_account_foreach_account_from_db_negative(void);
110 static void utc_account_query_account_by_account_id_positive(void);
111 static void utc_account_query_account_by_account_id_negative(void);
112 static void utc_account_query_account_by_user_name_positive(void);
113 static void utc_account_query_account_by_user_name_negative(void);
114 static void utc_account_query_account_by_package_name_positive(void);
115 static void utc_account_query_account_by_package_name_negative(void);
116 static void utc_account_query_account_by_capability_positive(void);
117 static void utc_account_query_account_by_capability_negative(void);
118 static void utc_account_query_capability_by_account_id_positive(void);
119 static void utc_account_query_capability_by_account_id_negative(void);
120 static void utc_account_get_total_count_from_db_positive(void);
121 static void utc_account_get_total_count_from_db_negative(void);
122
123
124 struct tet_testlist tet_testlist[] = {
125         {utc_account_connect_positive, 1},
126         //{utc_account_connect_negative, 1},
127         {utc_account_create_positive, 1},
128         {utc_account_create_negative, 1},
129         {utc_account_destroy_positive, 1},
130         //{utc_account_destroy_negative, 1},
131         {utc_account_insert_to_db_positive, 1},
132         {utc_account_insert_to_db_negative, 1},
133         {utc_account_update_to_db_by_id_positive, 1},
134         {utc_account_update_to_db_by_id_negative, 1},
135         {utc_account_update_to_db_by_user_name_positive, 1},
136         {utc_account_update_to_db_by_user_name_negative, 1},
137         {utc_account_update_sync_status_by_id_positive, 1},
138         {utc_account_update_sync_status_by_id_negative, 1},
139         {utc_account_get_account_id_positive, 1},
140         {utc_account_get_account_id_negative, 1},
141         {utc_account_get_user_name_positive, 1},
142         {utc_account_get_user_name_negative, 1},
143         {utc_account_set_user_name_positive, 1},
144         {utc_account_set_user_name_negative, 1},
145         {utc_account_get_display_name_positive, 1},
146         {utc_account_get_display_name_negative, 1},
147         {utc_account_set_display_name_positive, 1},
148         {utc_account_set_display_name_negative, 1},
149         {utc_account_get_capability_positive, 1},
150         {utc_account_get_capability_negative, 1},
151         {utc_account_set_capability_positive, 1},
152         {utc_account_set_capability_negative, 1},
153         {utc_account_get_icon_path_positive, 1},
154         {utc_account_get_icon_path_negative, 1},
155         {utc_account_set_icon_path_positive, 1},
156         {utc_account_set_icon_path_negative, 1},
157         {utc_account_get_domain_name_positive, 1},
158         {utc_account_get_domain_name_negative, 1},
159         {utc_account_set_domain_name_positive, 1},
160         {utc_account_set_domain_name_negative, 1},
161         {utc_account_get_email_address_positive, 1},
162         {utc_account_get_email_address_negative, 1},
163         {utc_account_set_email_address_positive, 1},
164         {utc_account_set_email_address_negative, 1},
165         {utc_account_get_package_name_positive, 1},
166         {utc_account_get_package_name_negative, 1},
167         {utc_account_set_package_name_positive, 1},
168         {utc_account_set_package_name_negative, 1},
169         {utc_account_get_access_token_positive, 1},
170         {utc_account_get_access_token_negative, 1},
171         {utc_account_set_access_token_positive, 1},
172         {utc_account_set_access_token_negative, 1},
173         {utc_account_get_user_text_positive, 1},
174         {utc_account_get_user_text_negative, 1},
175         {utc_account_set_user_text_positive, 1},
176         {utc_account_set_user_text_negative, 1},
177         {utc_account_get_user_int_negative, 1},
178         {utc_account_get_user_int_negative, 1},
179         {utc_account_set_user_int_negative, 1},
180         {utc_account_set_user_int_negative, 1},
181         {utc_account_get_auth_type_positive, 1},
182         {utc_account_get_auth_type_negative, 1},
183         {utc_account_set_auth_type_positive, 1},
184         {utc_account_set_auth_type_negative, 1},
185         {utc_account_get_secret_positive, 1},
186         {utc_account_get_secret_negative, 1},
187         {utc_account_set_secret_positive, 1},
188         {utc_account_set_secret_negative, 1},
189         {utc_account_get_sync_support_positive, 1},
190         {utc_account_get_sync_support_negative, 1},
191         {utc_account_set_sync_support_positive, 1},
192         {utc_account_set_sync_support_negative, 1},
193         {utc_account_get_source_positive, 1},
194         {utc_account_get_source_negative, 1},
195         {utc_account_set_source_positive, 1},
196         {utc_account_set_source_negative, 1},
197         {utc_account_foreach_account_from_db_positive, 1},
198         {utc_account_foreach_account_from_db_negative, 1},
199         {utc_account_query_account_by_account_id_positive, 1},
200         {utc_account_query_account_by_account_id_negative, 1},
201         {utc_account_query_account_by_user_name_positive, 1},
202         {utc_account_query_account_by_user_name_negative, 1},
203         {utc_account_query_account_by_package_name_positive, 1},
204         {utc_account_query_account_by_package_name_negative, 1},
205         {utc_account_query_account_by_capability_positive, 1},
206         {utc_account_query_account_by_capability_negative, 1},
207         {utc_account_query_capability_by_account_id_positive, 1},
208         {utc_account_query_capability_by_account_id_negative, 1},
209         {utc_account_get_total_count_from_db_positive, 1},
210         {utc_account_get_total_count_from_db_negative, 1},
211         {utc_account_delete_from_db_by_id_positive, 1},
212         {utc_account_delete_from_db_by_id_negative, 1},
213         {utc_account_delete_from_db_by_user_name_positive, 1},
214         {utc_account_delete_from_db_by_user_name_negative, 1},
215         {utc_account_delete_from_db_by_package_name_positive, 1},
216         {utc_account_delete_from_db_by_package_name_negative, 1},
217         /* TODO : Add more test case */
218         {NULL, 0},
219 };
220
221 static void startup(void)
222 {
223
224 }
225
226
227 static void cleanup(void)
228 {
229         /* end of TC */
230 }
231
232 static void _account_free_text(char *text)
233 {
234         if (text) {
235                 free(text);
236                 text = NULL;
237         }
238 }
239
240 // START example for libaccounts-svc API test case
241
242 static void utc_account_connect_positive(void)
243 {
244         const char *API_NAME = __FUNCTION__;
245         int ret = ACCOUNT_ERROR_NONE;
246
247         ret = account_connect();
248
249         if ( ret == ACCOUNT_ERROR_NONE ) {
250                 dts_pass(API_NAME, "passed");
251         } else {
252                 dts_fail(API_NAME, "failed");
253         }
254
255 }
256
257 static void utc_account_connect_negative(void)
258 {
259         const char *API_NAME = __FUNCTION__;
260         int ret = ACCOUNT_ERROR_NONE;
261
262         ret = rename("/opt/dbspace/.account.db", "/opt/dbspace/.account-tmp.db");
263
264         ret = rename("/opt/dbspace/.account.db-journal", "/opt/dbspace/.account-tmp.db-journal");
265
266         ret = account_connect();
267
268         if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
269                 dts_pass(API_NAME, "passed");
270         } else {
271                 dts_fail(API_NAME, "failed");
272         }
273
274         ret = rename("/opt/dbspace/.account-tmp.db", "/opt/dbspace/.account.db");
275         ret = rename("/opt/dbspace/.account-tmp.db-journal", "/opt/dbspace/.account.db-journal");
276
277         ret = account_disconnect();
278         if ( ret != ACCOUNT_ERROR_NONE) {
279                 dts_fail(API_NAME, "failed");
280         }
281 }
282
283 static void utc_account_destroy_positive(void)
284 {
285         const char *API_NAME = __FUNCTION__;
286         int ret = ACCOUNT_ERROR_NONE;
287
288         ret = account_connect();
289         if ( ret != ACCOUNT_ERROR_NONE) {
290                 dts_fail(API_NAME, "failed");
291         }
292
293         ret = account_disconnect();
294
295         if ( ret == ACCOUNT_ERROR_NONE ) {
296                 dts_pass(API_NAME, "passed");
297         } else {
298                 dts_fail(API_NAME, "failed");
299         }
300
301 }
302
303 static void utc_account_destroy_negative(void)
304 {
305         const char *API_NAME = __FUNCTION__;
306         int ret = ACCOUNT_ERROR_NONE;
307
308         ret = rename("/opt/dbspace/.account.db", "/opt/dbspace/.account-tmp.db");
309
310         ret = rename("/opt/dbspace/.account.db-journal", "/opt/dbspace/.account-tmp.db-journal");
311
312         ret = account_disconnect();
313
314         if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
315                 dts_pass(API_NAME, "passed");
316         } else {
317                 dts_fail(API_NAME, "failed");
318         }
319
320         ret = rename("/opt/dbspace/.account-tmp.db", "/opt/dbspace/.account.db");
321         ret = rename("/opt/dbspace/.account-tmp.db-journal", "/opt/dbspace/.account.db-journal");
322 }
323
324 static void utc_account_create_positive(void)
325 {
326         const char *API_NAME = __FUNCTION__;
327         account_h account;
328         int ret = ACCOUNT_ERROR_NONE;
329
330         ret = account_connect();
331         if ( ret != ACCOUNT_ERROR_NONE) {
332                 dts_fail(API_NAME, "failed");
333         }
334
335         ret = account_create(&account);
336
337         if ( ret == ACCOUNT_ERROR_NONE ) {
338                 dts_pass(API_NAME, "passed");
339         } else {
340                 dts_fail(API_NAME, "failed");
341         }
342
343         ret = account_destroy(account);
344         if ( ret != ACCOUNT_ERROR_NONE) {
345                 dts_fail(API_NAME, "failed");
346         }
347
348         ret = account_disconnect();
349         if ( ret != ACCOUNT_ERROR_NONE) {
350                 dts_fail(API_NAME, "failed");
351         }
352 }
353
354 static void utc_account_create_negative(void)
355 {
356         const char *API_NAME = __FUNCTION__;
357         account_h account;
358         int ret = ACCOUNT_ERROR_NONE;
359
360         ret = account_connect();
361         if ( ret != ACCOUNT_ERROR_NONE) {
362                 dts_fail(API_NAME, "failed");
363         }
364
365         ret = account_create(NULL);
366
367         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
368                 dts_pass(API_NAME, "passed");
369         } else {
370                 dts_fail(API_NAME, "failed");
371         }
372
373         ret = account_disconnect();
374         if ( ret != ACCOUNT_ERROR_NONE) {
375                 dts_fail(API_NAME, "failed");
376         }
377 }
378
379 static void utc_account_insert_to_db_positive(void)
380 {
381         const char *API_NAME = __FUNCTION__;
382         account_h account;
383         int account_id = -1;
384         int ret = ACCOUNT_ERROR_NONE;
385         ret = account_connect();
386
387         if ( ret != ACCOUNT_ERROR_NONE ) {
388                 dts_fail(API_NAME, "failed");
389         }
390
391         ret = account_create(&account);
392
393         if ( ret != ACCOUNT_ERROR_NONE ) {
394                 dts_fail(API_NAME, "failed");
395         }
396
397         ret = account_set_user_name(account, "tarun.kr");
398
399         if ( ret != ACCOUNT_ERROR_NONE ) {
400                 dts_fail(API_NAME, "failed");
401         }
402
403         ret = account_set_package_name(account, TEST_PACKAGE_NAME);
404
405         if ( ret != ACCOUNT_ERROR_NONE ) {
406                 dts_fail(API_NAME, "failed");
407         }
408
409         ret = account_insert_to_db(account, &account_id);
410
411         if ( ret == ACCOUNT_ERROR_NONE ) {
412                 dts_pass(API_NAME, "passed");
413         } else {
414                 dts_fail(API_NAME, "failed");
415         }
416
417         ret = account_destroy(account);
418
419         if ( ret != ACCOUNT_ERROR_NONE ) {
420                 dts_fail(API_NAME, "failed");
421         }
422
423         ret = account_disconnect();
424
425         if ( ret != ACCOUNT_ERROR_NONE ) {
426                 dts_fail(API_NAME, "failed");
427         }
428 }
429
430 static void utc_account_insert_to_db_negative(void)
431 {
432         const char *API_NAME = __FUNCTION__;
433         account_h account;
434         int account_id = -1;
435         int ret = ACCOUNT_ERROR_NONE;
436         ret = account_connect();
437
438         if ( ret != ACCOUNT_ERROR_NONE ) {
439                 dts_fail(API_NAME, "failed");
440         }
441
442         ret = account_create(&account);
443
444         if ( ret != ACCOUNT_ERROR_NONE ) {
445                 dts_fail(API_NAME, "failed");
446         }
447
448         ret = account_insert_to_db(NULL, &account_id);
449
450         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
451                 dts_pass(API_NAME, "passed");
452         } else {
453                 dts_fail(API_NAME, "failed");
454         }
455
456         ret = account_destroy(account);
457
458         if ( ret != ACCOUNT_ERROR_NONE ) {
459                 dts_fail(API_NAME, "failed");
460         }
461
462         ret = account_disconnect();
463
464         if ( ret != ACCOUNT_ERROR_NONE ) {
465                 dts_fail(API_NAME, "failed");
466         }
467 }
468
469 static void utc_account_set_display_name_positive(void)
470 {
471         const char *API_NAME = __FUNCTION__;
472         account_h account;
473         int account_id = -1;
474         int ret = ACCOUNT_ERROR_NONE;
475         ret = account_connect();
476
477         if ( ret != ACCOUNT_ERROR_NONE ) {
478                 dts_fail(API_NAME, "failed");
479         }
480
481         ret = account_create(&account);
482
483         if ( ret != ACCOUNT_ERROR_NONE ) {
484                 dts_fail(API_NAME, "failed");
485         }
486
487         ret = account_set_display_name(account, "tarun.kr");
488
489         if ( ret == ACCOUNT_ERROR_NONE ) {
490                 dts_pass(API_NAME, "passed");
491         } else {
492                 dts_fail(API_NAME, "failed");
493         }
494
495         ret = account_insert_to_db(account, &account_id);
496
497         if ( ret != ACCOUNT_ERROR_NONE ) {
498                 dts_fail(API_NAME, "failed");
499         }
500
501         ret = account_destroy(account);
502
503         if ( ret != ACCOUNT_ERROR_NONE ) {
504                 dts_fail(API_NAME, "failed");
505         }
506
507         ret = account_disconnect();
508
509         if ( ret != ACCOUNT_ERROR_NONE ) {
510                 dts_fail(API_NAME, "failed");
511         }
512 }
513
514 static void utc_account_set_display_name_negative(void)
515 {
516         const char *API_NAME = __FUNCTION__;
517         account_h account;
518         int account_id = -1;
519         int ret = ACCOUNT_ERROR_NONE;
520         ret = account_connect();
521
522         if ( ret != ACCOUNT_ERROR_NONE ) {
523                 dts_fail(API_NAME, "failed");
524         }
525
526         ret = account_create(&account);
527
528         if ( ret != ACCOUNT_ERROR_NONE ) {
529                 dts_fail(API_NAME, "failed");
530         }
531         ret = account_set_display_name(account, NULL);
532
533         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
534                 dts_pass(API_NAME, "passed");
535         } else {
536                 dts_fail(API_NAME, "failed");
537         }
538
539         ret = account_insert_to_db(account, &account_id);
540
541         if ( ret != ACCOUNT_ERROR_NONE ) {
542                 dts_fail(API_NAME, "failed");
543         }
544
545         ret = account_destroy(account);
546
547         if ( ret != ACCOUNT_ERROR_NONE ) {
548                 dts_fail(API_NAME, "failed");
549         }
550
551         ret = account_disconnect();
552
553         if ( ret != ACCOUNT_ERROR_NONE ) {
554                 dts_fail(API_NAME, "failed");
555         }
556 }
557
558 static void utc_account_set_user_name_positive(void)
559 {
560         const char *API_NAME = __FUNCTION__;
561         account_h account;
562         int account_id = -1;
563         int ret = ACCOUNT_ERROR_NONE;
564         ret = account_connect();
565
566         if ( ret != ACCOUNT_ERROR_NONE ) {
567                 dts_fail(API_NAME, "failed");
568         }
569
570         ret = account_create(&account);
571
572         if ( ret != ACCOUNT_ERROR_NONE ) {
573                 dts_fail(API_NAME, "failed");
574         }
575
576         ret = account_set_user_name(account, "tarun.kr");
577
578         if ( ret == ACCOUNT_ERROR_NONE ) {
579                 dts_pass(API_NAME, "passed");
580         } else {
581                 dts_fail(API_NAME, "failed");
582         }
583
584         ret = account_insert_to_db(account, &account_id);
585
586         if ( ret != ACCOUNT_ERROR_NONE ) {
587                 dts_fail(API_NAME, "failed");
588         }
589
590         ret = account_destroy(account);
591
592         if ( ret != ACCOUNT_ERROR_NONE ) {
593                 dts_fail(API_NAME, "failed");
594         }
595
596         ret = account_disconnect();
597
598         if ( ret != ACCOUNT_ERROR_NONE ) {
599                 dts_fail(API_NAME, "failed");
600         }
601 }
602
603 static void utc_account_set_user_name_negative(void)
604 {
605         const char *API_NAME = __FUNCTION__;
606         account_h account;
607         int account_id = -1;
608         int ret = ACCOUNT_ERROR_NONE;
609         ret = account_connect();
610
611         if ( ret != ACCOUNT_ERROR_NONE ) {
612                 dts_fail(API_NAME, "failed");
613         }
614
615         ret = account_create(&account);
616
617         if ( ret != ACCOUNT_ERROR_NONE ) {
618                 dts_fail(API_NAME, "failed");
619         }
620         ret = account_set_user_name(account, NULL);
621
622         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
623                 dts_pass(API_NAME, "passed");
624         } else {
625                 dts_fail(API_NAME, "failed");
626         }
627
628         ret = account_insert_to_db(account, &account_id);
629
630         if ( ret != ACCOUNT_ERROR_NONE ) {
631                 dts_fail(API_NAME, "failed");
632         }
633
634         ret = account_destroy(account);
635
636         if ( ret != ACCOUNT_ERROR_NONE ) {
637                 dts_fail(API_NAME, "failed");
638         }
639
640         ret = account_disconnect();
641
642         if ( ret != ACCOUNT_ERROR_NONE ) {
643                 dts_fail(API_NAME, "failed");
644         }
645 }
646
647 static void utc_account_set_icon_path_positive(void)
648 {
649         const char *API_NAME = __FUNCTION__;
650         account_h account;
651         int account_id = -1;
652         int ret = ACCOUNT_ERROR_NONE;
653         ret = account_connect();
654
655         if ( ret != ACCOUNT_ERROR_NONE ) {
656                 dts_fail(API_NAME, "failed");
657         }
658
659         ret = account_create(&account);
660
661         if ( ret != ACCOUNT_ERROR_NONE ) {
662                 dts_fail(API_NAME, "failed");
663         }
664
665         ret = account_set_icon_path(account, "icon-path");
666
667         if ( ret == ACCOUNT_ERROR_NONE ) {
668                 dts_pass(API_NAME, "passed");
669         } else {
670                 dts_fail(API_NAME, "failed");
671         }
672
673         ret = account_insert_to_db(account, &account_id);
674
675         if ( ret != ACCOUNT_ERROR_NONE ) {
676                 dts_fail(API_NAME, "failed");
677         }
678
679         ret = account_destroy(account);
680
681         if ( ret != ACCOUNT_ERROR_NONE ) {
682                 dts_fail(API_NAME, "failed");
683         }
684
685         ret = account_disconnect();
686
687         if ( ret != ACCOUNT_ERROR_NONE ) {
688                 dts_fail(API_NAME, "failed");
689         }
690 }
691
692 static void utc_account_set_icon_path_negative(void)
693 {
694         const char *API_NAME = __FUNCTION__;
695         account_h account;
696         int account_id = -1;
697         int ret = ACCOUNT_ERROR_NONE;
698         ret = account_connect();
699
700         if ( ret != ACCOUNT_ERROR_NONE ) {
701                 dts_fail(API_NAME, "failed");
702         }
703
704         ret = account_create(&account);
705
706         if ( ret != ACCOUNT_ERROR_NONE ) {
707                 dts_fail(API_NAME, "failed");
708         }
709         ret = account_set_icon_path(account, NULL);
710
711         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
712                 dts_pass(API_NAME, "passed");
713         } else {
714                 dts_fail(API_NAME, "failed");
715         }
716
717         ret = account_insert_to_db(account, &account_id);
718
719         if ( ret != ACCOUNT_ERROR_NONE ) {
720                 dts_fail(API_NAME, "failed");
721         }
722
723         ret = account_destroy(account);
724
725         if ( ret != ACCOUNT_ERROR_NONE ) {
726                 dts_fail(API_NAME, "failed");
727         }
728
729         ret = account_disconnect();
730
731         if ( ret != ACCOUNT_ERROR_NONE ) {
732                 dts_fail(API_NAME, "failed");
733         }
734 }
735
736 static void utc_account_set_domain_name_positive(void)
737 {
738         const char *API_NAME = __FUNCTION__;
739         account_h account;
740         int account_id = -1;
741         int ret = ACCOUNT_ERROR_NONE;
742         ret = account_connect();
743
744         if ( ret != ACCOUNT_ERROR_NONE ) {
745                 dts_fail(API_NAME, "failed");
746         }
747
748         ret = account_create(&account);
749
750         if ( ret != ACCOUNT_ERROR_NONE ) {
751                 dts_fail(API_NAME, "failed");
752         }
753
754         ret = account_set_domain_name(account, "domain-name");
755
756         if ( ret == ACCOUNT_ERROR_NONE ) {
757                 dts_pass(API_NAME, "passed");
758         } else {
759                 dts_fail(API_NAME, "failed");
760         }
761
762         ret = account_insert_to_db(account, &account_id);
763
764         if ( ret != ACCOUNT_ERROR_NONE ) {
765                 dts_fail(API_NAME, "failed");
766         }
767
768         ret = account_destroy(account);
769
770         if ( ret != ACCOUNT_ERROR_NONE ) {
771                 dts_fail(API_NAME, "failed");
772         }
773
774         ret = account_disconnect();
775
776         if ( ret != ACCOUNT_ERROR_NONE ) {
777                 dts_fail(API_NAME, "failed");
778         }
779 }
780
781 static void utc_account_set_domain_name_negative(void)
782 {
783         const char *API_NAME = __FUNCTION__;
784         account_h account;
785         int account_id = -1;
786         int ret = ACCOUNT_ERROR_NONE;
787         ret = account_connect();
788
789         if ( ret != ACCOUNT_ERROR_NONE ) {
790                 dts_fail(API_NAME, "failed");
791         }
792
793         ret = account_create(&account);
794
795         if ( ret != ACCOUNT_ERROR_NONE ) {
796                 dts_fail(API_NAME, "failed");
797         }
798         ret = account_set_domain_name(account, NULL);
799
800         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
801                 dts_pass(API_NAME, "passed");
802         } else {
803                 dts_fail(API_NAME, "failed");
804         }
805
806         ret = account_insert_to_db(account, &account_id);
807
808         if ( ret != ACCOUNT_ERROR_NONE ) {
809                 dts_fail(API_NAME, "failed");
810         }
811
812         ret = account_destroy(account);
813
814         if ( ret != ACCOUNT_ERROR_NONE ) {
815                 dts_fail(API_NAME, "failed");
816         }
817
818         ret = account_disconnect();
819
820         if ( ret != ACCOUNT_ERROR_NONE ) {
821                 dts_fail(API_NAME, "failed");
822         }
823 }
824
825 static void utc_account_set_email_address_positive(void)
826 {
827         const char *API_NAME = __FUNCTION__;
828         account_h account;
829         int account_id = -1;
830         int ret = ACCOUNT_ERROR_NONE;
831         ret = account_connect();
832
833         if ( ret != ACCOUNT_ERROR_NONE ) {
834                 dts_fail(API_NAME, "failed");
835         }
836
837         ret = account_create(&account);
838
839         if ( ret != ACCOUNT_ERROR_NONE ) {
840                 dts_fail(API_NAME, "failed");
841         }
842
843         ret = account_set_email_address(account, "email-address");
844
845         if ( ret == ACCOUNT_ERROR_NONE ) {
846                 dts_pass(API_NAME, "passed");
847         } else {
848                 dts_fail(API_NAME, "failed");
849         }
850
851         ret = account_insert_to_db(account, &account_id);
852
853         if ( ret != ACCOUNT_ERROR_NONE ) {
854                 dts_fail(API_NAME, "failed");
855         }
856
857         ret = account_destroy(account);
858
859         if ( ret != ACCOUNT_ERROR_NONE ) {
860                 dts_fail(API_NAME, "failed");
861         }
862
863         ret = account_disconnect();
864
865         if ( ret != ACCOUNT_ERROR_NONE ) {
866                 dts_fail(API_NAME, "failed");
867         }
868 }
869
870 static void utc_account_set_email_address_negative(void)
871 {
872         const char *API_NAME = __FUNCTION__;
873         account_h account;
874         int account_id = -1;
875         int ret = ACCOUNT_ERROR_NONE;
876         ret = account_connect();
877
878         if ( ret != ACCOUNT_ERROR_NONE ) {
879                 dts_fail(API_NAME, "failed");
880         }
881
882         ret = account_create(&account);
883
884         if ( ret != ACCOUNT_ERROR_NONE ) {
885                 dts_fail(API_NAME, "failed");
886         }
887         ret = account_set_email_address(account, NULL);
888
889         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
890                 dts_pass(API_NAME, "passed");
891         } else {
892                 dts_fail(API_NAME, "failed");
893         }
894
895         ret = account_insert_to_db(account, &account_id);
896
897         if ( ret != ACCOUNT_ERROR_NONE ) {
898                 dts_fail(API_NAME, "failed");
899         }
900
901         ret = account_destroy(account);
902
903         if ( ret != ACCOUNT_ERROR_NONE ) {
904                 dts_fail(API_NAME, "failed");
905         }
906
907         ret = account_disconnect();
908
909         if ( ret != ACCOUNT_ERROR_NONE ) {
910                 dts_fail(API_NAME, "failed");
911         }
912 }
913
914 static void utc_account_set_source_positive(void)
915 {
916         const char *API_NAME = __FUNCTION__;
917         account_h account;
918         int account_id = -1;
919         int ret = ACCOUNT_ERROR_NONE;
920         ret = account_connect();
921
922         if ( ret != ACCOUNT_ERROR_NONE ) {
923                 dts_fail(API_NAME, "failed");
924         }
925
926         ret = account_create(&account);
927
928         if ( ret != ACCOUNT_ERROR_NONE ) {
929                 dts_fail(API_NAME, "failed");
930         }
931
932         ret = account_set_source(account, "source");
933
934         if ( ret == ACCOUNT_ERROR_NONE ) {
935                 dts_pass(API_NAME, "passed");
936         } else {
937                 dts_fail(API_NAME, "failed");
938         }
939
940         ret = account_insert_to_db(account, &account_id);
941
942         if ( ret != ACCOUNT_ERROR_NONE ) {
943                 dts_fail(API_NAME, "failed");
944         }
945
946         ret = account_destroy(account);
947
948         if ( ret != ACCOUNT_ERROR_NONE ) {
949                 dts_fail(API_NAME, "failed");
950         }
951
952         ret = account_disconnect();
953
954         if ( ret != ACCOUNT_ERROR_NONE ) {
955                 dts_fail(API_NAME, "failed");
956         }
957 }
958
959 static void utc_account_set_source_negative(void)
960 {
961         const char *API_NAME = __FUNCTION__;
962         account_h account;
963         int account_id = -1;
964         int ret = ACCOUNT_ERROR_NONE;
965         ret = account_connect();
966
967         if ( ret != ACCOUNT_ERROR_NONE ) {
968                 dts_fail(API_NAME, "failed");
969         }
970
971         ret = account_create(&account);
972
973         if ( ret != ACCOUNT_ERROR_NONE ) {
974                 dts_fail(API_NAME, "failed");
975         }
976         ret = account_set_source(account, NULL);
977
978         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
979                 dts_pass(API_NAME, "passed");
980         } else {
981                 dts_fail(API_NAME, "failed");
982         }
983
984         ret = account_insert_to_db(account, &account_id);
985
986         if ( ret != ACCOUNT_ERROR_NONE ) {
987                 dts_fail(API_NAME, "failed");
988         }
989
990         ret = account_destroy(account);
991
992         if ( ret != ACCOUNT_ERROR_NONE ) {
993                 dts_fail(API_NAME, "failed");
994         }
995
996         ret = account_disconnect();
997
998         if ( ret != ACCOUNT_ERROR_NONE ) {
999                 dts_fail(API_NAME, "failed");
1000         }
1001 }
1002
1003 static void utc_account_set_package_name_positive(void)
1004 {
1005         const char *API_NAME = __FUNCTION__;
1006         account_h account;
1007         int account_id = -1;
1008         int ret = ACCOUNT_ERROR_NONE;
1009         ret = account_connect();
1010
1011         if ( ret != ACCOUNT_ERROR_NONE ) {
1012                 dts_fail(API_NAME, "failed");
1013         }
1014
1015         ret = account_create(&account);
1016
1017         if ( ret != ACCOUNT_ERROR_NONE ) {
1018                 dts_fail(API_NAME, "failed");
1019         }
1020
1021         ret = account_set_package_name(account, "package_name");
1022
1023         if ( ret == ACCOUNT_ERROR_NONE ) {
1024                 dts_pass(API_NAME, "passed");
1025         } else {
1026                 dts_fail(API_NAME, "failed");
1027         }
1028
1029         ret = account_insert_to_db(account, &account_id);
1030
1031         if ( ret != ACCOUNT_ERROR_NONE ) {
1032                 dts_fail(API_NAME, "failed");
1033         }
1034
1035         ret = account_destroy(account);
1036
1037         if ( ret != ACCOUNT_ERROR_NONE ) {
1038                 dts_fail(API_NAME, "failed");
1039         }
1040
1041         ret = account_disconnect();
1042
1043         if ( ret != ACCOUNT_ERROR_NONE ) {
1044                 dts_fail(API_NAME, "failed");
1045         }
1046 }
1047
1048 static void utc_account_set_package_name_negative(void)
1049 {
1050         const char *API_NAME = __FUNCTION__;
1051         account_h account;
1052         int account_id = -1;
1053         int ret = ACCOUNT_ERROR_NONE;
1054         ret = account_connect();
1055
1056         if ( ret != ACCOUNT_ERROR_NONE ) {
1057                 dts_fail(API_NAME, "failed");
1058         }
1059
1060         ret = account_create(&account);
1061
1062         if ( ret != ACCOUNT_ERROR_NONE ) {
1063                 dts_fail(API_NAME, "failed");
1064         }
1065         ret = account_set_package_name(account, NULL);
1066
1067         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1068                 dts_pass(API_NAME, "passed");
1069         } else {
1070                 dts_fail(API_NAME, "failed");
1071         }
1072
1073         ret = account_insert_to_db(account, &account_id);
1074
1075         if ( ret != ACCOUNT_ERROR_NONE ) {
1076                 dts_fail(API_NAME, "failed");
1077         }
1078
1079         ret = account_destroy(account);
1080
1081         if ( ret != ACCOUNT_ERROR_NONE ) {
1082                 dts_fail(API_NAME, "failed");
1083         }
1084
1085         ret = account_disconnect();
1086
1087         if ( ret != ACCOUNT_ERROR_NONE ) {
1088                 dts_fail(API_NAME, "failed");
1089         }
1090 }
1091
1092 static void utc_account_set_access_token_positive(void)
1093 {
1094         const char *API_NAME = __FUNCTION__;
1095         account_h account;
1096         int account_id = -1;
1097         int ret = ACCOUNT_ERROR_NONE;
1098         ret = account_connect();
1099
1100         if ( ret != ACCOUNT_ERROR_NONE ) {
1101                 dts_fail(API_NAME, "failed");
1102         }
1103
1104         ret = account_create(&account);
1105
1106         if ( ret != ACCOUNT_ERROR_NONE ) {
1107                 dts_fail(API_NAME, "failed");
1108         }
1109
1110         ret = account_set_access_token(account, "access_token");
1111
1112         if ( ret == ACCOUNT_ERROR_NONE ) {
1113                 dts_pass(API_NAME, "passed");
1114         } else {
1115                 dts_fail(API_NAME, "failed");
1116         }
1117
1118         ret = account_insert_to_db(account, &account_id);
1119
1120         if ( ret != ACCOUNT_ERROR_NONE ) {
1121                 dts_fail(API_NAME, "failed");
1122         }
1123
1124         ret = account_destroy(account);
1125
1126         if ( ret != ACCOUNT_ERROR_NONE ) {
1127                 dts_fail(API_NAME, "failed");
1128         }
1129
1130         ret = account_disconnect();
1131
1132         if ( ret != ACCOUNT_ERROR_NONE ) {
1133                 dts_fail(API_NAME, "failed");
1134         }
1135 }
1136
1137 static void utc_account_set_access_token_negative(void)
1138 {
1139         const char *API_NAME = __FUNCTION__;
1140         account_h account;
1141         int account_id = -1;
1142         int ret = ACCOUNT_ERROR_NONE;
1143         ret = account_connect();
1144
1145         if ( ret != ACCOUNT_ERROR_NONE ) {
1146                 dts_fail(API_NAME, "failed");
1147         }
1148
1149         ret = account_create(&account);
1150
1151         if ( ret != ACCOUNT_ERROR_NONE ) {
1152                 dts_fail(API_NAME, "failed");
1153         }
1154         ret = account_set_access_token(account, NULL);
1155
1156         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1157                 dts_pass(API_NAME, "passed");
1158         } else {
1159                 dts_fail(API_NAME, "failed");
1160         }
1161
1162         ret = account_insert_to_db(account, &account_id);
1163
1164         if ( ret != ACCOUNT_ERROR_NONE ) {
1165                 dts_fail(API_NAME, "failed");
1166         }
1167
1168         ret = account_destroy(account);
1169
1170         if ( ret != ACCOUNT_ERROR_NONE ) {
1171                 dts_fail(API_NAME, "failed");
1172         }
1173
1174         ret = account_disconnect();
1175
1176         if ( ret != ACCOUNT_ERROR_NONE ) {
1177                 dts_fail(API_NAME, "failed");
1178         }
1179 }
1180
1181 static void utc_account_set_auth_type_positive(void)
1182 {
1183         const char *API_NAME = __FUNCTION__;
1184         account_h account;
1185         int account_id = -1;
1186         int ret = ACCOUNT_ERROR_NONE;
1187         ret = account_connect();
1188
1189         if ( ret != ACCOUNT_ERROR_NONE ) {
1190                 dts_fail(API_NAME, "failed");
1191         }
1192
1193         ret = account_create(&account);
1194
1195         if ( ret != ACCOUNT_ERROR_NONE ) {
1196                 dts_fail(API_NAME, "failed");
1197         }
1198
1199         ret = account_set_auth_type(account, ACCOUNT_AUTH_TYPE_XAUTH);
1200
1201         if ( ret == ACCOUNT_ERROR_NONE ) {
1202                 dts_pass(API_NAME, "passed");
1203         } else {
1204                 dts_fail(API_NAME, "failed");
1205         }
1206
1207         ret = account_insert_to_db(account, &account_id);
1208
1209         if ( ret != ACCOUNT_ERROR_NONE ) {
1210                 dts_fail(API_NAME, "failed");
1211         }
1212
1213         ret = account_destroy(account);
1214
1215         if ( ret != ACCOUNT_ERROR_NONE ) {
1216                 dts_fail(API_NAME, "failed");
1217         }
1218
1219         ret = account_disconnect();
1220
1221         if ( ret != ACCOUNT_ERROR_NONE ) {
1222                 dts_fail(API_NAME, "failed");
1223         }
1224 }
1225
1226 static void utc_account_set_auth_type_negative(void)
1227 {
1228         const char *API_NAME = __FUNCTION__;
1229         account_h account;
1230         int account_id = -1;
1231         int ret = ACCOUNT_ERROR_NONE;
1232         ret = account_connect();
1233
1234         if ( ret != ACCOUNT_ERROR_NONE ) {
1235                 dts_fail(API_NAME, "failed");
1236         }
1237
1238         ret = account_create(&account);
1239
1240         if ( ret != ACCOUNT_ERROR_NONE ) {
1241                 dts_fail(API_NAME, "failed");
1242         }
1243         ret = account_set_auth_type(account, -999);
1244
1245         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1246                 dts_pass(API_NAME, "passed");
1247         } else {
1248                 dts_fail(API_NAME, "failed");
1249         }
1250
1251         ret = account_insert_to_db(account, &account_id);
1252
1253         if ( ret != ACCOUNT_ERROR_NONE ) {
1254                 dts_fail(API_NAME, "failed");
1255         }
1256
1257         ret = account_destroy(account);
1258
1259         if ( ret != ACCOUNT_ERROR_NONE ) {
1260                 dts_fail(API_NAME, "failed");
1261         }
1262
1263         ret = account_disconnect();
1264
1265         if ( ret != ACCOUNT_ERROR_NONE ) {
1266                 dts_fail(API_NAME, "failed");
1267         }
1268 }
1269
1270 static void utc_account_set_secret_positive(void)
1271 {
1272         const char *API_NAME = __FUNCTION__;
1273         account_h account;
1274         int account_id = -1;
1275         int ret = ACCOUNT_ERROR_NONE;
1276         ret = account_connect();
1277
1278         if ( ret != ACCOUNT_ERROR_NONE ) {
1279                 dts_fail(API_NAME, "failed");
1280         }
1281
1282         ret = account_create(&account);
1283
1284         if ( ret != ACCOUNT_ERROR_NONE ) {
1285                 dts_fail(API_NAME, "failed");
1286         }
1287
1288         ret = account_set_secret(account, ACCOUNT_SECRECY_INVISIBLE);
1289
1290         if ( ret == ACCOUNT_ERROR_NONE ) {
1291                 dts_pass(API_NAME, "passed");
1292         } else {
1293                 dts_fail(API_NAME, "failed");
1294         }
1295
1296         ret = account_insert_to_db(account, &account_id);
1297
1298         if ( ret != ACCOUNT_ERROR_NONE ) {
1299                 dts_fail(API_NAME, "failed");
1300         }
1301
1302         ret = account_destroy(account);
1303
1304         if ( ret != ACCOUNT_ERROR_NONE ) {
1305                 dts_fail(API_NAME, "failed");
1306         }
1307
1308         ret = account_disconnect();
1309
1310         if ( ret != ACCOUNT_ERROR_NONE ) {
1311                 dts_fail(API_NAME, "failed");
1312         }
1313 }
1314
1315 static void utc_account_set_secret_negative(void)
1316 {
1317         const char *API_NAME = __FUNCTION__;
1318         account_h account;
1319         int account_id = -1;
1320         int ret = ACCOUNT_ERROR_NONE;
1321         ret = account_connect();
1322
1323         if ( ret != ACCOUNT_ERROR_NONE ) {
1324                 dts_fail(API_NAME, "failed");
1325         }
1326
1327         ret = account_create(&account);
1328
1329         if ( ret != ACCOUNT_ERROR_NONE ) {
1330                 dts_fail(API_NAME, "failed");
1331         }
1332         ret = account_set_secret(account, -999);
1333
1334         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1335                 dts_pass(API_NAME, "passed");
1336         } else {
1337                 dts_fail(API_NAME, "failed");
1338         }
1339
1340         ret = account_insert_to_db(account, &account_id);
1341
1342         if ( ret != ACCOUNT_ERROR_NONE ) {
1343                 dts_fail(API_NAME, "failed");
1344         }
1345
1346         ret = account_destroy(account);
1347
1348         if ( ret != ACCOUNT_ERROR_NONE ) {
1349                 dts_fail(API_NAME, "failed");
1350         }
1351
1352         ret = account_disconnect();
1353
1354         if ( ret != ACCOUNT_ERROR_NONE ) {
1355                 dts_fail(API_NAME, "failed");
1356         }
1357 }
1358
1359 static void utc_account_set_sync_support_positive(void)
1360 {
1361         const char *API_NAME = __FUNCTION__;
1362         account_h account;
1363         int account_id = -1;
1364         int ret = ACCOUNT_ERROR_NONE;
1365         ret = account_connect();
1366
1367         if ( ret != ACCOUNT_ERROR_NONE ) {
1368                 dts_fail(API_NAME, "failed");
1369         }
1370
1371         ret = account_create(&account);
1372
1373         if ( ret != ACCOUNT_ERROR_NONE ) {
1374                 dts_fail(API_NAME, "failed");
1375         }
1376
1377         ret = account_set_sync_support(account, ACCOUNT_SYNC_STATUS_IDLE);
1378
1379         if ( ret == ACCOUNT_ERROR_NONE ) {
1380                 dts_pass(API_NAME, "passed");
1381         } else {
1382                 dts_fail(API_NAME, "failed");
1383         }
1384
1385         ret = account_insert_to_db(account, &account_id);
1386
1387         if ( ret != ACCOUNT_ERROR_NONE ) {
1388                 dts_fail(API_NAME, "failed");
1389         }
1390
1391         ret = account_destroy(account);
1392
1393         if ( ret != ACCOUNT_ERROR_NONE ) {
1394                 dts_fail(API_NAME, "failed");
1395         }
1396
1397         ret = account_disconnect();
1398
1399         if ( ret != ACCOUNT_ERROR_NONE ) {
1400                 dts_fail(API_NAME, "failed");
1401         }
1402 }
1403
1404 static void utc_account_set_sync_support_negative(void)
1405 {
1406         const char *API_NAME = __FUNCTION__;
1407         account_h account;
1408         int account_id = -1;
1409         int ret = ACCOUNT_ERROR_NONE;
1410         ret = account_connect();
1411
1412         if ( ret != ACCOUNT_ERROR_NONE ) {
1413                 dts_fail(API_NAME, "failed");
1414         }
1415
1416         ret = account_create(&account);
1417
1418         if ( ret != ACCOUNT_ERROR_NONE ) {
1419                 dts_fail(API_NAME, "failed");
1420         }
1421         ret = account_set_sync_support(account, -999);
1422
1423         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1424                 dts_pass(API_NAME, "passed");
1425         } else {
1426                 dts_fail(API_NAME, "failed");
1427         }
1428
1429         ret = account_insert_to_db(account, &account_id);
1430
1431         if ( ret != ACCOUNT_ERROR_NONE ) {
1432                 dts_fail(API_NAME, "failed");
1433         }
1434
1435         ret = account_destroy(account);
1436
1437         if ( ret != ACCOUNT_ERROR_NONE ) {
1438                 dts_fail(API_NAME, "failed");
1439         }
1440
1441         ret = account_disconnect();
1442
1443         if ( ret != ACCOUNT_ERROR_NONE ) {
1444                 dts_fail(API_NAME, "failed");
1445         }
1446 }
1447
1448 static void utc_account_set_user_text_positive(void)
1449 {
1450         const char *API_NAME = __FUNCTION__;
1451         account_h account;
1452         int account_id = -1;
1453         int ret = ACCOUNT_ERROR_NONE;
1454         ret = account_connect();
1455
1456         if ( ret != ACCOUNT_ERROR_NONE ) {
1457                 dts_fail(API_NAME, "failed");
1458         }
1459
1460         ret = account_create(&account);
1461
1462         if ( ret != ACCOUNT_ERROR_NONE ) {
1463                 dts_fail(API_NAME, "failed");
1464         }
1465         int i;
1466         for ( i = 0; i < 5; i++)
1467                 ret = account_set_user_text(account, i, "user-text");
1468
1469         if ( ret == ACCOUNT_ERROR_NONE ) {
1470                 dts_pass(API_NAME, "passed");
1471         } else {
1472                 dts_fail(API_NAME, "failed");
1473         }
1474
1475         ret = account_insert_to_db(account, &account_id);
1476
1477         if ( ret != ACCOUNT_ERROR_NONE ) {
1478                 dts_fail(API_NAME, "failed");
1479         }
1480
1481         ret = account_destroy(account);
1482
1483         if ( ret != ACCOUNT_ERROR_NONE ) {
1484                 dts_fail(API_NAME, "failed");
1485         }
1486
1487         ret = account_disconnect();
1488
1489         if ( ret != ACCOUNT_ERROR_NONE ) {
1490                 dts_fail(API_NAME, "failed");
1491         }
1492 }
1493
1494 static void utc_account_set_user_text_negative(void)
1495 {
1496         const char *API_NAME = __FUNCTION__;
1497         account_h account;
1498         int account_id = -1;
1499         int ret = ACCOUNT_ERROR_NONE;
1500         ret = account_connect();
1501
1502         if ( ret != ACCOUNT_ERROR_NONE ) {
1503                 dts_fail(API_NAME, "failed");
1504         }
1505
1506         ret = account_create(&account);
1507
1508         if ( ret != ACCOUNT_ERROR_NONE ) {
1509                 dts_fail(API_NAME, "failed");
1510         }
1511         int i;
1512
1513         for (i = 0; i < 5; i++)
1514                 ret = account_set_user_text(account, i, NULL);
1515
1516         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1517                 dts_pass(API_NAME, "passed");
1518         } else {
1519                 dts_fail(API_NAME, "failed");
1520         }
1521
1522         ret = account_insert_to_db(account, &account_id);
1523
1524         if ( ret != ACCOUNT_ERROR_NONE ) {
1525                 dts_fail(API_NAME, "failed");
1526         }
1527
1528         ret = account_destroy(account);
1529
1530         if ( ret != ACCOUNT_ERROR_NONE ) {
1531                 dts_fail(API_NAME, "failed");
1532         }
1533
1534         ret = account_disconnect();
1535
1536         if ( ret != ACCOUNT_ERROR_NONE ) {
1537                 dts_fail(API_NAME, "failed");
1538         }
1539 }
1540
1541 static void utc_account_set_user_int_positive(void)
1542 {
1543         const char *API_NAME = __FUNCTION__;
1544         account_h account;
1545         int account_id = -1;
1546         int ret = ACCOUNT_ERROR_NONE;
1547         ret = account_connect();
1548
1549         if ( ret != ACCOUNT_ERROR_NONE ) {
1550                 dts_fail(API_NAME, "failed");
1551         }
1552
1553         ret = account_create(&account);
1554
1555         if ( ret != ACCOUNT_ERROR_NONE ) {
1556                 dts_fail(API_NAME, "failed");
1557         }
1558         int i;
1559         for (i = 0; i < 5; i++)
1560                 ret = account_set_user_int(account, i, 999);
1561
1562         if ( ret == ACCOUNT_ERROR_NONE ) {
1563                 dts_pass(API_NAME, "passed");
1564         } else {
1565                 dts_fail(API_NAME, "failed");
1566         }
1567
1568         ret = account_insert_to_db(account, &account_id);
1569
1570         if ( ret != ACCOUNT_ERROR_NONE ) {
1571                 dts_fail(API_NAME, "failed");
1572         }
1573
1574         ret = account_destroy(account);
1575
1576         if ( ret != ACCOUNT_ERROR_NONE ) {
1577                 dts_fail(API_NAME, "failed");
1578         }
1579
1580         ret = account_disconnect();
1581
1582         if ( ret != ACCOUNT_ERROR_NONE ) {
1583                 dts_fail(API_NAME, "failed");
1584         }
1585 }
1586
1587 static void utc_account_set_user_int_negative(void)
1588 {
1589         const char *API_NAME = __FUNCTION__;
1590         account_h account;
1591         int account_id = -1;
1592         int ret = ACCOUNT_ERROR_NONE;
1593         ret = account_connect();
1594
1595         if ( ret != ACCOUNT_ERROR_NONE ) {
1596                 dts_fail(API_NAME, "failed");
1597         }
1598
1599         ret = account_create(&account);
1600
1601         if ( ret != ACCOUNT_ERROR_NONE ) {
1602                 dts_fail(API_NAME, "failed");
1603         }
1604         int i;
1605         for (i = 0; i < 5; i++)
1606                 ret = account_set_user_int(NULL, i, 999);
1607
1608         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1609                 dts_pass(API_NAME, "passed");
1610         } else {
1611                 dts_fail(API_NAME, "failed");
1612         }
1613
1614         ret = account_insert_to_db(account, &account_id);
1615
1616         if ( ret != ACCOUNT_ERROR_NONE ) {
1617                 dts_fail(API_NAME, "failed");
1618         }
1619
1620         ret = account_destroy(account);
1621
1622         if ( ret != ACCOUNT_ERROR_NONE ) {
1623                 dts_fail(API_NAME, "failed");
1624         }
1625
1626         ret = account_disconnect();
1627
1628         if ( ret != ACCOUNT_ERROR_NONE ) {
1629                 dts_fail(API_NAME, "failed");
1630         }
1631 }
1632
1633 static void utc_account_set_capability_positive(void)
1634 {
1635         const char *API_NAME = __FUNCTION__;
1636         account_h account;
1637         int account_id = -1;
1638         int ret = ACCOUNT_ERROR_NONE;
1639         ret = account_connect();
1640
1641         if ( ret != ACCOUNT_ERROR_NONE ) {
1642                 dts_fail(API_NAME, "failed");
1643         }
1644
1645         ret = account_create(&account);
1646
1647         if ( ret != ACCOUNT_ERROR_NONE ) {
1648                 dts_fail(API_NAME, "failed");
1649         }
1650
1651         ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
1652
1653         if ( ret == ACCOUNT_ERROR_NONE ) {
1654                 dts_pass(API_NAME, "passed");
1655         } else {
1656                 dts_fail(API_NAME, "failed");
1657         }
1658
1659         ret = account_insert_to_db(account, &account_id);
1660
1661         if ( ret != ACCOUNT_ERROR_NONE ) {
1662                 dts_fail(API_NAME, "failed");
1663         }
1664
1665         ret = account_destroy(account);
1666
1667         if ( ret != ACCOUNT_ERROR_NONE ) {
1668                 dts_fail(API_NAME, "failed");
1669         }
1670
1671         ret = account_disconnect();
1672
1673         if ( ret != ACCOUNT_ERROR_NONE ) {
1674                 dts_fail(API_NAME, "failed");
1675         }
1676 }
1677
1678 static void utc_account_set_capability_negative(void)
1679 {
1680         const char *API_NAME = __FUNCTION__;
1681         account_h account;
1682         int account_id = -1;
1683         int ret = ACCOUNT_ERROR_NONE;
1684         ret = account_connect();
1685
1686         if ( ret != ACCOUNT_ERROR_NONE ) {
1687                 dts_fail(API_NAME, "failed");
1688         }
1689
1690         ret = account_create(&account);
1691
1692         if ( ret != ACCOUNT_ERROR_NONE ) {
1693                 dts_fail(API_NAME, "failed");
1694         }
1695
1696         ret = account_set_capability(account, -100, -5);
1697
1698         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1699                 dts_pass(API_NAME, "passed");
1700         } else {
1701                 dts_fail(API_NAME, "failed");
1702         }
1703
1704         ret = account_insert_to_db(account, &account_id);
1705
1706         if ( ret != ACCOUNT_ERROR_NONE ) {
1707                 dts_fail(API_NAME, "failed");
1708         }
1709
1710         ret = account_destroy(account);
1711
1712         if ( ret != ACCOUNT_ERROR_NONE ) {
1713                 dts_fail(API_NAME, "failed");
1714         }
1715
1716         ret = account_disconnect();
1717
1718         if ( ret != ACCOUNT_ERROR_NONE ) {
1719                 dts_fail(API_NAME, "failed");
1720         }
1721 }
1722
1723 static void utc_account_get_display_name_positive(void)
1724 {
1725         const char *API_NAME = __FUNCTION__;
1726         char * display_name;
1727         account_h account;
1728         int account_id = -1;
1729         int ret = ACCOUNT_ERROR_NONE;
1730         ret = account_connect();
1731
1732         if ( ret != ACCOUNT_ERROR_NONE ) {
1733                 dts_fail(API_NAME, "failed");
1734         }
1735
1736         ret = account_create(&account);
1737
1738         if ( ret != ACCOUNT_ERROR_NONE ) {
1739                 dts_fail(API_NAME, "failed");
1740         }
1741
1742         ret = account_query_account_by_account_id(1, &account);
1743
1744         if ( ret != ACCOUNT_ERROR_NONE ) {
1745                 dts_fail(API_NAME, "failed");
1746         }
1747
1748         ret = account_get_display_name(account, &display_name);
1749
1750         if ( ret == ACCOUNT_ERROR_NONE ) {
1751                 dts_pass(API_NAME, "passed");
1752         } else {
1753                 dts_fail(API_NAME, "failed");
1754         }
1755
1756         _account_free_text(display_name);
1757
1758         ret = account_destroy(account);
1759
1760         if ( ret != ACCOUNT_ERROR_NONE ) {
1761                 dts_fail(API_NAME, "failed");
1762         }
1763
1764         ret = account_disconnect();
1765
1766         if ( ret != ACCOUNT_ERROR_NONE ) {
1767                 dts_fail(API_NAME, "failed");
1768         }
1769 }
1770
1771 static void utc_account_get_display_name_negative(void)
1772 {
1773         const char *API_NAME = __FUNCTION__;
1774         account_h account;
1775         int account_id = -1;
1776         int ret = ACCOUNT_ERROR_NONE;
1777         ret = account_connect();
1778
1779         if ( ret != ACCOUNT_ERROR_NONE ) {
1780                 dts_fail(API_NAME, "failed");
1781         }
1782
1783         ret = account_create(&account);
1784
1785         if ( ret != ACCOUNT_ERROR_NONE ) {
1786                 dts_fail(API_NAME, "failed");
1787         }
1788
1789
1790         ret = account_query_account_by_account_id(1, &account);
1791
1792         if ( ret != ACCOUNT_ERROR_NONE ) {
1793                 dts_fail(API_NAME, "failed");
1794         }
1795
1796         ret = account_get_display_name(account, NULL);
1797
1798         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1799                 dts_pass(API_NAME, "passed");
1800         } else {
1801                 dts_fail(API_NAME, "failed");
1802         }
1803
1804         ret = account_destroy(account);
1805
1806         if ( ret != ACCOUNT_ERROR_NONE ) {
1807                 dts_fail(API_NAME, "failed");
1808         }
1809
1810         ret = account_disconnect();
1811
1812         if ( ret != ACCOUNT_ERROR_NONE ) {
1813                 dts_fail(API_NAME, "failed");
1814         }
1815 }
1816
1817 static void utc_account_get_account_id_positive(void)
1818 {
1819         const char *API_NAME = __FUNCTION__;
1820         account_h account;
1821         int account_id = -1;
1822         int ret = ACCOUNT_ERROR_NONE;
1823         ret = account_connect();
1824
1825         if ( ret != ACCOUNT_ERROR_NONE ) {
1826                 dts_fail(API_NAME, "failed");
1827         }
1828
1829         ret = account_create(&account);
1830
1831         if ( ret != ACCOUNT_ERROR_NONE ) {
1832                 dts_fail(API_NAME, "failed");
1833         }
1834
1835         ret = account_query_account_by_account_id(1, &account);
1836
1837         if ( ret != ACCOUNT_ERROR_NONE ) {
1838                 dts_fail(API_NAME, "failed");
1839         }
1840
1841         ret = account_get_account_id(account, &account_id);
1842
1843         if ( ret == ACCOUNT_ERROR_NONE ) {
1844                 dts_pass(API_NAME, "passed");
1845         } else {
1846                 dts_fail(API_NAME, "failed");
1847         }
1848
1849         ret = account_destroy(account);
1850
1851         if ( ret != ACCOUNT_ERROR_NONE ) {
1852                 dts_fail(API_NAME, "failed");
1853         }
1854
1855         ret = account_disconnect();
1856
1857         if ( ret != ACCOUNT_ERROR_NONE ) {
1858                 dts_fail(API_NAME, "failed");
1859         }
1860 }
1861
1862 static void utc_account_get_account_id_negative(void)
1863 {
1864         const char *API_NAME = __FUNCTION__;
1865         account_h account;
1866         int account_id = -1;
1867         int ret = ACCOUNT_ERROR_NONE;
1868         ret = account_connect();
1869
1870         if ( ret != ACCOUNT_ERROR_NONE ) {
1871                 dts_fail(API_NAME, "failed");
1872         }
1873
1874         ret = account_create(&account);
1875
1876         if ( ret != ACCOUNT_ERROR_NONE ) {
1877                 dts_fail(API_NAME, "failed");
1878         }
1879
1880         ret = account_query_account_by_account_id(1, &account);
1881
1882         if ( ret != ACCOUNT_ERROR_NONE ) {
1883                 dts_fail(API_NAME, "failed");
1884         }
1885
1886         ret = account_get_account_id(account, NULL);
1887
1888         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1889                 dts_pass(API_NAME, "passed");
1890         } else {
1891                 dts_fail(API_NAME, "failed");
1892         }
1893
1894         ret = account_destroy(account);
1895
1896         if ( ret != ACCOUNT_ERROR_NONE ) {
1897                 dts_fail(API_NAME, "failed");
1898         }
1899
1900         ret = account_disconnect();
1901
1902         if ( ret != ACCOUNT_ERROR_NONE ) {
1903                 dts_fail(API_NAME, "failed");
1904         }
1905 }
1906
1907 static void utc_account_get_user_name_positive(void)
1908 {
1909         const char *API_NAME = __FUNCTION__;
1910         char *user_name;
1911         account_h account;
1912         int account_id = -1;
1913         int ret = ACCOUNT_ERROR_NONE;
1914         ret = account_connect();
1915
1916         if ( ret != ACCOUNT_ERROR_NONE ) {
1917                 dts_fail(API_NAME, "failed");
1918         }
1919
1920         ret = account_create(&account);
1921
1922         if ( ret != ACCOUNT_ERROR_NONE ) {
1923                 dts_fail(API_NAME, "failed");
1924         }
1925
1926         ret = account_query_account_by_account_id(1, &account);
1927
1928         if ( ret != ACCOUNT_ERROR_NONE ) {
1929                 dts_fail(API_NAME, "failed");
1930         }
1931
1932         ret = account_get_user_name(account, &user_name);
1933
1934         if ( ret == ACCOUNT_ERROR_NONE ) {
1935                 dts_pass(API_NAME, "passed");
1936         } else {
1937                 dts_fail(API_NAME, "failed");
1938         }
1939
1940         _account_free_text(user_name);
1941
1942         ret = account_destroy(account);
1943
1944         if ( ret != ACCOUNT_ERROR_NONE ) {
1945                 dts_fail(API_NAME, "failed");
1946         }
1947
1948         ret = account_disconnect();
1949
1950         if ( ret != ACCOUNT_ERROR_NONE ) {
1951                 dts_fail(API_NAME, "failed");
1952         }
1953 }
1954
1955 static void utc_account_get_user_name_negative(void)
1956 {
1957         const char *API_NAME = __FUNCTION__;
1958         account_h account;
1959         int account_id = -1;
1960         int ret = ACCOUNT_ERROR_NONE;
1961         ret = account_connect();
1962
1963         if ( ret != ACCOUNT_ERROR_NONE ) {
1964                 dts_fail(API_NAME, "failed");
1965         }
1966
1967         ret = account_create(&account);
1968
1969         if ( ret != ACCOUNT_ERROR_NONE ) {
1970                 dts_fail(API_NAME, "failed");
1971         }
1972
1973         ret = account_query_account_by_account_id(1, &account);
1974
1975         if ( ret != ACCOUNT_ERROR_NONE ) {
1976                 dts_fail(API_NAME, "failed");
1977         }
1978
1979         ret = account_get_user_name(account, NULL);
1980
1981         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1982                 dts_pass(API_NAME, "passed");
1983         } else {
1984                 dts_fail(API_NAME, "failed");
1985         }
1986
1987         ret = account_destroy(account);
1988
1989         if ( ret != ACCOUNT_ERROR_NONE ) {
1990                 dts_fail(API_NAME, "failed");
1991         }
1992
1993         ret = account_disconnect();
1994
1995         if ( ret != ACCOUNT_ERROR_NONE ) {
1996                 dts_fail(API_NAME, "failed");
1997         }
1998 }
1999
2000 static void utc_account_get_icon_path_positive(void)
2001 {
2002         const char *API_NAME = __FUNCTION__;
2003         char *icon_path;
2004         account_h account;
2005         int account_id = -1;
2006         int ret = ACCOUNT_ERROR_NONE;
2007         ret = account_connect();
2008
2009         if ( ret != ACCOUNT_ERROR_NONE ) {
2010                 dts_fail(API_NAME, "failed");
2011         }
2012
2013         ret = account_create(&account);
2014
2015         if ( ret != ACCOUNT_ERROR_NONE ) {
2016                 dts_fail(API_NAME, "failed");
2017         }
2018
2019         ret = account_query_account_by_account_id(1, &account);
2020
2021         if ( ret != ACCOUNT_ERROR_NONE ) {
2022                 dts_fail(API_NAME, "failed");
2023         }
2024
2025         ret = account_get_icon_path(account, &icon_path);
2026
2027         if ( ret == ACCOUNT_ERROR_NONE ) {
2028                 dts_pass(API_NAME, "passed");
2029         } else {
2030                 dts_fail(API_NAME, "failed");
2031         }
2032
2033         _account_free_text(icon_path);
2034
2035         ret = account_destroy(account);
2036
2037         if ( ret != ACCOUNT_ERROR_NONE ) {
2038                 dts_fail(API_NAME, "failed");
2039         }
2040
2041         ret = account_disconnect();
2042
2043         if ( ret != ACCOUNT_ERROR_NONE ) {
2044                 dts_fail(API_NAME, "failed");
2045         }
2046 }
2047
2048 static void utc_account_get_icon_path_negative(void)
2049 {
2050         const char *API_NAME = __FUNCTION__;
2051         account_h account;
2052         int account_id = -1;
2053         int ret = ACCOUNT_ERROR_NONE;
2054         ret = account_connect();
2055
2056         if ( ret != ACCOUNT_ERROR_NONE ) {
2057                 dts_fail(API_NAME, "failed");
2058         }
2059
2060         ret = account_create(&account);
2061
2062         if ( ret != ACCOUNT_ERROR_NONE ) {
2063                 dts_fail(API_NAME, "failed");
2064         }
2065
2066         ret = account_query_account_by_account_id(1, &account);
2067
2068         if ( ret != ACCOUNT_ERROR_NONE ) {
2069                 dts_fail(API_NAME, "failed");
2070         }
2071
2072         ret = account_get_icon_path(account, NULL);
2073
2074         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2075                 dts_pass(API_NAME, "passed");
2076         } else {
2077                 dts_fail(API_NAME, "failed");
2078         }
2079
2080         ret = account_destroy(account);
2081
2082         if ( ret != ACCOUNT_ERROR_NONE ) {
2083                 dts_fail(API_NAME, "failed");
2084         }
2085
2086         ret = account_disconnect();
2087
2088         if ( ret != ACCOUNT_ERROR_NONE ) {
2089                 dts_fail(API_NAME, "failed");
2090         }
2091 }
2092
2093 static void utc_account_get_domain_name_positive(void)
2094 {
2095         const char *API_NAME = __FUNCTION__;
2096         account_h account;
2097         char *domain_name;
2098         int account_id = -1;
2099         int ret = ACCOUNT_ERROR_NONE;
2100         ret = account_connect();
2101
2102         if ( ret != ACCOUNT_ERROR_NONE ) {
2103                 dts_fail(API_NAME, "failed");
2104         }
2105
2106         ret = account_create(&account);
2107
2108         if ( ret != ACCOUNT_ERROR_NONE ) {
2109                 dts_fail(API_NAME, "failed");
2110         }
2111
2112         ret = account_query_account_by_account_id(1, &account);
2113
2114         if ( ret != ACCOUNT_ERROR_NONE ) {
2115                 dts_fail(API_NAME, "failed");
2116         }
2117
2118         ret = account_get_domain_name(account, &domain_name);
2119
2120         if ( ret == ACCOUNT_ERROR_NONE ) {
2121                 dts_pass(API_NAME, "passed");
2122         } else {
2123                 dts_fail(API_NAME, "failed");
2124         }
2125
2126         _account_free_text(domain_name);
2127
2128         ret = account_destroy(account);
2129
2130         if ( ret != ACCOUNT_ERROR_NONE ) {
2131                 dts_fail(API_NAME, "failed");
2132         }
2133
2134         ret = account_disconnect();
2135
2136         if ( ret != ACCOUNT_ERROR_NONE ) {
2137                 dts_fail(API_NAME, "failed");
2138         }
2139 }
2140
2141 static void utc_account_get_domain_name_negative(void)
2142 {
2143         const char *API_NAME = __FUNCTION__;
2144         account_h account;
2145         int account_id = -1;
2146         int ret = ACCOUNT_ERROR_NONE;
2147         ret = account_connect();
2148
2149         if ( ret != ACCOUNT_ERROR_NONE ) {
2150                 dts_fail(API_NAME, "failed");
2151         }
2152
2153         ret = account_create(&account);
2154
2155         if ( ret != ACCOUNT_ERROR_NONE ) {
2156                 dts_fail(API_NAME, "failed");
2157         }
2158
2159         ret = account_query_account_by_account_id(1, &account);
2160
2161         if ( ret != ACCOUNT_ERROR_NONE ) {
2162                 dts_fail(API_NAME, "failed");
2163         }
2164
2165         ret = account_get_domain_name(account, NULL);
2166
2167         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2168                 dts_pass(API_NAME, "passed");
2169         } else {
2170                 dts_fail(API_NAME, "failed");
2171         }
2172
2173         ret = account_destroy(account);
2174
2175         if ( ret != ACCOUNT_ERROR_NONE ) {
2176                 dts_fail(API_NAME, "failed");
2177         }
2178
2179         ret = account_disconnect();
2180
2181         if ( ret != ACCOUNT_ERROR_NONE ) {
2182                 dts_fail(API_NAME, "failed");
2183         }
2184 }
2185
2186 static void utc_account_get_email_address_positive(void)
2187 {
2188         const char *API_NAME = __FUNCTION__;
2189         account_h account;
2190         char *email_address;
2191         int account_id = -1;
2192         int ret = ACCOUNT_ERROR_NONE;
2193         ret = account_connect();
2194
2195         if ( ret != ACCOUNT_ERROR_NONE ) {
2196                 dts_fail(API_NAME, "failed");
2197         }
2198
2199         ret = account_create(&account);
2200
2201         if ( ret != ACCOUNT_ERROR_NONE ) {
2202                 dts_fail(API_NAME, "failed");
2203         }
2204
2205         ret = account_query_account_by_account_id(1, &account);
2206
2207         if ( ret != ACCOUNT_ERROR_NONE ) {
2208                 dts_fail(API_NAME, "failed");
2209         }
2210
2211         ret = account_get_email_address(account, &email_address);
2212
2213         if ( ret == ACCOUNT_ERROR_NONE ) {
2214                 dts_pass(API_NAME, "passed");
2215         } else {
2216                 dts_fail(API_NAME, "failed");
2217         }
2218
2219         _account_free_text(email_address);
2220
2221         ret = account_destroy(account);
2222
2223         if ( ret != ACCOUNT_ERROR_NONE ) {
2224                 dts_fail(API_NAME, "failed");
2225         }
2226
2227         ret = account_disconnect();
2228
2229         if ( ret != ACCOUNT_ERROR_NONE ) {
2230                 dts_fail(API_NAME, "failed");
2231         }
2232 }
2233
2234 static void utc_account_get_email_address_negative(void)
2235 {
2236         const char *API_NAME = __FUNCTION__;
2237         account_h account;
2238         int account_id = -1;
2239         int ret = ACCOUNT_ERROR_NONE;
2240         ret = account_connect();
2241
2242         if ( ret != ACCOUNT_ERROR_NONE ) {
2243                 dts_fail(API_NAME, "failed");
2244         }
2245
2246         ret = account_create(&account);
2247
2248         if ( ret != ACCOUNT_ERROR_NONE ) {
2249                 dts_fail(API_NAME, "failed");
2250         }
2251
2252         ret = account_query_account_by_account_id(1, &account);
2253
2254         if ( ret != ACCOUNT_ERROR_NONE ) {
2255                 dts_fail(API_NAME, "failed");
2256         }
2257
2258         ret = account_get_email_address(account, NULL);
2259
2260         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2261                 dts_pass(API_NAME, "passed");
2262         } else {
2263                 dts_fail(API_NAME, "failed");
2264         }
2265
2266         ret = account_destroy(account);
2267
2268         if ( ret != ACCOUNT_ERROR_NONE ) {
2269                 dts_fail(API_NAME, "failed");
2270         }
2271
2272         ret = account_disconnect();
2273
2274         if ( ret != ACCOUNT_ERROR_NONE ) {
2275                 dts_fail(API_NAME, "failed");
2276         }
2277 }
2278
2279 static void utc_account_get_source_positive(void)
2280 {
2281         const char *API_NAME = __FUNCTION__;
2282         account_h account;
2283         char *source;
2284         int account_id = -1;
2285         int ret = ACCOUNT_ERROR_NONE;
2286         ret = account_connect();
2287
2288         if ( ret != ACCOUNT_ERROR_NONE ) {
2289                 dts_fail(API_NAME, "failed");
2290         }
2291
2292         ret = account_create(&account);
2293
2294         if ( ret != ACCOUNT_ERROR_NONE ) {
2295                 dts_fail(API_NAME, "failed");
2296         }
2297
2298         ret = account_query_account_by_account_id(1, &account);
2299
2300         if ( ret != ACCOUNT_ERROR_NONE ) {
2301                 dts_fail(API_NAME, "failed");
2302         }
2303
2304         ret = account_get_source(account, &source);
2305
2306         if ( ret == ACCOUNT_ERROR_NONE ) {
2307                 dts_pass(API_NAME, "passed");
2308         } else {
2309                 dts_fail(API_NAME, "failed");
2310         }
2311
2312         _account_free_text(source);
2313
2314         ret = account_destroy(account);
2315
2316         if ( ret != ACCOUNT_ERROR_NONE ) {
2317                 dts_fail(API_NAME, "failed");
2318         }
2319
2320         ret = account_disconnect();
2321
2322         if ( ret != ACCOUNT_ERROR_NONE ) {
2323                 dts_fail(API_NAME, "failed");
2324         }
2325 }
2326
2327 static void utc_account_get_source_negative(void)
2328 {
2329         const char *API_NAME = __FUNCTION__;
2330         account_h account;
2331         int account_id = -1;
2332         int ret = ACCOUNT_ERROR_NONE;
2333         ret = account_connect();
2334
2335         if ( ret != ACCOUNT_ERROR_NONE ) {
2336                 dts_fail(API_NAME, "failed");
2337         }
2338
2339         ret = account_create(&account);
2340
2341         if ( ret != ACCOUNT_ERROR_NONE ) {
2342                 dts_fail(API_NAME, "failed");
2343         }
2344
2345         ret = account_query_account_by_account_id(1, &account);
2346
2347         if ( ret != ACCOUNT_ERROR_NONE ) {
2348                 dts_fail(API_NAME, "failed");
2349         }
2350
2351         ret = account_get_source(account, NULL);
2352
2353         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2354                 dts_pass(API_NAME, "passed");
2355         } else {
2356                 dts_fail(API_NAME, "failed");
2357         }
2358
2359         ret = account_destroy(account);
2360
2361         if ( ret != ACCOUNT_ERROR_NONE ) {
2362                 dts_fail(API_NAME, "failed");
2363         }
2364
2365         ret = account_disconnect();
2366
2367         if ( ret != ACCOUNT_ERROR_NONE ) {
2368                 dts_fail(API_NAME, "failed");
2369         }
2370 }
2371
2372 static void utc_account_get_package_name_positive(void)
2373 {
2374         const char *API_NAME = __FUNCTION__;
2375         account_h account;
2376         char *package_name;
2377         int account_id = -1;
2378         int ret = ACCOUNT_ERROR_NONE;
2379         ret = account_connect();
2380
2381         if ( ret != ACCOUNT_ERROR_NONE ) {
2382                 dts_fail(API_NAME, "failed");
2383         }
2384
2385         ret = account_create(&account);
2386
2387         if ( ret != ACCOUNT_ERROR_NONE ) {
2388                 dts_fail(API_NAME, "failed");
2389         }
2390
2391         ret = account_query_account_by_account_id(1, &account);
2392
2393         if ( ret != ACCOUNT_ERROR_NONE ) {
2394                 dts_fail(API_NAME, "failed");
2395         }
2396
2397         ret = account_get_package_name(account, &package_name);
2398
2399         if ( ret == ACCOUNT_ERROR_NONE ) {
2400                 dts_pass(API_NAME, "passed");
2401         } else {
2402                 dts_fail(API_NAME, "failed");
2403         }
2404
2405         _account_free_text(package_name);
2406
2407         ret = account_destroy(account);
2408
2409         if ( ret != ACCOUNT_ERROR_NONE ) {
2410                 dts_fail(API_NAME, "failed");
2411         }
2412
2413         ret = account_disconnect();
2414
2415         if ( ret != ACCOUNT_ERROR_NONE ) {
2416                 dts_fail(API_NAME, "failed");
2417         }
2418 }
2419
2420 static void utc_account_get_package_name_negative(void)
2421 {
2422         const char *API_NAME = __FUNCTION__;
2423         account_h account;
2424         int account_id = -1;
2425         int ret = ACCOUNT_ERROR_NONE;
2426         ret = account_connect();
2427
2428         if ( ret != ACCOUNT_ERROR_NONE ) {
2429                 dts_fail(API_NAME, "failed");
2430         }
2431
2432         ret = account_create(&account);
2433
2434         if ( ret != ACCOUNT_ERROR_NONE ) {
2435                 dts_fail(API_NAME, "failed");
2436         }
2437
2438         ret = account_query_account_by_account_id(1, &account);
2439
2440         if ( ret != ACCOUNT_ERROR_NONE ) {
2441                 dts_fail(API_NAME, "failed");
2442         }
2443
2444         ret = account_get_package_name(account, NULL);
2445
2446         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2447                 dts_pass(API_NAME, "passed");
2448         } else {
2449                 dts_fail(API_NAME, "failed");
2450         }
2451
2452         ret = account_destroy(account);
2453
2454         if ( ret != ACCOUNT_ERROR_NONE ) {
2455                 dts_fail(API_NAME, "failed");
2456         }
2457
2458         ret = account_disconnect();
2459
2460         if ( ret != ACCOUNT_ERROR_NONE ) {
2461                 dts_fail(API_NAME, "failed");
2462         }
2463 }
2464
2465 static void utc_account_get_access_token_positive(void)
2466 {
2467         const char *API_NAME = __FUNCTION__;
2468         account_h account;
2469         char *access_token;
2470         int account_id = -1;
2471         int ret = ACCOUNT_ERROR_NONE;
2472         ret = account_connect();
2473
2474         if ( ret != ACCOUNT_ERROR_NONE ) {
2475                 dts_fail(API_NAME, "failed");
2476         }
2477
2478         ret = account_create(&account);
2479
2480         if ( ret != ACCOUNT_ERROR_NONE ) {
2481                 dts_fail(API_NAME, "failed");
2482         }
2483
2484         ret = account_query_account_by_account_id(1, &account);
2485
2486         if ( ret != ACCOUNT_ERROR_NONE ) {
2487                 dts_fail(API_NAME, "failed");
2488         }
2489
2490         ret = account_get_access_token(account, &access_token);
2491
2492         if ( ret == ACCOUNT_ERROR_NONE ) {
2493                 dts_pass(API_NAME, "passed");
2494         } else {
2495                 dts_fail(API_NAME, "failed");
2496         }
2497
2498         _account_free_text(access_token);
2499
2500         ret = account_destroy(account);
2501
2502         if ( ret != ACCOUNT_ERROR_NONE ) {
2503                 dts_fail(API_NAME, "failed");
2504         }
2505
2506         ret = account_disconnect();
2507
2508         if ( ret != ACCOUNT_ERROR_NONE ) {
2509                 dts_fail(API_NAME, "failed");
2510         }
2511 }
2512
2513 static void utc_account_get_access_token_negative(void)
2514 {
2515         const char *API_NAME = __FUNCTION__;
2516         account_h account;
2517         int account_id = -1;
2518         int ret = ACCOUNT_ERROR_NONE;
2519         ret = account_connect();
2520
2521         if ( ret != ACCOUNT_ERROR_NONE ) {
2522                 dts_fail(API_NAME, "failed");
2523         }
2524
2525         ret = account_create(&account);
2526
2527         if ( ret != ACCOUNT_ERROR_NONE ) {
2528                 dts_fail(API_NAME, "failed");
2529         }
2530
2531         ret = account_query_account_by_account_id(1, &account);
2532
2533         if ( ret != ACCOUNT_ERROR_NONE ) {
2534                 dts_fail(API_NAME, "failed");
2535         }
2536
2537         ret = account_get_access_token(account, NULL);
2538
2539         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2540                 dts_pass(API_NAME, "passed");
2541         } else {
2542                 dts_fail(API_NAME, "failed");
2543         }
2544
2545         ret = account_destroy(account);
2546
2547         if ( ret != ACCOUNT_ERROR_NONE ) {
2548                 dts_fail(API_NAME, "failed");
2549         }
2550
2551         ret = account_disconnect();
2552
2553         if ( ret != ACCOUNT_ERROR_NONE ) {
2554                 dts_fail(API_NAME, "failed");
2555         }
2556 }
2557
2558 static void utc_account_get_auth_type_positive(void)
2559 {
2560         const char *API_NAME = __FUNCTION__;
2561         account_h account;
2562         int auth_type;
2563         int account_id = -1;
2564         int ret = ACCOUNT_ERROR_NONE;
2565         ret = account_connect();
2566
2567         if ( ret != ACCOUNT_ERROR_NONE ) {
2568                 dts_fail(API_NAME, "failed");
2569         }
2570
2571         ret = account_create(&account);
2572
2573         if ( ret != ACCOUNT_ERROR_NONE ) {
2574                 dts_fail(API_NAME, "failed");
2575         }
2576
2577         ret = account_query_account_by_account_id(1, &account);
2578
2579         if ( ret != ACCOUNT_ERROR_NONE ) {
2580                 dts_fail(API_NAME, "failed");
2581         }
2582
2583         ret = account_get_auth_type(account, &auth_type);
2584
2585         if ( ret == ACCOUNT_ERROR_NONE ) {
2586                 dts_pass(API_NAME, "passed");
2587         } else {
2588                 dts_fail(API_NAME, "failed");
2589         }
2590
2591         ret = account_destroy(account);
2592
2593         if ( ret != ACCOUNT_ERROR_NONE ) {
2594                 dts_fail(API_NAME, "failed");
2595         }
2596
2597         ret = account_disconnect();
2598
2599         if ( ret != ACCOUNT_ERROR_NONE ) {
2600                 dts_fail(API_NAME, "failed");
2601         }
2602 }
2603
2604 static void utc_account_get_auth_type_negative(void)
2605 {
2606         const char *API_NAME = __FUNCTION__;
2607         account_h account;
2608         int account_id = -1;
2609         int ret = ACCOUNT_ERROR_NONE;
2610         ret = account_connect();
2611
2612         if ( ret != ACCOUNT_ERROR_NONE ) {
2613                 dts_fail(API_NAME, "failed");
2614         }
2615
2616         ret = account_create(&account);
2617
2618         if ( ret != ACCOUNT_ERROR_NONE ) {
2619                 dts_fail(API_NAME, "failed");
2620         }
2621
2622         ret = account_query_account_by_account_id(1, &account);
2623
2624         if ( ret != ACCOUNT_ERROR_NONE ) {
2625                 dts_fail(API_NAME, "failed");
2626         }
2627
2628         ret = account_get_auth_type(account, NULL);
2629
2630         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2631                 dts_pass(API_NAME, "passed");
2632         } else {
2633                 dts_fail(API_NAME, "failed");
2634         }
2635
2636         ret = account_destroy(account);
2637
2638         if ( ret != ACCOUNT_ERROR_NONE ) {
2639                 dts_fail(API_NAME, "failed");
2640         }
2641
2642         ret = account_disconnect();
2643
2644         if ( ret != ACCOUNT_ERROR_NONE ) {
2645                 dts_fail(API_NAME, "failed");
2646         }
2647 }
2648
2649 static void utc_account_get_secret_positive(void)
2650 {
2651         const char *API_NAME = __FUNCTION__;
2652         account_h account;
2653         account_secrecy_state_e secret;
2654         int account_id = -1;
2655         int ret = ACCOUNT_ERROR_NONE;
2656         ret = account_connect();
2657
2658         if ( ret != ACCOUNT_ERROR_NONE ) {
2659                 dts_fail(API_NAME, "failed");
2660         }
2661
2662         ret = account_create(&account);
2663
2664         if ( ret != ACCOUNT_ERROR_NONE ) {
2665                 dts_fail(API_NAME, "failed");
2666         }
2667
2668         ret = account_query_account_by_account_id(1, &account);
2669
2670         if ( ret != ACCOUNT_ERROR_NONE ) {
2671                 dts_fail(API_NAME, "failed");
2672         }
2673
2674         ret = account_get_secret(account, &secret);
2675
2676         if ( ret == ACCOUNT_ERROR_NONE ) {
2677                 dts_pass(API_NAME, "passed");
2678         } else {
2679                 dts_fail(API_NAME, "failed");
2680         }
2681
2682         ret = account_destroy(account);
2683
2684         if ( ret != ACCOUNT_ERROR_NONE ) {
2685                 dts_fail(API_NAME, "failed");
2686         }
2687
2688         ret = account_disconnect();
2689
2690         if ( ret != ACCOUNT_ERROR_NONE ) {
2691                 dts_fail(API_NAME, "failed");
2692         }
2693 }
2694
2695 static void utc_account_get_sync_support_positive(void)
2696 {
2697         const char *API_NAME = __FUNCTION__;
2698         account_h account;
2699         account_sync_state_e sync_support;
2700         int account_id = -1;
2701         int ret = ACCOUNT_ERROR_NONE;
2702         ret = account_connect();
2703
2704         if ( ret != ACCOUNT_ERROR_NONE ) {
2705                 dts_fail(API_NAME, "failed");
2706         }
2707
2708         ret = account_create(&account);
2709
2710         if ( ret != ACCOUNT_ERROR_NONE ) {
2711                 dts_fail(API_NAME, "failed");
2712         }
2713
2714         ret = account_query_account_by_account_id(1, &account);
2715
2716         if ( ret != ACCOUNT_ERROR_NONE ) {
2717                 dts_fail(API_NAME, "failed");
2718         }
2719
2720         ret = account_get_sync_support(account, &sync_support);
2721
2722         if ( ret == ACCOUNT_ERROR_NONE ) {
2723                 dts_pass(API_NAME, "passed");
2724         } else {
2725                 dts_fail(API_NAME, "failed");
2726         }
2727
2728         ret = account_destroy(account);
2729
2730         if ( ret != ACCOUNT_ERROR_NONE ) {
2731                 dts_fail(API_NAME, "failed");
2732         }
2733
2734         ret = account_disconnect();
2735
2736         if ( ret != ACCOUNT_ERROR_NONE ) {
2737                 dts_fail(API_NAME, "failed");
2738         }
2739 }
2740
2741 static void utc_account_get_secret_negative(void)
2742 {
2743         const char *API_NAME = __FUNCTION__;
2744         account_h account;
2745         int account_id = -1;
2746         int ret = ACCOUNT_ERROR_NONE;
2747         ret = account_connect();
2748
2749         if ( ret != ACCOUNT_ERROR_NONE ) {
2750                 dts_fail(API_NAME, "failed");
2751         }
2752
2753         ret = account_create(&account);
2754
2755         if ( ret != ACCOUNT_ERROR_NONE ) {
2756                 dts_fail(API_NAME, "failed");
2757         }
2758
2759         ret = account_query_account_by_account_id(1, &account);
2760
2761         if ( ret != ACCOUNT_ERROR_NONE ) {
2762                 dts_fail(API_NAME, "failed");
2763         }
2764
2765         ret = account_get_secret(account, NULL);
2766
2767         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2768                 dts_pass(API_NAME, "passed");
2769         } else {
2770                 dts_fail(API_NAME, "failed");
2771         }
2772
2773         ret = account_destroy(account);
2774
2775         if ( ret != ACCOUNT_ERROR_NONE ) {
2776                 dts_fail(API_NAME, "failed");
2777         }
2778
2779         ret = account_disconnect();
2780
2781         if ( ret != ACCOUNT_ERROR_NONE ) {
2782                 dts_fail(API_NAME, "failed");
2783         }
2784 }
2785
2786 static void utc_account_get_sync_support_negative(void)
2787 {
2788         const char *API_NAME = __FUNCTION__;
2789         account_h account;
2790         int account_id = -1;
2791         int ret = ACCOUNT_ERROR_NONE;
2792         ret = account_connect();
2793
2794         if ( ret != ACCOUNT_ERROR_NONE ) {
2795                 dts_fail(API_NAME, "failed");
2796         }
2797
2798         ret = account_create(&account);
2799
2800         if ( ret != ACCOUNT_ERROR_NONE ) {
2801                 dts_fail(API_NAME, "failed");
2802         }
2803
2804         ret = account_query_account_by_account_id(1, &account);
2805
2806         if ( ret != ACCOUNT_ERROR_NONE ) {
2807                 dts_fail(API_NAME, "failed");
2808         }
2809
2810         ret = account_get_sync_support(account, NULL);
2811
2812         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2813                 dts_pass(API_NAME, "passed");
2814         } else {
2815                 dts_fail(API_NAME, "failed");
2816         }
2817
2818         ret = account_destroy(account);
2819
2820         if ( ret != ACCOUNT_ERROR_NONE ) {
2821                 dts_fail(API_NAME, "failed");
2822         }
2823
2824         ret = account_disconnect();
2825
2826         if ( ret != ACCOUNT_ERROR_NONE ) {
2827                 dts_fail(API_NAME, "failed");
2828         }
2829 }
2830
2831 static void utc_account_get_user_text_positive(void)
2832 {
2833         const char *API_NAME = __FUNCTION__;
2834         account_h account;
2835         char *user_text;
2836         int account_id = -1;
2837         int ret = ACCOUNT_ERROR_NONE;
2838         ret = account_connect();
2839
2840         if ( ret != ACCOUNT_ERROR_NONE ) {
2841                 dts_fail(API_NAME, "failed");
2842         }
2843
2844         ret = account_create(&account);
2845
2846         if ( ret != ACCOUNT_ERROR_NONE ) {
2847                 dts_fail(API_NAME, "failed");
2848         }
2849
2850         ret = account_query_account_by_account_id(1, &account);
2851
2852         if ( ret != ACCOUNT_ERROR_NONE ) {
2853                 dts_fail(API_NAME, "failed");
2854         }
2855         int i;
2856         for (i = 0; i < 5; i++) {
2857                 ret = account_get_user_text(account, i, &user_text);
2858                 _account_free_text(user_text);
2859         }
2860
2861         if ( ret == ACCOUNT_ERROR_NONE ) {
2862                 dts_pass(API_NAME, "passed");
2863         } else {
2864                 dts_fail(API_NAME, "failed");
2865         }
2866
2867         ret = account_destroy(account);
2868
2869         if ( ret != ACCOUNT_ERROR_NONE ) {
2870                 dts_fail(API_NAME, "failed");
2871         }
2872
2873         ret = account_disconnect();
2874
2875         if ( ret != ACCOUNT_ERROR_NONE ) {
2876                 dts_fail(API_NAME, "failed");
2877         }
2878 }
2879
2880 static void utc_account_get_user_text_negative(void)
2881 {
2882         const char *API_NAME = __FUNCTION__;
2883         account_h account;
2884         int account_id = -1;
2885         int ret = ACCOUNT_ERROR_NONE;
2886         ret = account_connect();
2887
2888         if ( ret != ACCOUNT_ERROR_NONE ) {
2889                 dts_fail(API_NAME, "failed");
2890         }
2891
2892         ret = account_create(&account);
2893
2894         if ( ret != ACCOUNT_ERROR_NONE ) {
2895                 dts_fail(API_NAME, "failed");
2896         }
2897
2898         ret = account_query_account_by_account_id(1, &account);
2899
2900         if ( ret != ACCOUNT_ERROR_NONE ) {
2901                 dts_fail(API_NAME, "failed");
2902         }
2903         int i;
2904         for (i = 0; i < 5; i++)
2905                 ret = account_get_user_text(account, i, NULL);
2906
2907         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2908                 dts_pass(API_NAME, "passed");
2909         } else {
2910                 dts_fail(API_NAME, "failed");
2911         }
2912
2913         ret = account_destroy(account);
2914
2915         if ( ret != ACCOUNT_ERROR_NONE ) {
2916                 dts_fail(API_NAME, "failed");
2917         }
2918
2919         ret = account_disconnect();
2920
2921         if ( ret != ACCOUNT_ERROR_NONE ) {
2922                 dts_fail(API_NAME, "failed");
2923         }
2924 }
2925
2926 static void utc_account_get_user_int_positive(void)
2927 {
2928         const char *API_NAME = __FUNCTION__;
2929         account_h account;
2930         int user_int;
2931         int account_id = -1;
2932         int ret = ACCOUNT_ERROR_NONE;
2933         ret = account_connect();
2934
2935         if ( ret != ACCOUNT_ERROR_NONE ) {
2936                 dts_fail(API_NAME, "failed");
2937         }
2938
2939         ret = account_create(&account);
2940
2941         if ( ret != ACCOUNT_ERROR_NONE ) {
2942                 dts_fail(API_NAME, "failed");
2943         }
2944
2945         ret = account_query_account_by_account_id(1, &account);
2946
2947         if ( ret != ACCOUNT_ERROR_NONE ) {
2948                 dts_fail(API_NAME, "failed");
2949         }
2950         int i;
2951         for (i = 0; i < 5; i++)
2952                 ret = account_get_user_int(account, i, &user_int);
2953
2954         if ( ret == ACCOUNT_ERROR_NONE ) {
2955                 dts_pass(API_NAME, "passed");
2956         } else {
2957                 dts_fail(API_NAME, "failed");
2958         }
2959
2960         ret = account_insert_to_db(account, &account_id);
2961
2962         if ( ret != ACCOUNT_ERROR_NONE ) {
2963                 dts_fail(API_NAME, "failed");
2964         }
2965
2966         ret = account_destroy(account);
2967
2968         if ( ret != ACCOUNT_ERROR_NONE ) {
2969                 dts_fail(API_NAME, "failed");
2970         }
2971
2972         ret = account_disconnect();
2973
2974         if ( ret != ACCOUNT_ERROR_NONE ) {
2975                 dts_fail(API_NAME, "failed");
2976         }
2977 }
2978
2979 static void utc_account_get_user_int_negative(void)
2980 {
2981         const char *API_NAME = __FUNCTION__;
2982         account_h account;
2983         int account_id = -1;
2984         int ret = ACCOUNT_ERROR_NONE;
2985         ret = account_connect();
2986
2987         if ( ret != ACCOUNT_ERROR_NONE ) {
2988                 dts_fail(API_NAME, "failed");
2989         }
2990
2991         ret = account_create(&account);
2992
2993         if ( ret != ACCOUNT_ERROR_NONE ) {
2994                 dts_fail(API_NAME, "failed");
2995         }
2996
2997         ret = account_query_account_by_account_id(1, &account);
2998
2999         if ( ret != ACCOUNT_ERROR_NONE ) {
3000                 dts_fail(API_NAME, "failed");
3001         }
3002         int i;
3003         for (i = 0; i < 5; i++)
3004                 ret = account_get_user_int(NULL, i, NULL);
3005
3006         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3007                 dts_pass(API_NAME, "passed");
3008         } else {
3009                 dts_fail(API_NAME, "failed");
3010         }
3011
3012         ret = account_destroy(account);
3013
3014         if ( ret != ACCOUNT_ERROR_NONE ) {
3015                 dts_fail(API_NAME, "failed");
3016         }
3017
3018         ret = account_disconnect();
3019
3020         if ( ret != ACCOUNT_ERROR_NONE ) {
3021                 dts_fail(API_NAME, "failed");
3022         }
3023 }
3024 bool capability_call_back(account_capability_type_e capability_type, account_capability_state_e capability_state, void *user_data)
3025 {
3026
3027 }
3028
3029 static void utc_account_get_capability_positive(void)
3030 {
3031         const char *API_NAME = __FUNCTION__;
3032         account_h account;
3033         int account_id = -1;
3034         int ret = ACCOUNT_ERROR_NONE;
3035         ret = account_connect();
3036
3037         if ( ret != ACCOUNT_ERROR_NONE ) {
3038                 dts_fail(API_NAME, "failed");
3039         }
3040
3041         ret = account_create(&account);
3042
3043         if ( ret != ACCOUNT_ERROR_NONE ) {
3044                 dts_fail(API_NAME, "failed");
3045         }
3046
3047         ret = account_query_account_by_account_id(1, &account);
3048
3049         if ( ret != ACCOUNT_ERROR_NONE ) {
3050                 dts_fail(API_NAME, "failed");
3051         }
3052
3053         ret = account_get_capability(account, capability_call_back, NULL);
3054
3055         if ( ret == ACCOUNT_ERROR_NONE ) {
3056                 dts_pass(API_NAME, "passed");
3057         } else {
3058                 dts_fail(API_NAME, "failed");
3059         }
3060
3061         ret = account_destroy(account);
3062
3063         if ( ret != ACCOUNT_ERROR_NONE ) {
3064                 dts_fail(API_NAME, "failed");
3065         }
3066
3067         ret = account_disconnect();
3068
3069         if ( ret != ACCOUNT_ERROR_NONE ) {
3070                 dts_fail(API_NAME, "failed");
3071         }
3072 }
3073
3074 static void utc_account_get_capability_negative(void)
3075 {
3076         const char *API_NAME = __FUNCTION__;
3077         account_h account;
3078         int account_id = -1;
3079         int ret = ACCOUNT_ERROR_NONE;
3080         ret = account_connect();
3081
3082         if ( ret != ACCOUNT_ERROR_NONE ) {
3083                 dts_fail(API_NAME, "failed");
3084         }
3085
3086         ret = account_create(&account);
3087
3088         if ( ret != ACCOUNT_ERROR_NONE ) {
3089                 dts_fail(API_NAME, "failed");
3090         }
3091
3092         ret = account_query_account_by_account_id(1, &account);
3093
3094         if ( ret != ACCOUNT_ERROR_NONE ) {
3095                 dts_fail(API_NAME, "failed");
3096         }
3097
3098         ret = account_get_capability(account, NULL, NULL);
3099
3100         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3101                 dts_pass(API_NAME, "passed");
3102         } else {
3103                 dts_fail(API_NAME, "failed");
3104         }
3105
3106         ret = account_destroy(account);
3107
3108         if ( ret != ACCOUNT_ERROR_NONE ) {
3109                 dts_fail(API_NAME, "failed");
3110         }
3111
3112         ret = account_disconnect();
3113
3114         if ( ret != ACCOUNT_ERROR_NONE ) {
3115                 dts_fail(API_NAME, "failed");
3116         }
3117 }
3118
3119 bool account_call_back(account_h account, void *user_data)
3120 {
3121
3122 }
3123
3124 static void utc_account_foreach_account_from_db_positive(void)
3125 {
3126         const char *API_NAME = __FUNCTION__;
3127         account_h account;
3128         int account_id = -1;
3129         int ret = ACCOUNT_ERROR_NONE;
3130         ret = account_connect();
3131
3132         if ( ret != ACCOUNT_ERROR_NONE ) {
3133                 dts_fail(API_NAME, "failed");
3134         }
3135
3136         ret = account_foreach_account_from_db(account_call_back, NULL);
3137
3138         if ( ret == ACCOUNT_ERROR_NONE ) {
3139                 dts_pass(API_NAME, "passed");
3140         } else {
3141                 dts_fail(API_NAME, "failed");
3142         }
3143
3144         ret = account_disconnect();
3145
3146         if ( ret != ACCOUNT_ERROR_NONE ) {
3147                 dts_fail(API_NAME, "failed");
3148         }
3149 }
3150
3151 static void utc_account_foreach_account_from_db_negative(void)
3152 {
3153         const char *API_NAME = __FUNCTION__;
3154         account_h account;
3155         int account_id = -1;
3156         int ret = ACCOUNT_ERROR_NONE;
3157         ret = account_connect();
3158
3159         if ( ret != ACCOUNT_ERROR_NONE ) {
3160                 dts_fail(API_NAME, "failed");
3161         }
3162
3163         ret = account_foreach_account_from_db(NULL, NULL);
3164
3165         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3166                 dts_pass(API_NAME, "passed");
3167         } else {
3168                 dts_fail(API_NAME, "failed");
3169         }
3170
3171         ret = account_disconnect();
3172
3173         if ( ret != ACCOUNT_ERROR_NONE ) {
3174                 dts_fail(API_NAME, "failed");
3175         }
3176 }
3177
3178 static void utc_account_query_account_by_account_id_positive(void)
3179 {
3180         const char *API_NAME = __FUNCTION__;
3181         account_h account;
3182         int account_id = -1;
3183         int ret = ACCOUNT_ERROR_NONE;
3184         ret = account_connect();
3185
3186         if ( ret != ACCOUNT_ERROR_NONE ) {
3187                 dts_fail(API_NAME, "failed");
3188         }
3189
3190         ret = account_create(&account);
3191
3192         if ( ret != ACCOUNT_ERROR_NONE ) {
3193                 dts_fail(API_NAME, "failed");
3194         }
3195
3196         ret = account_query_account_by_account_id(1, &account);
3197
3198         if ( ret == ACCOUNT_ERROR_NONE ) {
3199                 dts_pass(API_NAME, "passed");
3200         } else {
3201                 dts_fail(API_NAME, "failed");
3202         }
3203
3204         ret = account_destroy(account);
3205
3206         if ( ret != ACCOUNT_ERROR_NONE ) {
3207                 dts_fail(API_NAME, "failed");
3208         }
3209
3210         ret = account_disconnect();
3211
3212         if ( ret != ACCOUNT_ERROR_NONE ) {
3213                 dts_fail(API_NAME, "failed");
3214         }
3215 }
3216
3217 static void utc_account_query_account_by_account_id_negative(void)
3218 {
3219         const char *API_NAME = __FUNCTION__;
3220         account_h account;
3221         int account_id = -1;
3222         int ret = ACCOUNT_ERROR_NONE;
3223         ret = account_connect();
3224
3225         if ( ret != ACCOUNT_ERROR_NONE ) {
3226                 dts_fail(API_NAME, "failed");
3227         }
3228
3229         ret = account_create(&account);
3230
3231         if ( ret != ACCOUNT_ERROR_NONE ) {
3232                 dts_fail(API_NAME, "failed");
3233         }
3234
3235         ret = account_query_account_by_account_id(-999, NULL);
3236
3237         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3238                 dts_pass(API_NAME, "passed");
3239         } else {
3240                 dts_fail(API_NAME, "failed");
3241         }
3242
3243         ret = account_destroy(account);
3244
3245         if ( ret != ACCOUNT_ERROR_NONE ) {
3246                 dts_fail(API_NAME, "failed");
3247         }
3248
3249         ret = account_disconnect();
3250
3251         if ( ret != ACCOUNT_ERROR_NONE ) {
3252                 dts_fail(API_NAME, "failed");
3253         }
3254 }
3255
3256 static void utc_account_query_account_by_user_name_positive(void)
3257 {
3258         const char *API_NAME = __FUNCTION__;
3259         account_h account;
3260         int account_id = -1;
3261         int ret = ACCOUNT_ERROR_NONE;
3262         ret = account_connect();
3263
3264         if ( ret != ACCOUNT_ERROR_NONE ) {
3265                 dts_fail(API_NAME, "failed");
3266         }
3267
3268         ret = account_query_account_by_user_name(account_call_back, "tarun.kr", NULL);
3269
3270         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3271                 dts_pass(API_NAME, "passed");
3272         } else {
3273                 dts_fail(API_NAME, "failed");
3274         }
3275
3276         ret = account_disconnect();
3277
3278         if ( ret != ACCOUNT_ERROR_NONE ) {
3279                 dts_fail(API_NAME, "failed");
3280         }
3281 }
3282
3283 static void utc_account_query_account_by_user_name_negative(void)
3284 {
3285         const char *API_NAME = __FUNCTION__;
3286         account_h account;
3287         int account_id = -1;
3288         int ret = ACCOUNT_ERROR_NONE;
3289         ret = account_connect();
3290
3291         if ( ret != ACCOUNT_ERROR_NONE ) {
3292                 dts_fail(API_NAME, "failed");
3293         }
3294
3295         ret = account_query_account_by_user_name(account_call_back, NULL, NULL);
3296
3297         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3298                 dts_pass(API_NAME, "passed");
3299         } else {
3300                 dts_fail(API_NAME, "failed");
3301         }
3302
3303         ret = account_disconnect();
3304
3305         if ( ret != ACCOUNT_ERROR_NONE ) {
3306                 dts_fail(API_NAME, "failed");
3307         }
3308 }
3309
3310 static void utc_account_query_account_by_package_name_positive(void)
3311 {
3312         const char *API_NAME = __FUNCTION__;
3313         account_h account;
3314         int account_id = -1;
3315         int ret = ACCOUNT_ERROR_NONE;
3316         ret = account_connect();
3317
3318         if ( ret != ACCOUNT_ERROR_NONE ) {
3319                 dts_fail(API_NAME, "failed");
3320         }
3321
3322         ret = account_query_account_by_package_name(account_call_back, TEST_PACKAGE_NAME, NULL);
3323
3324         if ( ret == ACCOUNT_ERROR_NONE ) {
3325                 dts_pass(API_NAME, "passed");
3326         } else {
3327                 dts_fail(API_NAME, "failed");
3328         }
3329
3330         ret = account_disconnect();
3331
3332         if ( ret != ACCOUNT_ERROR_NONE ) {
3333                 dts_fail(API_NAME, "failed");
3334         }
3335 }
3336
3337 static void utc_account_query_account_by_package_name_negative(void)
3338 {
3339         const char *API_NAME = __FUNCTION__;
3340         account_h account;
3341         int account_id = -1;
3342         int ret = ACCOUNT_ERROR_NONE;
3343         ret = account_connect();
3344
3345         if ( ret != ACCOUNT_ERROR_NONE ) {
3346                 dts_fail(API_NAME, "failed");
3347         }
3348
3349         ret = account_query_account_by_package_name(account_call_back, NULL, NULL);
3350
3351         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3352                 dts_pass(API_NAME, "passed");
3353         } else {
3354                 dts_fail(API_NAME, "failed");
3355         }
3356
3357         ret = account_disconnect();
3358
3359         if ( ret != ACCOUNT_ERROR_NONE ) {
3360                 dts_fail(API_NAME, "failed");
3361         }
3362 }
3363
3364 static void utc_account_query_account_by_capability_positive(void)
3365 {
3366         const char *API_NAME = __FUNCTION__;
3367         account_h account;
3368         int account_id = -1;
3369         int ret = ACCOUNT_ERROR_NONE;
3370         ret = account_connect();
3371
3372         if ( ret != ACCOUNT_ERROR_NONE ) {
3373                 dts_fail(API_NAME, "failed");
3374         }
3375
3376         ret = account_query_account_by_capability(account_call_back, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED, NULL);
3377
3378         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3379                 dts_pass(API_NAME, "passed");
3380         } else {
3381                 dts_fail(API_NAME, "failed");
3382         }
3383
3384         ret = account_disconnect();
3385
3386         if ( ret != ACCOUNT_ERROR_NONE ) {
3387                 dts_fail(API_NAME, "failed");
3388         }
3389 }
3390
3391 static void utc_account_query_account_by_capability_negative(void)
3392 {
3393         const char *API_NAME = __FUNCTION__;
3394         account_h account;
3395         int account_id = -1;
3396         int ret = ACCOUNT_ERROR_NONE;
3397         ret = account_connect();
3398
3399         if ( ret != ACCOUNT_ERROR_NONE ) {
3400                 dts_fail(API_NAME, "failed");
3401         }
3402
3403         ret = account_query_account_by_capability(account_call_back, -999, -999, NULL);
3404
3405         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3406                 dts_pass(API_NAME, "passed");
3407         } else {
3408                 dts_fail(API_NAME, "failed");
3409         }
3410
3411         ret = account_disconnect();
3412
3413         if ( ret != ACCOUNT_ERROR_NONE ) {
3414                 dts_fail(API_NAME, "failed");
3415         }
3416 }
3417
3418 static void utc_account_query_capability_by_account_id_positive(void)
3419 {
3420         const char *API_NAME = __FUNCTION__;
3421         account_h account;
3422         int account_id = -1;
3423         int ret = ACCOUNT_ERROR_NONE;
3424         ret = account_connect();
3425
3426         if ( ret != ACCOUNT_ERROR_NONE ) {
3427                 dts_fail(API_NAME, "failed");
3428         }
3429
3430         ret = account_query_capability_by_account_id(capability_call_back, 1, NULL);
3431
3432         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3433                 dts_pass(API_NAME, "passed");
3434         } else {
3435                 dts_fail(API_NAME, "failed");
3436         }
3437
3438         ret = account_disconnect();
3439
3440         if ( ret != ACCOUNT_ERROR_NONE ) {
3441                 dts_fail(API_NAME, "failed");
3442         }
3443 }
3444
3445 static void utc_account_query_capability_by_account_id_negative(void)
3446 {
3447         const char *API_NAME = __FUNCTION__;
3448         account_h account;
3449         int account_id = -1;
3450         int ret = ACCOUNT_ERROR_NONE;
3451         ret = account_connect();
3452
3453         if ( ret != ACCOUNT_ERROR_NONE ) {
3454                 dts_fail(API_NAME, "failed");
3455         }
3456
3457         ret = account_query_capability_by_account_id(capability_call_back, -1, NULL);
3458
3459         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3460                 dts_pass(API_NAME, "passed");
3461         } else {
3462                 dts_fail(API_NAME, "failed");
3463         }
3464
3465         ret = account_disconnect();
3466
3467         if ( ret != ACCOUNT_ERROR_NONE ) {
3468                 dts_fail(API_NAME, "failed");
3469         }
3470 }
3471
3472 static void utc_account_get_total_count_from_db_positive(void)
3473 {
3474         const char *API_NAME = __FUNCTION__;
3475         account_h account;
3476         int account_id = -1;
3477         int *count;
3478         int ret = ACCOUNT_ERROR_NONE;
3479         ret = account_connect();
3480
3481         if ( ret != ACCOUNT_ERROR_NONE ) {
3482                 dts_fail(API_NAME, "failed");
3483         }
3484
3485         ret = account_get_total_count_from_db(&count);
3486
3487         if ( ret == ACCOUNT_ERROR_NONE ) {
3488                 dts_pass(API_NAME, "passed");
3489         } else {
3490                 dts_fail(API_NAME, "failed");
3491         }
3492
3493         ret = account_disconnect();
3494
3495         if ( ret != ACCOUNT_ERROR_NONE ) {
3496                 dts_fail(API_NAME, "failed");
3497         }
3498 }
3499
3500 static void utc_account_get_total_count_from_db_negative(void)
3501 {
3502         const char *API_NAME = __FUNCTION__;
3503         account_h account;
3504         int account_id = -1;
3505         int ret = ACCOUNT_ERROR_NONE;
3506         ret = account_connect();
3507
3508         if ( ret != ACCOUNT_ERROR_NONE ) {
3509                 dts_fail(API_NAME, "failed");
3510         }
3511
3512         ret = account_get_total_count_from_db(NULL);
3513
3514         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3515                 dts_pass(API_NAME, "passed");
3516         } else {
3517                 dts_fail(API_NAME, "failed");
3518         }
3519
3520         ret = account_disconnect();
3521
3522         if ( ret != ACCOUNT_ERROR_NONE ) {
3523                 dts_fail(API_NAME, "failed");
3524         }
3525 }
3526
3527 static void utc_account_update_sync_status_by_id_positive(void)
3528 {
3529         const char *API_NAME = __FUNCTION__;
3530         account_h account;
3531         int account_id = -1;
3532         int ret = ACCOUNT_ERROR_NONE;
3533         ret = account_connect();
3534
3535         if ( ret != ACCOUNT_ERROR_NONE ) {
3536                 dts_fail(API_NAME, "failed");
3537         }
3538
3539         ret = account_update_sync_status_by_id(1, ACCOUNT_SYNC_STATUS_IDLE);
3540
3541         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3542                 dts_pass(API_NAME, "passed");
3543         } else {
3544                 dts_fail(API_NAME, "failed");
3545         }
3546
3547         ret = account_disconnect();
3548
3549         if ( ret != ACCOUNT_ERROR_NONE ) {
3550                 dts_fail(API_NAME, "failed");
3551         }
3552 }
3553
3554 static void utc_account_update_sync_status_by_id_negative(void)
3555 {
3556         const char *API_NAME = __FUNCTION__;
3557         account_h account;
3558         int account_id = -1;
3559         int ret = ACCOUNT_ERROR_NONE;
3560         ret = account_connect();
3561
3562         if ( ret != ACCOUNT_ERROR_NONE ) {
3563                 dts_fail(API_NAME, "failed");
3564         }
3565
3566         ret = account_update_sync_status_by_id(-1, ACCOUNT_SYNC_STATUS_IDLE);
3567
3568         if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3569                 dts_pass(API_NAME, "passed");
3570         } else {
3571                 dts_fail(API_NAME, "failed");
3572         }
3573
3574         ret = account_disconnect();
3575
3576         if ( ret != ACCOUNT_ERROR_NONE ) {
3577                 dts_fail(API_NAME, "failed");
3578         }
3579
3580 }
3581
3582 static void utc_account_delete_from_db_by_id_positive(void)
3583 {
3584         const char *API_NAME = __FUNCTION__;
3585         account_h account;
3586         int account_id = -1;
3587         int ret = ACCOUNT_ERROR_NONE;
3588         ret = account_connect();
3589
3590         if ( ret != ACCOUNT_ERROR_NONE ) {
3591                 dts_fail(API_NAME, "failed");
3592         }
3593
3594         ret = account_delete_from_db_by_id(1);
3595
3596         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3597                 dts_pass(API_NAME, "passed");
3598         } else {
3599                 dts_fail(API_NAME, "failed");
3600         }
3601
3602         ret = account_disconnect();
3603
3604         if ( ret != ACCOUNT_ERROR_NONE ) {
3605                 dts_fail(API_NAME, "failed");
3606         }
3607 }
3608
3609 static void utc_account_delete_from_db_by_id_negative(void)
3610 {
3611         const char *API_NAME = __FUNCTION__;
3612         account_h account;
3613         int account_id = -1;
3614         int ret = ACCOUNT_ERROR_NONE;
3615         ret = account_connect();
3616
3617         if ( ret != ACCOUNT_ERROR_NONE ) {
3618                 dts_fail(API_NAME, "failed");
3619         }
3620
3621         ret = account_delete_from_db_by_id(-1);
3622
3623         if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3624                 dts_pass(API_NAME, "passed");
3625         } else {
3626                 dts_fail(API_NAME, "failed");
3627         }
3628
3629         ret = account_disconnect();
3630
3631         if ( ret != ACCOUNT_ERROR_NONE ) {
3632                 dts_fail(API_NAME, "failed");
3633         }
3634
3635 }
3636
3637 static void utc_account_delete_from_db_by_user_name_positive(void)
3638 {
3639         const char *API_NAME = __FUNCTION__;
3640         account_h account;
3641         int account_id = -1;
3642         int ret = ACCOUNT_ERROR_NONE;
3643         ret = account_connect();
3644
3645         if ( ret != ACCOUNT_ERROR_NONE ) {
3646                 dts_fail(API_NAME, "failed");
3647         }
3648
3649         ret = account_delete_from_db_by_user_name("tarun.kr", TEST_PACKAGE_NAME);
3650
3651         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3652                 dts_pass(API_NAME, "passed");
3653         } else {
3654                 dts_fail(API_NAME, "failed");
3655         }
3656
3657         ret = account_disconnect();
3658
3659         if ( ret != ACCOUNT_ERROR_NONE ) {
3660                 dts_fail(API_NAME, "failed");
3661         }
3662 }
3663
3664 static void utc_account_delete_from_db_by_user_name_negative(void)
3665 {
3666         const char *API_NAME = __FUNCTION__;
3667         account_h account;
3668         int account_id = -1;
3669         int ret = ACCOUNT_ERROR_NONE;
3670         ret = account_connect();
3671
3672         if ( ret != ACCOUNT_ERROR_NONE ) {
3673                 dts_fail(API_NAME, "failed");
3674         }
3675
3676         ret = account_delete_from_db_by_user_name(NULL, TEST_PACKAGE_NAME);
3677
3678         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3679                 dts_pass(API_NAME, "passed");
3680         } else {
3681                 dts_fail(API_NAME, "failed");
3682         }
3683
3684         ret = account_disconnect();
3685
3686         if ( ret != ACCOUNT_ERROR_NONE ) {
3687                 dts_fail(API_NAME, "failed");
3688         }
3689 }
3690
3691 static void utc_account_delete_from_db_by_package_name_positive(void)
3692 {
3693         const char *API_NAME = __FUNCTION__;
3694         account_h account;
3695         int account_id = -1;
3696         int ret = ACCOUNT_ERROR_NONE;
3697         ret = account_connect();
3698
3699         if ( ret != ACCOUNT_ERROR_NONE ) {
3700                 dts_fail(API_NAME, "failed");
3701         }
3702
3703         ret = account_delete_from_db_by_package_name(TEST_PACKAGE_NAME);
3704
3705         if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3706                 dts_pass(API_NAME, "passed");
3707         } else {
3708                 dts_fail(API_NAME, "failed");
3709         }
3710
3711         ret = account_disconnect();
3712
3713         if ( ret != ACCOUNT_ERROR_NONE ) {
3714                 dts_fail(API_NAME, "failed");
3715         }
3716 }
3717
3718 static void utc_account_delete_from_db_by_package_name_negative(void)
3719 {
3720         const char *API_NAME = __FUNCTION__;
3721         account_h account;
3722         int account_id = -1;
3723         int ret = ACCOUNT_ERROR_NONE;
3724         ret = account_connect();
3725
3726         if ( ret != ACCOUNT_ERROR_NONE ) {
3727                 dts_fail(API_NAME, "failed");
3728         }
3729
3730         ret = account_delete_from_db_by_package_name(NULL);
3731
3732         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3733                 dts_pass(API_NAME, "passed");
3734         } else {
3735                 dts_fail(API_NAME, "failed");
3736         }
3737
3738         ret = account_disconnect();
3739
3740         if ( ret != ACCOUNT_ERROR_NONE ) {
3741                 dts_fail(API_NAME, "failed");
3742         }
3743 }
3744
3745 static void utc_account_update_to_db_by_id_positive(void)
3746 {
3747         const char *API_NAME = __FUNCTION__;
3748         account_h account;
3749         int account_id = -1;
3750         int ret = ACCOUNT_ERROR_NONE;
3751         ret = account_connect();
3752
3753         if ( ret != ACCOUNT_ERROR_NONE ) {
3754                 dts_fail(API_NAME, "failed");
3755         }
3756
3757         ret = account_create(&account);
3758
3759         if ( ret != ACCOUNT_ERROR_NONE ) {
3760                 dts_fail(API_NAME, "failed");
3761         }
3762
3763         ret = account_set_user_name(account, "update-tarun.kr");
3764
3765         if ( ret != ACCOUNT_ERROR_NONE ) {
3766                 dts_fail(API_NAME, "failed");
3767         }
3768
3769         ret = account_set_package_name(account, TEST_PACKAGE_NAME);
3770
3771         if ( ret != ACCOUNT_ERROR_NONE ) {
3772                 dts_fail(API_NAME, "failed");
3773         }
3774
3775         ret = account_update_to_db_by_id(account, 1);
3776
3777         if ( ret == ACCOUNT_ERROR_NONE ) {
3778                 dts_pass(API_NAME, "passed");
3779         } else {
3780                 dts_fail(API_NAME, "failed");
3781         }
3782
3783         ret = account_destroy(account);
3784
3785         if ( ret != ACCOUNT_ERROR_NONE ) {
3786                 dts_fail(API_NAME, "failed");
3787         }
3788
3789         ret = account_disconnect();
3790
3791         if ( ret != ACCOUNT_ERROR_NONE ) {
3792                 dts_fail(API_NAME, "failed");
3793         }
3794 }
3795
3796 static void utc_account_update_to_db_by_id_negative(void)
3797 {
3798         const char *API_NAME = __FUNCTION__;
3799         account_h account;
3800         int account_id = -1;
3801         int ret = ACCOUNT_ERROR_NONE;
3802         ret = account_connect();
3803
3804         if ( ret != ACCOUNT_ERROR_NONE ) {
3805                 dts_fail(API_NAME, "failed");
3806         }
3807
3808         ret = account_create(&account);
3809
3810         if ( ret != ACCOUNT_ERROR_NONE ) {
3811                 dts_fail(API_NAME, "failed");
3812         }
3813
3814         ret = account_update_to_db_by_id(account, -1);
3815
3816         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3817                 dts_pass(API_NAME, "passed");
3818         } else {
3819                 dts_fail(API_NAME, "failed");
3820         }
3821
3822         ret = account_destroy(account);
3823
3824         if ( ret != ACCOUNT_ERROR_NONE ) {
3825                 dts_fail(API_NAME, "failed");
3826         }
3827
3828         ret = account_disconnect();
3829
3830         if ( ret != ACCOUNT_ERROR_NONE ) {
3831                 dts_fail(API_NAME, "failed");
3832         }
3833 }
3834
3835 static void utc_account_update_to_db_by_user_name_positive(void)
3836 {
3837         const char *API_NAME = __FUNCTION__;
3838         account_h account;
3839         int account_id = -1;
3840         int ret = ACCOUNT_ERROR_NONE;
3841         ret = account_connect();
3842
3843         if ( ret != ACCOUNT_ERROR_NONE ) {
3844                 dts_fail(API_NAME, "failed");
3845         }
3846
3847         ret = account_create(&account);
3848
3849         if ( ret != ACCOUNT_ERROR_NONE ) {
3850                 dts_fail(API_NAME, "failed");
3851         }
3852
3853         ret = account_set_user_name(account, "update-tarun.kr");
3854
3855         if ( ret != ACCOUNT_ERROR_NONE ) {
3856                 dts_fail(API_NAME, "failed");
3857         }
3858
3859         ret = account_set_package_name(account, TEST_PACKAGE_NAME);
3860
3861         if ( ret != ACCOUNT_ERROR_NONE ) {
3862                 dts_fail(API_NAME, "failed");
3863         }
3864
3865         ret = account_update_to_db_by_user_name(account, "tarun.kr", TEST_PACKAGE_NAME);
3866
3867         if ( ret == ACCOUNT_ERROR_NONE ) {
3868                 dts_pass(API_NAME, "passed");
3869         } else {
3870                 dts_fail(API_NAME, "failed");
3871         }
3872
3873         ret = account_destroy(account);
3874
3875         if ( ret != ACCOUNT_ERROR_NONE ) {
3876                 dts_fail(API_NAME, "failed");
3877         }
3878
3879         ret = account_disconnect();
3880
3881         if ( ret != ACCOUNT_ERROR_NONE ) {
3882                 dts_fail(API_NAME, "failed");
3883         }
3884 }
3885
3886 static void utc_account_update_to_db_by_user_name_negative(void)
3887 {
3888         const char *API_NAME = __FUNCTION__;
3889         account_h account;
3890         int account_id = -1;
3891         int ret = ACCOUNT_ERROR_NONE;
3892         ret = account_connect();
3893
3894         if ( ret != ACCOUNT_ERROR_NONE ) {
3895                 dts_fail(API_NAME, "failed");
3896         }
3897
3898         ret = account_create(&account);
3899
3900         if ( ret != ACCOUNT_ERROR_NONE ) {
3901                 dts_fail(API_NAME, "failed");
3902         }
3903
3904         ret = account_update_to_db_by_user_name(account, NULL, TEST_PACKAGE_NAME);
3905
3906         if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3907                 dts_pass(API_NAME, "passed");
3908         } else {
3909                 dts_fail(API_NAME, "failed");
3910         }
3911
3912         ret = account_destroy(account);
3913
3914         if ( ret != ACCOUNT_ERROR_NONE ) {
3915                 dts_fail(API_NAME, "failed");
3916         }
3917
3918         ret = account_disconnect();
3919
3920         if ( ret != ACCOUNT_ERROR_NONE ) {
3921                 dts_fail(API_NAME, "failed");
3922         }
3923 }
3924
3925 // END of example for libaccounts-svc API unit test
3926