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