2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <account-types.h>
20 #include <account-error.h>
22 #define TEST_PACKAGE_NAME "com.samsung.facebook"
24 static void startup(void);
25 static void cleanup(void);
27 void (*tet_startup)(void) = startup;
28 void (*tet_cleanup)(void) = cleanup;
30 static void utc_account_connect_positive(void);
31 static void utc_account_connect_negative(void);
32 static void utc_account_create_positive(void);
33 static void utc_account_create_negative(void);
34 static void utc_account_destroy_positive(void);
35 static void utc_account_destroy_negative(void);
36 static void utc_account_insert_to_db_positive(void);
37 static void utc_account_insert_to_db_negative(void);
38 static void utc_account_delete_from_db_by_id_positive(void);
39 static void utc_account_delete_from_db_by_id_negative(void);
40 static void utc_account_delete_from_db_by_user_name_positive(void);
41 static void utc_account_delete_from_db_by_user_name_negative(void);
42 static void utc_account_delete_from_db_by_package_name_positive(void);
43 static void utc_account_delete_from_db_by_package_name_negative(void);
44 static void utc_account_update_to_db_by_id_positive(void);
45 static void utc_account_update_to_db_by_id_negative(void);
46 static void utc_account_update_to_db_by_user_name_positive(void);
47 static void utc_account_update_to_db_by_user_name_negative(void);
48 static void utc_account_update_sync_status_by_id_positive(void);
49 static void utc_account_update_sync_status_by_id_negative(void);
50 static void utc_account_get_account_id_positive(void);
51 static void utc_account_get_account_id_negative(void);
52 static void utc_account_get_user_name_positive(void);
53 static void utc_account_get_user_name_negative(void);
54 static void utc_account_set_user_name_positive(void);
55 static void utc_account_set_user_name_negative(void);
56 static void utc_account_get_display_name_positive(void);
57 static void utc_account_get_display_name_negative(void);
58 static void utc_account_set_display_name_positive(void);
59 static void utc_account_set_display_name_negative(void);
60 static void utc_account_get_capability_positive(void);
61 static void utc_account_get_capability_negative(void);
62 static void utc_account_set_capability_positive(void);
63 static void utc_account_set_capability_negative(void);
64 static void utc_account_get_icon_path_positive(void);
65 static void utc_account_get_icon_path_negative(void);
66 static void utc_account_set_icon_path_positive(void);
67 static void utc_account_set_icon_path_negative(void);
68 static void utc_account_get_domain_name_positive(void);
69 static void utc_account_get_domain_name_negative(void);
70 static void utc_account_set_domain_name_positive(void);
71 static void utc_account_set_domain_name_negative(void);
72 static void utc_account_get_email_address_positive(void);
73 static void utc_account_get_email_address_negative(void);
74 static void utc_account_set_email_address_positive(void);
75 static void utc_account_set_email_address_negative(void);
76 static void utc_account_get_package_name_positive(void);
77 static void utc_account_get_package_name_negative(void);
78 static void utc_account_set_package_name_positive(void);
79 static void utc_account_set_package_name_negative(void);
80 static void utc_account_get_access_token_positive(void);
81 static void utc_account_get_access_token_negative(void);
82 static void utc_account_set_access_token_positive(void);
83 static void utc_account_set_access_token_negative(void);
84 static void utc_account_get_user_text_positive(void);
85 static void utc_account_get_user_text_negative(void);
86 static void utc_account_set_user_text_positive(void);
87 static void utc_account_set_user_text_negative(void);
88 static void utc_account_get_user_int_positive(void);
89 static void utc_account_get_user_int_negative(void);
90 static void utc_account_set_user_int_positive(void);
91 static void utc_account_set_user_int_negative(void);
92 static void utc_account_get_auth_type_positive(void);
93 static void utc_account_get_auth_type_negative(void);
94 static void utc_account_set_auth_type_positive(void);
95 static void utc_account_set_auth_type_negative(void);
96 static void utc_account_get_secret_positive(void);
97 static void utc_account_get_secret_negative(void);
98 static void utc_account_set_secret_positive(void);
99 static void utc_account_set_secret_negative(void);
100 static void utc_account_get_sync_support_positive(void);
101 static void utc_account_get_sync_support_negative(void);
102 static void utc_account_set_sync_support_positive(void);
103 static void utc_account_set_sync_support_negative(void);
104 static void utc_account_get_source_positive(void);
105 static void utc_account_get_source_negative(void);
106 static void utc_account_set_source_positive(void);
107 static void utc_account_set_source_negative(void);
108 static void utc_account_foreach_account_from_db_positive(void);
109 static void utc_account_foreach_account_from_db_negative(void);
110 static void utc_account_query_account_by_account_id_positive(void);
111 static void utc_account_query_account_by_account_id_negative(void);
112 static void utc_account_query_account_by_user_name_positive(void);
113 static void utc_account_query_account_by_user_name_negative(void);
114 static void utc_account_query_account_by_package_name_positive(void);
115 static void utc_account_query_account_by_package_name_negative(void);
116 static void utc_account_query_account_by_capability_positive(void);
117 static void utc_account_query_account_by_capability_negative(void);
118 static void utc_account_query_capability_by_account_id_positive(void);
119 static void utc_account_query_capability_by_account_id_negative(void);
120 static void utc_account_get_total_count_from_db_positive(void);
121 static void utc_account_get_total_count_from_db_negative(void);
124 struct tet_testlist tet_testlist[] = {
125 {utc_account_connect_positive, 1},
126 //{utc_account_connect_negative, 1},
127 {utc_account_create_positive, 1},
128 {utc_account_create_negative, 1},
129 {utc_account_destroy_positive, 1},
130 //{utc_account_destroy_negative, 1},
131 {utc_account_insert_to_db_positive, 1},
132 {utc_account_insert_to_db_negative, 1},
133 {utc_account_update_to_db_by_id_positive, 1},
134 {utc_account_update_to_db_by_id_negative, 1},
135 {utc_account_update_to_db_by_user_name_positive, 1},
136 {utc_account_update_to_db_by_user_name_negative, 1},
137 {utc_account_update_sync_status_by_id_positive, 1},
138 {utc_account_update_sync_status_by_id_negative, 1},
139 {utc_account_get_account_id_positive, 1},
140 {utc_account_get_account_id_negative, 1},
141 {utc_account_get_user_name_positive, 1},
142 {utc_account_get_user_name_negative, 1},
143 {utc_account_set_user_name_positive, 1},
144 {utc_account_set_user_name_negative, 1},
145 {utc_account_get_display_name_positive, 1},
146 {utc_account_get_display_name_negative, 1},
147 {utc_account_set_display_name_positive, 1},
148 {utc_account_set_display_name_negative, 1},
149 {utc_account_get_capability_positive, 1},
150 {utc_account_get_capability_negative, 1},
151 {utc_account_set_capability_positive, 1},
152 {utc_account_set_capability_negative, 1},
153 {utc_account_get_icon_path_positive, 1},
154 {utc_account_get_icon_path_negative, 1},
155 {utc_account_set_icon_path_positive, 1},
156 {utc_account_set_icon_path_negative, 1},
157 {utc_account_get_domain_name_positive, 1},
158 {utc_account_get_domain_name_negative, 1},
159 {utc_account_set_domain_name_positive, 1},
160 {utc_account_set_domain_name_negative, 1},
161 {utc_account_get_email_address_positive, 1},
162 {utc_account_get_email_address_negative, 1},
163 {utc_account_set_email_address_positive, 1},
164 {utc_account_set_email_address_negative, 1},
165 {utc_account_get_package_name_positive, 1},
166 {utc_account_get_package_name_negative, 1},
167 {utc_account_set_package_name_positive, 1},
168 {utc_account_set_package_name_negative, 1},
169 {utc_account_get_access_token_positive, 1},
170 {utc_account_get_access_token_negative, 1},
171 {utc_account_set_access_token_positive, 1},
172 {utc_account_set_access_token_negative, 1},
173 {utc_account_get_user_text_positive, 1},
174 {utc_account_get_user_text_negative, 1},
175 {utc_account_set_user_text_positive, 1},
176 {utc_account_set_user_text_negative, 1},
177 {utc_account_get_user_int_negative, 1},
178 {utc_account_get_user_int_negative, 1},
179 {utc_account_set_user_int_negative, 1},
180 {utc_account_set_user_int_negative, 1},
181 {utc_account_get_auth_type_positive, 1},
182 {utc_account_get_auth_type_negative, 1},
183 {utc_account_set_auth_type_positive, 1},
184 {utc_account_set_auth_type_negative, 1},
185 {utc_account_get_secret_positive, 1},
186 {utc_account_get_secret_negative, 1},
187 {utc_account_set_secret_positive, 1},
188 {utc_account_set_secret_negative, 1},
189 {utc_account_get_sync_support_positive, 1},
190 {utc_account_get_sync_support_negative, 1},
191 {utc_account_set_sync_support_positive, 1},
192 {utc_account_set_sync_support_negative, 1},
193 {utc_account_get_source_positive, 1},
194 {utc_account_get_source_negative, 1},
195 {utc_account_set_source_positive, 1},
196 {utc_account_set_source_negative, 1},
197 {utc_account_foreach_account_from_db_positive, 1},
198 {utc_account_foreach_account_from_db_negative, 1},
199 {utc_account_query_account_by_account_id_positive, 1},
200 {utc_account_query_account_by_account_id_negative, 1},
201 {utc_account_query_account_by_user_name_positive, 1},
202 {utc_account_query_account_by_user_name_negative, 1},
203 {utc_account_query_account_by_package_name_positive, 1},
204 {utc_account_query_account_by_package_name_negative, 1},
205 {utc_account_query_account_by_capability_positive, 1},
206 {utc_account_query_account_by_capability_negative, 1},
207 {utc_account_query_capability_by_account_id_positive, 1},
208 {utc_account_query_capability_by_account_id_negative, 1},
209 {utc_account_get_total_count_from_db_positive, 1},
210 {utc_account_get_total_count_from_db_negative, 1},
211 {utc_account_delete_from_db_by_id_positive, 1},
212 {utc_account_delete_from_db_by_id_negative, 1},
213 {utc_account_delete_from_db_by_user_name_positive, 1},
214 {utc_account_delete_from_db_by_user_name_negative, 1},
215 {utc_account_delete_from_db_by_package_name_positive, 1},
216 {utc_account_delete_from_db_by_package_name_negative, 1},
217 /* TODO : Add more test case */
221 static void startup(void)
227 static void cleanup(void)
232 static void _account_free_text(char *text)
240 // START example for libaccounts-svc API test case
242 static void utc_account_connect_positive(void)
244 const char *API_NAME = __FUNCTION__;
245 int ret = ACCOUNT_ERROR_NONE;
247 ret = account_connect();
249 if ( ret == ACCOUNT_ERROR_NONE ) {
250 dts_pass(API_NAME, "passed");
252 dts_fail(API_NAME, "failed");
257 static void utc_account_connect_negative(void)
259 const char *API_NAME = __FUNCTION__;
260 int ret = ACCOUNT_ERROR_NONE;
262 ret = rename("/opt/dbspace/.account.db", "/opt/dbspace/.account-tmp.db");
264 ret = rename("/opt/dbspace/.account.db-journal", "/opt/dbspace/.account-tmp.db-journal");
266 ret = account_connect();
268 if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
269 dts_pass(API_NAME, "passed");
271 dts_fail(API_NAME, "failed");
274 ret = rename("/opt/dbspace/.account-tmp.db", "/opt/dbspace/.account.db");
275 ret = rename("/opt/dbspace/.account-tmp.db-journal", "/opt/dbspace/.account.db-journal");
277 ret = account_disconnect();
278 if ( ret != ACCOUNT_ERROR_NONE) {
279 dts_fail(API_NAME, "failed");
283 static void utc_account_destroy_positive(void)
285 const char *API_NAME = __FUNCTION__;
286 int ret = ACCOUNT_ERROR_NONE;
288 ret = account_connect();
289 if ( ret != ACCOUNT_ERROR_NONE) {
290 dts_fail(API_NAME, "failed");
293 ret = account_disconnect();
295 if ( ret == ACCOUNT_ERROR_NONE ) {
296 dts_pass(API_NAME, "passed");
298 dts_fail(API_NAME, "failed");
303 static void utc_account_destroy_negative(void)
305 const char *API_NAME = __FUNCTION__;
306 int ret = ACCOUNT_ERROR_NONE;
308 ret = rename("/opt/dbspace/.account.db", "/opt/dbspace/.account-tmp.db");
310 ret = rename("/opt/dbspace/.account.db-journal", "/opt/dbspace/.account-tmp.db-journal");
312 ret = account_disconnect();
314 if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
315 dts_pass(API_NAME, "passed");
317 dts_fail(API_NAME, "failed");
320 ret = rename("/opt/dbspace/.account-tmp.db", "/opt/dbspace/.account.db");
321 ret = rename("/opt/dbspace/.account-tmp.db-journal", "/opt/dbspace/.account.db-journal");
324 static void utc_account_create_positive(void)
326 const char *API_NAME = __FUNCTION__;
328 int ret = ACCOUNT_ERROR_NONE;
330 ret = account_connect();
331 if ( ret != ACCOUNT_ERROR_NONE) {
332 dts_fail(API_NAME, "failed");
335 ret = account_create(&account);
337 if ( ret == ACCOUNT_ERROR_NONE ) {
338 dts_pass(API_NAME, "passed");
340 dts_fail(API_NAME, "failed");
343 ret = account_destroy(account);
344 if ( ret != ACCOUNT_ERROR_NONE) {
345 dts_fail(API_NAME, "failed");
348 ret = account_disconnect();
349 if ( ret != ACCOUNT_ERROR_NONE) {
350 dts_fail(API_NAME, "failed");
354 static void utc_account_create_negative(void)
356 const char *API_NAME = __FUNCTION__;
358 int ret = ACCOUNT_ERROR_NONE;
360 ret = account_connect();
361 if ( ret != ACCOUNT_ERROR_NONE) {
362 dts_fail(API_NAME, "failed");
365 ret = account_create(NULL);
367 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
368 dts_pass(API_NAME, "passed");
370 dts_fail(API_NAME, "failed");
373 ret = account_disconnect();
374 if ( ret != ACCOUNT_ERROR_NONE) {
375 dts_fail(API_NAME, "failed");
379 static void utc_account_insert_to_db_positive(void)
381 const char *API_NAME = __FUNCTION__;
384 int ret = ACCOUNT_ERROR_NONE;
385 ret = account_connect();
387 if ( ret != ACCOUNT_ERROR_NONE ) {
388 dts_fail(API_NAME, "failed");
391 ret = account_create(&account);
393 if ( ret != ACCOUNT_ERROR_NONE ) {
394 dts_fail(API_NAME, "failed");
397 ret = account_set_user_name(account, "tarun.kr");
399 if ( ret != ACCOUNT_ERROR_NONE ) {
400 dts_fail(API_NAME, "failed");
403 ret = account_set_package_name(account, TEST_PACKAGE_NAME);
405 if ( ret != ACCOUNT_ERROR_NONE ) {
406 dts_fail(API_NAME, "failed");
409 ret = account_insert_to_db(account, &account_id);
411 if ( ret == ACCOUNT_ERROR_NONE ) {
412 dts_pass(API_NAME, "passed");
414 dts_fail(API_NAME, "failed");
417 ret = account_destroy(account);
419 if ( ret != ACCOUNT_ERROR_NONE ) {
420 dts_fail(API_NAME, "failed");
423 ret = account_disconnect();
425 if ( ret != ACCOUNT_ERROR_NONE ) {
426 dts_fail(API_NAME, "failed");
430 static void utc_account_insert_to_db_negative(void)
432 const char *API_NAME = __FUNCTION__;
435 int ret = ACCOUNT_ERROR_NONE;
436 ret = account_connect();
438 if ( ret != ACCOUNT_ERROR_NONE ) {
439 dts_fail(API_NAME, "failed");
442 ret = account_create(&account);
444 if ( ret != ACCOUNT_ERROR_NONE ) {
445 dts_fail(API_NAME, "failed");
448 ret = account_insert_to_db(NULL, &account_id);
450 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
451 dts_pass(API_NAME, "passed");
453 dts_fail(API_NAME, "failed");
456 ret = account_destroy(account);
458 if ( ret != ACCOUNT_ERROR_NONE ) {
459 dts_fail(API_NAME, "failed");
462 ret = account_disconnect();
464 if ( ret != ACCOUNT_ERROR_NONE ) {
465 dts_fail(API_NAME, "failed");
469 static void utc_account_set_display_name_positive(void)
471 const char *API_NAME = __FUNCTION__;
474 int ret = ACCOUNT_ERROR_NONE;
475 ret = account_connect();
477 if ( ret != ACCOUNT_ERROR_NONE ) {
478 dts_fail(API_NAME, "failed");
481 ret = account_create(&account);
483 if ( ret != ACCOUNT_ERROR_NONE ) {
484 dts_fail(API_NAME, "failed");
487 ret = account_set_display_name(account, "tarun.kr");
489 if ( ret == ACCOUNT_ERROR_NONE ) {
490 dts_pass(API_NAME, "passed");
492 dts_fail(API_NAME, "failed");
495 ret = account_insert_to_db(account, &account_id);
497 if ( ret != ACCOUNT_ERROR_NONE ) {
498 dts_fail(API_NAME, "failed");
501 ret = account_destroy(account);
503 if ( ret != ACCOUNT_ERROR_NONE ) {
504 dts_fail(API_NAME, "failed");
507 ret = account_disconnect();
509 if ( ret != ACCOUNT_ERROR_NONE ) {
510 dts_fail(API_NAME, "failed");
514 static void utc_account_set_display_name_negative(void)
516 const char *API_NAME = __FUNCTION__;
519 int ret = ACCOUNT_ERROR_NONE;
520 ret = account_connect();
522 if ( ret != ACCOUNT_ERROR_NONE ) {
523 dts_fail(API_NAME, "failed");
526 ret = account_create(&account);
528 if ( ret != ACCOUNT_ERROR_NONE ) {
529 dts_fail(API_NAME, "failed");
531 ret = account_set_display_name(account, NULL);
533 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
534 dts_pass(API_NAME, "passed");
536 dts_fail(API_NAME, "failed");
539 ret = account_insert_to_db(account, &account_id);
541 if ( ret != ACCOUNT_ERROR_NONE ) {
542 dts_fail(API_NAME, "failed");
545 ret = account_destroy(account);
547 if ( ret != ACCOUNT_ERROR_NONE ) {
548 dts_fail(API_NAME, "failed");
551 ret = account_disconnect();
553 if ( ret != ACCOUNT_ERROR_NONE ) {
554 dts_fail(API_NAME, "failed");
558 static void utc_account_set_user_name_positive(void)
560 const char *API_NAME = __FUNCTION__;
563 int ret = ACCOUNT_ERROR_NONE;
564 ret = account_connect();
566 if ( ret != ACCOUNT_ERROR_NONE ) {
567 dts_fail(API_NAME, "failed");
570 ret = account_create(&account);
572 if ( ret != ACCOUNT_ERROR_NONE ) {
573 dts_fail(API_NAME, "failed");
576 ret = account_set_user_name(account, "tarun.kr");
578 if ( ret == ACCOUNT_ERROR_NONE ) {
579 dts_pass(API_NAME, "passed");
581 dts_fail(API_NAME, "failed");
584 ret = account_insert_to_db(account, &account_id);
586 if ( ret != ACCOUNT_ERROR_NONE ) {
587 dts_fail(API_NAME, "failed");
590 ret = account_destroy(account);
592 if ( ret != ACCOUNT_ERROR_NONE ) {
593 dts_fail(API_NAME, "failed");
596 ret = account_disconnect();
598 if ( ret != ACCOUNT_ERROR_NONE ) {
599 dts_fail(API_NAME, "failed");
603 static void utc_account_set_user_name_negative(void)
605 const char *API_NAME = __FUNCTION__;
608 int ret = ACCOUNT_ERROR_NONE;
609 ret = account_connect();
611 if ( ret != ACCOUNT_ERROR_NONE ) {
612 dts_fail(API_NAME, "failed");
615 ret = account_create(&account);
617 if ( ret != ACCOUNT_ERROR_NONE ) {
618 dts_fail(API_NAME, "failed");
620 ret = account_set_user_name(account, NULL);
622 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
623 dts_pass(API_NAME, "passed");
625 dts_fail(API_NAME, "failed");
628 ret = account_insert_to_db(account, &account_id);
630 if ( ret != ACCOUNT_ERROR_NONE ) {
631 dts_fail(API_NAME, "failed");
634 ret = account_destroy(account);
636 if ( ret != ACCOUNT_ERROR_NONE ) {
637 dts_fail(API_NAME, "failed");
640 ret = account_disconnect();
642 if ( ret != ACCOUNT_ERROR_NONE ) {
643 dts_fail(API_NAME, "failed");
647 static void utc_account_set_icon_path_positive(void)
649 const char *API_NAME = __FUNCTION__;
652 int ret = ACCOUNT_ERROR_NONE;
653 ret = account_connect();
655 if ( ret != ACCOUNT_ERROR_NONE ) {
656 dts_fail(API_NAME, "failed");
659 ret = account_create(&account);
661 if ( ret != ACCOUNT_ERROR_NONE ) {
662 dts_fail(API_NAME, "failed");
665 ret = account_set_icon_path(account, "icon-path");
667 if ( ret == ACCOUNT_ERROR_NONE ) {
668 dts_pass(API_NAME, "passed");
670 dts_fail(API_NAME, "failed");
673 ret = account_insert_to_db(account, &account_id);
675 if ( ret != ACCOUNT_ERROR_NONE ) {
676 dts_fail(API_NAME, "failed");
679 ret = account_destroy(account);
681 if ( ret != ACCOUNT_ERROR_NONE ) {
682 dts_fail(API_NAME, "failed");
685 ret = account_disconnect();
687 if ( ret != ACCOUNT_ERROR_NONE ) {
688 dts_fail(API_NAME, "failed");
692 static void utc_account_set_icon_path_negative(void)
694 const char *API_NAME = __FUNCTION__;
697 int ret = ACCOUNT_ERROR_NONE;
698 ret = account_connect();
700 if ( ret != ACCOUNT_ERROR_NONE ) {
701 dts_fail(API_NAME, "failed");
704 ret = account_create(&account);
706 if ( ret != ACCOUNT_ERROR_NONE ) {
707 dts_fail(API_NAME, "failed");
709 ret = account_set_icon_path(account, NULL);
711 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
712 dts_pass(API_NAME, "passed");
714 dts_fail(API_NAME, "failed");
717 ret = account_insert_to_db(account, &account_id);
719 if ( ret != ACCOUNT_ERROR_NONE ) {
720 dts_fail(API_NAME, "failed");
723 ret = account_destroy(account);
725 if ( ret != ACCOUNT_ERROR_NONE ) {
726 dts_fail(API_NAME, "failed");
729 ret = account_disconnect();
731 if ( ret != ACCOUNT_ERROR_NONE ) {
732 dts_fail(API_NAME, "failed");
736 static void utc_account_set_domain_name_positive(void)
738 const char *API_NAME = __FUNCTION__;
741 int ret = ACCOUNT_ERROR_NONE;
742 ret = account_connect();
744 if ( ret != ACCOUNT_ERROR_NONE ) {
745 dts_fail(API_NAME, "failed");
748 ret = account_create(&account);
750 if ( ret != ACCOUNT_ERROR_NONE ) {
751 dts_fail(API_NAME, "failed");
754 ret = account_set_domain_name(account, "domain-name");
756 if ( ret == ACCOUNT_ERROR_NONE ) {
757 dts_pass(API_NAME, "passed");
759 dts_fail(API_NAME, "failed");
762 ret = account_insert_to_db(account, &account_id);
764 if ( ret != ACCOUNT_ERROR_NONE ) {
765 dts_fail(API_NAME, "failed");
768 ret = account_destroy(account);
770 if ( ret != ACCOUNT_ERROR_NONE ) {
771 dts_fail(API_NAME, "failed");
774 ret = account_disconnect();
776 if ( ret != ACCOUNT_ERROR_NONE ) {
777 dts_fail(API_NAME, "failed");
781 static void utc_account_set_domain_name_negative(void)
783 const char *API_NAME = __FUNCTION__;
786 int ret = ACCOUNT_ERROR_NONE;
787 ret = account_connect();
789 if ( ret != ACCOUNT_ERROR_NONE ) {
790 dts_fail(API_NAME, "failed");
793 ret = account_create(&account);
795 if ( ret != ACCOUNT_ERROR_NONE ) {
796 dts_fail(API_NAME, "failed");
798 ret = account_set_domain_name(account, NULL);
800 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
801 dts_pass(API_NAME, "passed");
803 dts_fail(API_NAME, "failed");
806 ret = account_insert_to_db(account, &account_id);
808 if ( ret != ACCOUNT_ERROR_NONE ) {
809 dts_fail(API_NAME, "failed");
812 ret = account_destroy(account);
814 if ( ret != ACCOUNT_ERROR_NONE ) {
815 dts_fail(API_NAME, "failed");
818 ret = account_disconnect();
820 if ( ret != ACCOUNT_ERROR_NONE ) {
821 dts_fail(API_NAME, "failed");
825 static void utc_account_set_email_address_positive(void)
827 const char *API_NAME = __FUNCTION__;
830 int ret = ACCOUNT_ERROR_NONE;
831 ret = account_connect();
833 if ( ret != ACCOUNT_ERROR_NONE ) {
834 dts_fail(API_NAME, "failed");
837 ret = account_create(&account);
839 if ( ret != ACCOUNT_ERROR_NONE ) {
840 dts_fail(API_NAME, "failed");
843 ret = account_set_email_address(account, "email-address");
845 if ( ret == ACCOUNT_ERROR_NONE ) {
846 dts_pass(API_NAME, "passed");
848 dts_fail(API_NAME, "failed");
851 ret = account_insert_to_db(account, &account_id);
853 if ( ret != ACCOUNT_ERROR_NONE ) {
854 dts_fail(API_NAME, "failed");
857 ret = account_destroy(account);
859 if ( ret != ACCOUNT_ERROR_NONE ) {
860 dts_fail(API_NAME, "failed");
863 ret = account_disconnect();
865 if ( ret != ACCOUNT_ERROR_NONE ) {
866 dts_fail(API_NAME, "failed");
870 static void utc_account_set_email_address_negative(void)
872 const char *API_NAME = __FUNCTION__;
875 int ret = ACCOUNT_ERROR_NONE;
876 ret = account_connect();
878 if ( ret != ACCOUNT_ERROR_NONE ) {
879 dts_fail(API_NAME, "failed");
882 ret = account_create(&account);
884 if ( ret != ACCOUNT_ERROR_NONE ) {
885 dts_fail(API_NAME, "failed");
887 ret = account_set_email_address(account, NULL);
889 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
890 dts_pass(API_NAME, "passed");
892 dts_fail(API_NAME, "failed");
895 ret = account_insert_to_db(account, &account_id);
897 if ( ret != ACCOUNT_ERROR_NONE ) {
898 dts_fail(API_NAME, "failed");
901 ret = account_destroy(account);
903 if ( ret != ACCOUNT_ERROR_NONE ) {
904 dts_fail(API_NAME, "failed");
907 ret = account_disconnect();
909 if ( ret != ACCOUNT_ERROR_NONE ) {
910 dts_fail(API_NAME, "failed");
914 static void utc_account_set_source_positive(void)
916 const char *API_NAME = __FUNCTION__;
919 int ret = ACCOUNT_ERROR_NONE;
920 ret = account_connect();
922 if ( ret != ACCOUNT_ERROR_NONE ) {
923 dts_fail(API_NAME, "failed");
926 ret = account_create(&account);
928 if ( ret != ACCOUNT_ERROR_NONE ) {
929 dts_fail(API_NAME, "failed");
932 ret = account_set_source(account, "source");
934 if ( ret == ACCOUNT_ERROR_NONE ) {
935 dts_pass(API_NAME, "passed");
937 dts_fail(API_NAME, "failed");
940 ret = account_insert_to_db(account, &account_id);
942 if ( ret != ACCOUNT_ERROR_NONE ) {
943 dts_fail(API_NAME, "failed");
946 ret = account_destroy(account);
948 if ( ret != ACCOUNT_ERROR_NONE ) {
949 dts_fail(API_NAME, "failed");
952 ret = account_disconnect();
954 if ( ret != ACCOUNT_ERROR_NONE ) {
955 dts_fail(API_NAME, "failed");
959 static void utc_account_set_source_negative(void)
961 const char *API_NAME = __FUNCTION__;
964 int ret = ACCOUNT_ERROR_NONE;
965 ret = account_connect();
967 if ( ret != ACCOUNT_ERROR_NONE ) {
968 dts_fail(API_NAME, "failed");
971 ret = account_create(&account);
973 if ( ret != ACCOUNT_ERROR_NONE ) {
974 dts_fail(API_NAME, "failed");
976 ret = account_set_source(account, NULL);
978 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
979 dts_pass(API_NAME, "passed");
981 dts_fail(API_NAME, "failed");
984 ret = account_insert_to_db(account, &account_id);
986 if ( ret != ACCOUNT_ERROR_NONE ) {
987 dts_fail(API_NAME, "failed");
990 ret = account_destroy(account);
992 if ( ret != ACCOUNT_ERROR_NONE ) {
993 dts_fail(API_NAME, "failed");
996 ret = account_disconnect();
998 if ( ret != ACCOUNT_ERROR_NONE ) {
999 dts_fail(API_NAME, "failed");
1003 static void utc_account_set_package_name_positive(void)
1005 const char *API_NAME = __FUNCTION__;
1007 int account_id = -1;
1008 int ret = ACCOUNT_ERROR_NONE;
1009 ret = account_connect();
1011 if ( ret != ACCOUNT_ERROR_NONE ) {
1012 dts_fail(API_NAME, "failed");
1015 ret = account_create(&account);
1017 if ( ret != ACCOUNT_ERROR_NONE ) {
1018 dts_fail(API_NAME, "failed");
1021 ret = account_set_package_name(account, "package_name");
1023 if ( ret == ACCOUNT_ERROR_NONE ) {
1024 dts_pass(API_NAME, "passed");
1026 dts_fail(API_NAME, "failed");
1029 ret = account_insert_to_db(account, &account_id);
1031 if ( ret != ACCOUNT_ERROR_NONE ) {
1032 dts_fail(API_NAME, "failed");
1035 ret = account_destroy(account);
1037 if ( ret != ACCOUNT_ERROR_NONE ) {
1038 dts_fail(API_NAME, "failed");
1041 ret = account_disconnect();
1043 if ( ret != ACCOUNT_ERROR_NONE ) {
1044 dts_fail(API_NAME, "failed");
1048 static void utc_account_set_package_name_negative(void)
1050 const char *API_NAME = __FUNCTION__;
1052 int account_id = -1;
1053 int ret = ACCOUNT_ERROR_NONE;
1054 ret = account_connect();
1056 if ( ret != ACCOUNT_ERROR_NONE ) {
1057 dts_fail(API_NAME, "failed");
1060 ret = account_create(&account);
1062 if ( ret != ACCOUNT_ERROR_NONE ) {
1063 dts_fail(API_NAME, "failed");
1065 ret = account_set_package_name(account, NULL);
1067 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1068 dts_pass(API_NAME, "passed");
1070 dts_fail(API_NAME, "failed");
1073 ret = account_insert_to_db(account, &account_id);
1075 if ( ret != ACCOUNT_ERROR_NONE ) {
1076 dts_fail(API_NAME, "failed");
1079 ret = account_destroy(account);
1081 if ( ret != ACCOUNT_ERROR_NONE ) {
1082 dts_fail(API_NAME, "failed");
1085 ret = account_disconnect();
1087 if ( ret != ACCOUNT_ERROR_NONE ) {
1088 dts_fail(API_NAME, "failed");
1092 static void utc_account_set_access_token_positive(void)
1094 const char *API_NAME = __FUNCTION__;
1096 int account_id = -1;
1097 int ret = ACCOUNT_ERROR_NONE;
1098 ret = account_connect();
1100 if ( ret != ACCOUNT_ERROR_NONE ) {
1101 dts_fail(API_NAME, "failed");
1104 ret = account_create(&account);
1106 if ( ret != ACCOUNT_ERROR_NONE ) {
1107 dts_fail(API_NAME, "failed");
1110 ret = account_set_access_token(account, "access_token");
1112 if ( ret == ACCOUNT_ERROR_NONE ) {
1113 dts_pass(API_NAME, "passed");
1115 dts_fail(API_NAME, "failed");
1118 ret = account_insert_to_db(account, &account_id);
1120 if ( ret != ACCOUNT_ERROR_NONE ) {
1121 dts_fail(API_NAME, "failed");
1124 ret = account_destroy(account);
1126 if ( ret != ACCOUNT_ERROR_NONE ) {
1127 dts_fail(API_NAME, "failed");
1130 ret = account_disconnect();
1132 if ( ret != ACCOUNT_ERROR_NONE ) {
1133 dts_fail(API_NAME, "failed");
1137 static void utc_account_set_access_token_negative(void)
1139 const char *API_NAME = __FUNCTION__;
1141 int account_id = -1;
1142 int ret = ACCOUNT_ERROR_NONE;
1143 ret = account_connect();
1145 if ( ret != ACCOUNT_ERROR_NONE ) {
1146 dts_fail(API_NAME, "failed");
1149 ret = account_create(&account);
1151 if ( ret != ACCOUNT_ERROR_NONE ) {
1152 dts_fail(API_NAME, "failed");
1154 ret = account_set_access_token(account, NULL);
1156 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1157 dts_pass(API_NAME, "passed");
1159 dts_fail(API_NAME, "failed");
1162 ret = account_insert_to_db(account, &account_id);
1164 if ( ret != ACCOUNT_ERROR_NONE ) {
1165 dts_fail(API_NAME, "failed");
1168 ret = account_destroy(account);
1170 if ( ret != ACCOUNT_ERROR_NONE ) {
1171 dts_fail(API_NAME, "failed");
1174 ret = account_disconnect();
1176 if ( ret != ACCOUNT_ERROR_NONE ) {
1177 dts_fail(API_NAME, "failed");
1181 static void utc_account_set_auth_type_positive(void)
1183 const char *API_NAME = __FUNCTION__;
1185 int account_id = -1;
1186 int ret = ACCOUNT_ERROR_NONE;
1187 ret = account_connect();
1189 if ( ret != ACCOUNT_ERROR_NONE ) {
1190 dts_fail(API_NAME, "failed");
1193 ret = account_create(&account);
1195 if ( ret != ACCOUNT_ERROR_NONE ) {
1196 dts_fail(API_NAME, "failed");
1199 ret = account_set_auth_type(account, ACCOUNT_AUTH_TYPE_XAUTH);
1201 if ( ret == ACCOUNT_ERROR_NONE ) {
1202 dts_pass(API_NAME, "passed");
1204 dts_fail(API_NAME, "failed");
1207 ret = account_insert_to_db(account, &account_id);
1209 if ( ret != ACCOUNT_ERROR_NONE ) {
1210 dts_fail(API_NAME, "failed");
1213 ret = account_destroy(account);
1215 if ( ret != ACCOUNT_ERROR_NONE ) {
1216 dts_fail(API_NAME, "failed");
1219 ret = account_disconnect();
1221 if ( ret != ACCOUNT_ERROR_NONE ) {
1222 dts_fail(API_NAME, "failed");
1226 static void utc_account_set_auth_type_negative(void)
1228 const char *API_NAME = __FUNCTION__;
1230 int account_id = -1;
1231 int ret = ACCOUNT_ERROR_NONE;
1232 ret = account_connect();
1234 if ( ret != ACCOUNT_ERROR_NONE ) {
1235 dts_fail(API_NAME, "failed");
1238 ret = account_create(&account);
1240 if ( ret != ACCOUNT_ERROR_NONE ) {
1241 dts_fail(API_NAME, "failed");
1243 ret = account_set_auth_type(account, -999);
1245 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1246 dts_pass(API_NAME, "passed");
1248 dts_fail(API_NAME, "failed");
1251 ret = account_insert_to_db(account, &account_id);
1253 if ( ret != ACCOUNT_ERROR_NONE ) {
1254 dts_fail(API_NAME, "failed");
1257 ret = account_destroy(account);
1259 if ( ret != ACCOUNT_ERROR_NONE ) {
1260 dts_fail(API_NAME, "failed");
1263 ret = account_disconnect();
1265 if ( ret != ACCOUNT_ERROR_NONE ) {
1266 dts_fail(API_NAME, "failed");
1270 static void utc_account_set_secret_positive(void)
1272 const char *API_NAME = __FUNCTION__;
1274 int account_id = -1;
1275 int ret = ACCOUNT_ERROR_NONE;
1276 ret = account_connect();
1278 if ( ret != ACCOUNT_ERROR_NONE ) {
1279 dts_fail(API_NAME, "failed");
1282 ret = account_create(&account);
1284 if ( ret != ACCOUNT_ERROR_NONE ) {
1285 dts_fail(API_NAME, "failed");
1288 ret = account_set_secret(account, ACCOUNT_SECRECY_INVISIBLE);
1290 if ( ret == ACCOUNT_ERROR_NONE ) {
1291 dts_pass(API_NAME, "passed");
1293 dts_fail(API_NAME, "failed");
1296 ret = account_insert_to_db(account, &account_id);
1298 if ( ret != ACCOUNT_ERROR_NONE ) {
1299 dts_fail(API_NAME, "failed");
1302 ret = account_destroy(account);
1304 if ( ret != ACCOUNT_ERROR_NONE ) {
1305 dts_fail(API_NAME, "failed");
1308 ret = account_disconnect();
1310 if ( ret != ACCOUNT_ERROR_NONE ) {
1311 dts_fail(API_NAME, "failed");
1315 static void utc_account_set_secret_negative(void)
1317 const char *API_NAME = __FUNCTION__;
1319 int account_id = -1;
1320 int ret = ACCOUNT_ERROR_NONE;
1321 ret = account_connect();
1323 if ( ret != ACCOUNT_ERROR_NONE ) {
1324 dts_fail(API_NAME, "failed");
1327 ret = account_create(&account);
1329 if ( ret != ACCOUNT_ERROR_NONE ) {
1330 dts_fail(API_NAME, "failed");
1332 ret = account_set_secret(account, -999);
1334 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1335 dts_pass(API_NAME, "passed");
1337 dts_fail(API_NAME, "failed");
1340 ret = account_insert_to_db(account, &account_id);
1342 if ( ret != ACCOUNT_ERROR_NONE ) {
1343 dts_fail(API_NAME, "failed");
1346 ret = account_destroy(account);
1348 if ( ret != ACCOUNT_ERROR_NONE ) {
1349 dts_fail(API_NAME, "failed");
1352 ret = account_disconnect();
1354 if ( ret != ACCOUNT_ERROR_NONE ) {
1355 dts_fail(API_NAME, "failed");
1359 static void utc_account_set_sync_support_positive(void)
1361 const char *API_NAME = __FUNCTION__;
1363 int account_id = -1;
1364 int ret = ACCOUNT_ERROR_NONE;
1365 ret = account_connect();
1367 if ( ret != ACCOUNT_ERROR_NONE ) {
1368 dts_fail(API_NAME, "failed");
1371 ret = account_create(&account);
1373 if ( ret != ACCOUNT_ERROR_NONE ) {
1374 dts_fail(API_NAME, "failed");
1377 ret = account_set_sync_support(account, ACCOUNT_SYNC_STATUS_IDLE);
1379 if ( ret == ACCOUNT_ERROR_NONE ) {
1380 dts_pass(API_NAME, "passed");
1382 dts_fail(API_NAME, "failed");
1385 ret = account_insert_to_db(account, &account_id);
1387 if ( ret != ACCOUNT_ERROR_NONE ) {
1388 dts_fail(API_NAME, "failed");
1391 ret = account_destroy(account);
1393 if ( ret != ACCOUNT_ERROR_NONE ) {
1394 dts_fail(API_NAME, "failed");
1397 ret = account_disconnect();
1399 if ( ret != ACCOUNT_ERROR_NONE ) {
1400 dts_fail(API_NAME, "failed");
1404 static void utc_account_set_sync_support_negative(void)
1406 const char *API_NAME = __FUNCTION__;
1408 int account_id = -1;
1409 int ret = ACCOUNT_ERROR_NONE;
1410 ret = account_connect();
1412 if ( ret != ACCOUNT_ERROR_NONE ) {
1413 dts_fail(API_NAME, "failed");
1416 ret = account_create(&account);
1418 if ( ret != ACCOUNT_ERROR_NONE ) {
1419 dts_fail(API_NAME, "failed");
1421 ret = account_set_sync_support(account, -999);
1423 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1424 dts_pass(API_NAME, "passed");
1426 dts_fail(API_NAME, "failed");
1429 ret = account_insert_to_db(account, &account_id);
1431 if ( ret != ACCOUNT_ERROR_NONE ) {
1432 dts_fail(API_NAME, "failed");
1435 ret = account_destroy(account);
1437 if ( ret != ACCOUNT_ERROR_NONE ) {
1438 dts_fail(API_NAME, "failed");
1441 ret = account_disconnect();
1443 if ( ret != ACCOUNT_ERROR_NONE ) {
1444 dts_fail(API_NAME, "failed");
1448 static void utc_account_set_user_text_positive(void)
1450 const char *API_NAME = __FUNCTION__;
1452 int account_id = -1;
1453 int ret = ACCOUNT_ERROR_NONE;
1454 ret = account_connect();
1456 if ( ret != ACCOUNT_ERROR_NONE ) {
1457 dts_fail(API_NAME, "failed");
1460 ret = account_create(&account);
1462 if ( ret != ACCOUNT_ERROR_NONE ) {
1463 dts_fail(API_NAME, "failed");
1466 for ( i = 0; i < 5; i++)
1467 ret = account_set_user_text(account, i, "user-text");
1469 if ( ret == ACCOUNT_ERROR_NONE ) {
1470 dts_pass(API_NAME, "passed");
1472 dts_fail(API_NAME, "failed");
1475 ret = account_insert_to_db(account, &account_id);
1477 if ( ret != ACCOUNT_ERROR_NONE ) {
1478 dts_fail(API_NAME, "failed");
1481 ret = account_destroy(account);
1483 if ( ret != ACCOUNT_ERROR_NONE ) {
1484 dts_fail(API_NAME, "failed");
1487 ret = account_disconnect();
1489 if ( ret != ACCOUNT_ERROR_NONE ) {
1490 dts_fail(API_NAME, "failed");
1494 static void utc_account_set_user_text_negative(void)
1496 const char *API_NAME = __FUNCTION__;
1498 int account_id = -1;
1499 int ret = ACCOUNT_ERROR_NONE;
1500 ret = account_connect();
1502 if ( ret != ACCOUNT_ERROR_NONE ) {
1503 dts_fail(API_NAME, "failed");
1506 ret = account_create(&account);
1508 if ( ret != ACCOUNT_ERROR_NONE ) {
1509 dts_fail(API_NAME, "failed");
1513 for (i = 0; i < 5; i++)
1514 ret = account_set_user_text(account, i, NULL);
1516 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1517 dts_pass(API_NAME, "passed");
1519 dts_fail(API_NAME, "failed");
1522 ret = account_insert_to_db(account, &account_id);
1524 if ( ret != ACCOUNT_ERROR_NONE ) {
1525 dts_fail(API_NAME, "failed");
1528 ret = account_destroy(account);
1530 if ( ret != ACCOUNT_ERROR_NONE ) {
1531 dts_fail(API_NAME, "failed");
1534 ret = account_disconnect();
1536 if ( ret != ACCOUNT_ERROR_NONE ) {
1537 dts_fail(API_NAME, "failed");
1541 static void utc_account_set_user_int_positive(void)
1543 const char *API_NAME = __FUNCTION__;
1545 int account_id = -1;
1546 int ret = ACCOUNT_ERROR_NONE;
1547 ret = account_connect();
1549 if ( ret != ACCOUNT_ERROR_NONE ) {
1550 dts_fail(API_NAME, "failed");
1553 ret = account_create(&account);
1555 if ( ret != ACCOUNT_ERROR_NONE ) {
1556 dts_fail(API_NAME, "failed");
1559 for (i = 0; i < 5; i++)
1560 ret = account_set_user_int(account, i, 999);
1562 if ( ret == ACCOUNT_ERROR_NONE ) {
1563 dts_pass(API_NAME, "passed");
1565 dts_fail(API_NAME, "failed");
1568 ret = account_insert_to_db(account, &account_id);
1570 if ( ret != ACCOUNT_ERROR_NONE ) {
1571 dts_fail(API_NAME, "failed");
1574 ret = account_destroy(account);
1576 if ( ret != ACCOUNT_ERROR_NONE ) {
1577 dts_fail(API_NAME, "failed");
1580 ret = account_disconnect();
1582 if ( ret != ACCOUNT_ERROR_NONE ) {
1583 dts_fail(API_NAME, "failed");
1587 static void utc_account_set_user_int_negative(void)
1589 const char *API_NAME = __FUNCTION__;
1591 int account_id = -1;
1592 int ret = ACCOUNT_ERROR_NONE;
1593 ret = account_connect();
1595 if ( ret != ACCOUNT_ERROR_NONE ) {
1596 dts_fail(API_NAME, "failed");
1599 ret = account_create(&account);
1601 if ( ret != ACCOUNT_ERROR_NONE ) {
1602 dts_fail(API_NAME, "failed");
1605 for (i = 0; i < 5; i++)
1606 ret = account_set_user_int(NULL, i, 999);
1608 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1609 dts_pass(API_NAME, "passed");
1611 dts_fail(API_NAME, "failed");
1614 ret = account_insert_to_db(account, &account_id);
1616 if ( ret != ACCOUNT_ERROR_NONE ) {
1617 dts_fail(API_NAME, "failed");
1620 ret = account_destroy(account);
1622 if ( ret != ACCOUNT_ERROR_NONE ) {
1623 dts_fail(API_NAME, "failed");
1626 ret = account_disconnect();
1628 if ( ret != ACCOUNT_ERROR_NONE ) {
1629 dts_fail(API_NAME, "failed");
1633 static void utc_account_set_capability_positive(void)
1635 const char *API_NAME = __FUNCTION__;
1637 int account_id = -1;
1638 int ret = ACCOUNT_ERROR_NONE;
1639 ret = account_connect();
1641 if ( ret != ACCOUNT_ERROR_NONE ) {
1642 dts_fail(API_NAME, "failed");
1645 ret = account_create(&account);
1647 if ( ret != ACCOUNT_ERROR_NONE ) {
1648 dts_fail(API_NAME, "failed");
1651 ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
1653 if ( ret == ACCOUNT_ERROR_NONE ) {
1654 dts_pass(API_NAME, "passed");
1656 dts_fail(API_NAME, "failed");
1659 ret = account_insert_to_db(account, &account_id);
1661 if ( ret != ACCOUNT_ERROR_NONE ) {
1662 dts_fail(API_NAME, "failed");
1665 ret = account_destroy(account);
1667 if ( ret != ACCOUNT_ERROR_NONE ) {
1668 dts_fail(API_NAME, "failed");
1671 ret = account_disconnect();
1673 if ( ret != ACCOUNT_ERROR_NONE ) {
1674 dts_fail(API_NAME, "failed");
1678 static void utc_account_set_capability_negative(void)
1680 const char *API_NAME = __FUNCTION__;
1682 int account_id = -1;
1683 int ret = ACCOUNT_ERROR_NONE;
1684 ret = account_connect();
1686 if ( ret != ACCOUNT_ERROR_NONE ) {
1687 dts_fail(API_NAME, "failed");
1690 ret = account_create(&account);
1692 if ( ret != ACCOUNT_ERROR_NONE ) {
1693 dts_fail(API_NAME, "failed");
1696 ret = account_set_capability(account, -100, -5);
1698 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1699 dts_pass(API_NAME, "passed");
1701 dts_fail(API_NAME, "failed");
1704 ret = account_insert_to_db(account, &account_id);
1706 if ( ret != ACCOUNT_ERROR_NONE ) {
1707 dts_fail(API_NAME, "failed");
1710 ret = account_destroy(account);
1712 if ( ret != ACCOUNT_ERROR_NONE ) {
1713 dts_fail(API_NAME, "failed");
1716 ret = account_disconnect();
1718 if ( ret != ACCOUNT_ERROR_NONE ) {
1719 dts_fail(API_NAME, "failed");
1723 static void utc_account_get_display_name_positive(void)
1725 const char *API_NAME = __FUNCTION__;
1726 char * display_name;
1728 int account_id = -1;
1729 int ret = ACCOUNT_ERROR_NONE;
1730 ret = account_connect();
1732 if ( ret != ACCOUNT_ERROR_NONE ) {
1733 dts_fail(API_NAME, "failed");
1736 ret = account_create(&account);
1738 if ( ret != ACCOUNT_ERROR_NONE ) {
1739 dts_fail(API_NAME, "failed");
1742 ret = account_query_account_by_account_id(1, &account);
1744 if ( ret != ACCOUNT_ERROR_NONE ) {
1745 dts_fail(API_NAME, "failed");
1748 ret = account_get_display_name(account, &display_name);
1750 if ( ret == ACCOUNT_ERROR_NONE ) {
1751 dts_pass(API_NAME, "passed");
1753 dts_fail(API_NAME, "failed");
1756 _account_free_text(display_name);
1758 ret = account_destroy(account);
1760 if ( ret != ACCOUNT_ERROR_NONE ) {
1761 dts_fail(API_NAME, "failed");
1764 ret = account_disconnect();
1766 if ( ret != ACCOUNT_ERROR_NONE ) {
1767 dts_fail(API_NAME, "failed");
1771 static void utc_account_get_display_name_negative(void)
1773 const char *API_NAME = __FUNCTION__;
1775 int account_id = -1;
1776 int ret = ACCOUNT_ERROR_NONE;
1777 ret = account_connect();
1779 if ( ret != ACCOUNT_ERROR_NONE ) {
1780 dts_fail(API_NAME, "failed");
1783 ret = account_create(&account);
1785 if ( ret != ACCOUNT_ERROR_NONE ) {
1786 dts_fail(API_NAME, "failed");
1790 ret = account_query_account_by_account_id(1, &account);
1792 if ( ret != ACCOUNT_ERROR_NONE ) {
1793 dts_fail(API_NAME, "failed");
1796 ret = account_get_display_name(account, NULL);
1798 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1799 dts_pass(API_NAME, "passed");
1801 dts_fail(API_NAME, "failed");
1804 ret = account_destroy(account);
1806 if ( ret != ACCOUNT_ERROR_NONE ) {
1807 dts_fail(API_NAME, "failed");
1810 ret = account_disconnect();
1812 if ( ret != ACCOUNT_ERROR_NONE ) {
1813 dts_fail(API_NAME, "failed");
1817 static void utc_account_get_account_id_positive(void)
1819 const char *API_NAME = __FUNCTION__;
1821 int account_id = -1;
1822 int ret = ACCOUNT_ERROR_NONE;
1823 ret = account_connect();
1825 if ( ret != ACCOUNT_ERROR_NONE ) {
1826 dts_fail(API_NAME, "failed");
1829 ret = account_create(&account);
1831 if ( ret != ACCOUNT_ERROR_NONE ) {
1832 dts_fail(API_NAME, "failed");
1835 ret = account_query_account_by_account_id(1, &account);
1837 if ( ret != ACCOUNT_ERROR_NONE ) {
1838 dts_fail(API_NAME, "failed");
1841 ret = account_get_account_id(account, &account_id);
1843 if ( ret == ACCOUNT_ERROR_NONE ) {
1844 dts_pass(API_NAME, "passed");
1846 dts_fail(API_NAME, "failed");
1849 ret = account_destroy(account);
1851 if ( ret != ACCOUNT_ERROR_NONE ) {
1852 dts_fail(API_NAME, "failed");
1855 ret = account_disconnect();
1857 if ( ret != ACCOUNT_ERROR_NONE ) {
1858 dts_fail(API_NAME, "failed");
1862 static void utc_account_get_account_id_negative(void)
1864 const char *API_NAME = __FUNCTION__;
1866 int account_id = -1;
1867 int ret = ACCOUNT_ERROR_NONE;
1868 ret = account_connect();
1870 if ( ret != ACCOUNT_ERROR_NONE ) {
1871 dts_fail(API_NAME, "failed");
1874 ret = account_create(&account);
1876 if ( ret != ACCOUNT_ERROR_NONE ) {
1877 dts_fail(API_NAME, "failed");
1880 ret = account_query_account_by_account_id(1, &account);
1882 if ( ret != ACCOUNT_ERROR_NONE ) {
1883 dts_fail(API_NAME, "failed");
1886 ret = account_get_account_id(account, NULL);
1888 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1889 dts_pass(API_NAME, "passed");
1891 dts_fail(API_NAME, "failed");
1894 ret = account_destroy(account);
1896 if ( ret != ACCOUNT_ERROR_NONE ) {
1897 dts_fail(API_NAME, "failed");
1900 ret = account_disconnect();
1902 if ( ret != ACCOUNT_ERROR_NONE ) {
1903 dts_fail(API_NAME, "failed");
1907 static void utc_account_get_user_name_positive(void)
1909 const char *API_NAME = __FUNCTION__;
1912 int account_id = -1;
1913 int ret = ACCOUNT_ERROR_NONE;
1914 ret = account_connect();
1916 if ( ret != ACCOUNT_ERROR_NONE ) {
1917 dts_fail(API_NAME, "failed");
1920 ret = account_create(&account);
1922 if ( ret != ACCOUNT_ERROR_NONE ) {
1923 dts_fail(API_NAME, "failed");
1926 ret = account_query_account_by_account_id(1, &account);
1928 if ( ret != ACCOUNT_ERROR_NONE ) {
1929 dts_fail(API_NAME, "failed");
1932 ret = account_get_user_name(account, &user_name);
1934 if ( ret == ACCOUNT_ERROR_NONE ) {
1935 dts_pass(API_NAME, "passed");
1937 dts_fail(API_NAME, "failed");
1940 _account_free_text(user_name);
1942 ret = account_destroy(account);
1944 if ( ret != ACCOUNT_ERROR_NONE ) {
1945 dts_fail(API_NAME, "failed");
1948 ret = account_disconnect();
1950 if ( ret != ACCOUNT_ERROR_NONE ) {
1951 dts_fail(API_NAME, "failed");
1955 static void utc_account_get_user_name_negative(void)
1957 const char *API_NAME = __FUNCTION__;
1959 int account_id = -1;
1960 int ret = ACCOUNT_ERROR_NONE;
1961 ret = account_connect();
1963 if ( ret != ACCOUNT_ERROR_NONE ) {
1964 dts_fail(API_NAME, "failed");
1967 ret = account_create(&account);
1969 if ( ret != ACCOUNT_ERROR_NONE ) {
1970 dts_fail(API_NAME, "failed");
1973 ret = account_query_account_by_account_id(1, &account);
1975 if ( ret != ACCOUNT_ERROR_NONE ) {
1976 dts_fail(API_NAME, "failed");
1979 ret = account_get_user_name(account, NULL);
1981 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1982 dts_pass(API_NAME, "passed");
1984 dts_fail(API_NAME, "failed");
1987 ret = account_destroy(account);
1989 if ( ret != ACCOUNT_ERROR_NONE ) {
1990 dts_fail(API_NAME, "failed");
1993 ret = account_disconnect();
1995 if ( ret != ACCOUNT_ERROR_NONE ) {
1996 dts_fail(API_NAME, "failed");
2000 static void utc_account_get_icon_path_positive(void)
2002 const char *API_NAME = __FUNCTION__;
2005 int account_id = -1;
2006 int ret = ACCOUNT_ERROR_NONE;
2007 ret = account_connect();
2009 if ( ret != ACCOUNT_ERROR_NONE ) {
2010 dts_fail(API_NAME, "failed");
2013 ret = account_create(&account);
2015 if ( ret != ACCOUNT_ERROR_NONE ) {
2016 dts_fail(API_NAME, "failed");
2019 ret = account_query_account_by_account_id(1, &account);
2021 if ( ret != ACCOUNT_ERROR_NONE ) {
2022 dts_fail(API_NAME, "failed");
2025 ret = account_get_icon_path(account, &icon_path);
2027 if ( ret == ACCOUNT_ERROR_NONE ) {
2028 dts_pass(API_NAME, "passed");
2030 dts_fail(API_NAME, "failed");
2033 _account_free_text(icon_path);
2035 ret = account_destroy(account);
2037 if ( ret != ACCOUNT_ERROR_NONE ) {
2038 dts_fail(API_NAME, "failed");
2041 ret = account_disconnect();
2043 if ( ret != ACCOUNT_ERROR_NONE ) {
2044 dts_fail(API_NAME, "failed");
2048 static void utc_account_get_icon_path_negative(void)
2050 const char *API_NAME = __FUNCTION__;
2052 int account_id = -1;
2053 int ret = ACCOUNT_ERROR_NONE;
2054 ret = account_connect();
2056 if ( ret != ACCOUNT_ERROR_NONE ) {
2057 dts_fail(API_NAME, "failed");
2060 ret = account_create(&account);
2062 if ( ret != ACCOUNT_ERROR_NONE ) {
2063 dts_fail(API_NAME, "failed");
2066 ret = account_query_account_by_account_id(1, &account);
2068 if ( ret != ACCOUNT_ERROR_NONE ) {
2069 dts_fail(API_NAME, "failed");
2072 ret = account_get_icon_path(account, NULL);
2074 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2075 dts_pass(API_NAME, "passed");
2077 dts_fail(API_NAME, "failed");
2080 ret = account_destroy(account);
2082 if ( ret != ACCOUNT_ERROR_NONE ) {
2083 dts_fail(API_NAME, "failed");
2086 ret = account_disconnect();
2088 if ( ret != ACCOUNT_ERROR_NONE ) {
2089 dts_fail(API_NAME, "failed");
2093 static void utc_account_get_domain_name_positive(void)
2095 const char *API_NAME = __FUNCTION__;
2098 int account_id = -1;
2099 int ret = ACCOUNT_ERROR_NONE;
2100 ret = account_connect();
2102 if ( ret != ACCOUNT_ERROR_NONE ) {
2103 dts_fail(API_NAME, "failed");
2106 ret = account_create(&account);
2108 if ( ret != ACCOUNT_ERROR_NONE ) {
2109 dts_fail(API_NAME, "failed");
2112 ret = account_query_account_by_account_id(1, &account);
2114 if ( ret != ACCOUNT_ERROR_NONE ) {
2115 dts_fail(API_NAME, "failed");
2118 ret = account_get_domain_name(account, &domain_name);
2120 if ( ret == ACCOUNT_ERROR_NONE ) {
2121 dts_pass(API_NAME, "passed");
2123 dts_fail(API_NAME, "failed");
2126 _account_free_text(domain_name);
2128 ret = account_destroy(account);
2130 if ( ret != ACCOUNT_ERROR_NONE ) {
2131 dts_fail(API_NAME, "failed");
2134 ret = account_disconnect();
2136 if ( ret != ACCOUNT_ERROR_NONE ) {
2137 dts_fail(API_NAME, "failed");
2141 static void utc_account_get_domain_name_negative(void)
2143 const char *API_NAME = __FUNCTION__;
2145 int account_id = -1;
2146 int ret = ACCOUNT_ERROR_NONE;
2147 ret = account_connect();
2149 if ( ret != ACCOUNT_ERROR_NONE ) {
2150 dts_fail(API_NAME, "failed");
2153 ret = account_create(&account);
2155 if ( ret != ACCOUNT_ERROR_NONE ) {
2156 dts_fail(API_NAME, "failed");
2159 ret = account_query_account_by_account_id(1, &account);
2161 if ( ret != ACCOUNT_ERROR_NONE ) {
2162 dts_fail(API_NAME, "failed");
2165 ret = account_get_domain_name(account, NULL);
2167 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2168 dts_pass(API_NAME, "passed");
2170 dts_fail(API_NAME, "failed");
2173 ret = account_destroy(account);
2175 if ( ret != ACCOUNT_ERROR_NONE ) {
2176 dts_fail(API_NAME, "failed");
2179 ret = account_disconnect();
2181 if ( ret != ACCOUNT_ERROR_NONE ) {
2182 dts_fail(API_NAME, "failed");
2186 static void utc_account_get_email_address_positive(void)
2188 const char *API_NAME = __FUNCTION__;
2190 char *email_address;
2191 int account_id = -1;
2192 int ret = ACCOUNT_ERROR_NONE;
2193 ret = account_connect();
2195 if ( ret != ACCOUNT_ERROR_NONE ) {
2196 dts_fail(API_NAME, "failed");
2199 ret = account_create(&account);
2201 if ( ret != ACCOUNT_ERROR_NONE ) {
2202 dts_fail(API_NAME, "failed");
2205 ret = account_query_account_by_account_id(1, &account);
2207 if ( ret != ACCOUNT_ERROR_NONE ) {
2208 dts_fail(API_NAME, "failed");
2211 ret = account_get_email_address(account, &email_address);
2213 if ( ret == ACCOUNT_ERROR_NONE ) {
2214 dts_pass(API_NAME, "passed");
2216 dts_fail(API_NAME, "failed");
2219 _account_free_text(email_address);
2221 ret = account_destroy(account);
2223 if ( ret != ACCOUNT_ERROR_NONE ) {
2224 dts_fail(API_NAME, "failed");
2227 ret = account_disconnect();
2229 if ( ret != ACCOUNT_ERROR_NONE ) {
2230 dts_fail(API_NAME, "failed");
2234 static void utc_account_get_email_address_negative(void)
2236 const char *API_NAME = __FUNCTION__;
2238 int account_id = -1;
2239 int ret = ACCOUNT_ERROR_NONE;
2240 ret = account_connect();
2242 if ( ret != ACCOUNT_ERROR_NONE ) {
2243 dts_fail(API_NAME, "failed");
2246 ret = account_create(&account);
2248 if ( ret != ACCOUNT_ERROR_NONE ) {
2249 dts_fail(API_NAME, "failed");
2252 ret = account_query_account_by_account_id(1, &account);
2254 if ( ret != ACCOUNT_ERROR_NONE ) {
2255 dts_fail(API_NAME, "failed");
2258 ret = account_get_email_address(account, NULL);
2260 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2261 dts_pass(API_NAME, "passed");
2263 dts_fail(API_NAME, "failed");
2266 ret = account_destroy(account);
2268 if ( ret != ACCOUNT_ERROR_NONE ) {
2269 dts_fail(API_NAME, "failed");
2272 ret = account_disconnect();
2274 if ( ret != ACCOUNT_ERROR_NONE ) {
2275 dts_fail(API_NAME, "failed");
2279 static void utc_account_get_source_positive(void)
2281 const char *API_NAME = __FUNCTION__;
2284 int account_id = -1;
2285 int ret = ACCOUNT_ERROR_NONE;
2286 ret = account_connect();
2288 if ( ret != ACCOUNT_ERROR_NONE ) {
2289 dts_fail(API_NAME, "failed");
2292 ret = account_create(&account);
2294 if ( ret != ACCOUNT_ERROR_NONE ) {
2295 dts_fail(API_NAME, "failed");
2298 ret = account_query_account_by_account_id(1, &account);
2300 if ( ret != ACCOUNT_ERROR_NONE ) {
2301 dts_fail(API_NAME, "failed");
2304 ret = account_get_source(account, &source);
2306 if ( ret == ACCOUNT_ERROR_NONE ) {
2307 dts_pass(API_NAME, "passed");
2309 dts_fail(API_NAME, "failed");
2312 _account_free_text(source);
2314 ret = account_destroy(account);
2316 if ( ret != ACCOUNT_ERROR_NONE ) {
2317 dts_fail(API_NAME, "failed");
2320 ret = account_disconnect();
2322 if ( ret != ACCOUNT_ERROR_NONE ) {
2323 dts_fail(API_NAME, "failed");
2327 static void utc_account_get_source_negative(void)
2329 const char *API_NAME = __FUNCTION__;
2331 int account_id = -1;
2332 int ret = ACCOUNT_ERROR_NONE;
2333 ret = account_connect();
2335 if ( ret != ACCOUNT_ERROR_NONE ) {
2336 dts_fail(API_NAME, "failed");
2339 ret = account_create(&account);
2341 if ( ret != ACCOUNT_ERROR_NONE ) {
2342 dts_fail(API_NAME, "failed");
2345 ret = account_query_account_by_account_id(1, &account);
2347 if ( ret != ACCOUNT_ERROR_NONE ) {
2348 dts_fail(API_NAME, "failed");
2351 ret = account_get_source(account, NULL);
2353 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2354 dts_pass(API_NAME, "passed");
2356 dts_fail(API_NAME, "failed");
2359 ret = account_destroy(account);
2361 if ( ret != ACCOUNT_ERROR_NONE ) {
2362 dts_fail(API_NAME, "failed");
2365 ret = account_disconnect();
2367 if ( ret != ACCOUNT_ERROR_NONE ) {
2368 dts_fail(API_NAME, "failed");
2372 static void utc_account_get_package_name_positive(void)
2374 const char *API_NAME = __FUNCTION__;
2377 int account_id = -1;
2378 int ret = ACCOUNT_ERROR_NONE;
2379 ret = account_connect();
2381 if ( ret != ACCOUNT_ERROR_NONE ) {
2382 dts_fail(API_NAME, "failed");
2385 ret = account_create(&account);
2387 if ( ret != ACCOUNT_ERROR_NONE ) {
2388 dts_fail(API_NAME, "failed");
2391 ret = account_query_account_by_account_id(1, &account);
2393 if ( ret != ACCOUNT_ERROR_NONE ) {
2394 dts_fail(API_NAME, "failed");
2397 ret = account_get_package_name(account, &package_name);
2399 if ( ret == ACCOUNT_ERROR_NONE ) {
2400 dts_pass(API_NAME, "passed");
2402 dts_fail(API_NAME, "failed");
2405 _account_free_text(package_name);
2407 ret = account_destroy(account);
2409 if ( ret != ACCOUNT_ERROR_NONE ) {
2410 dts_fail(API_NAME, "failed");
2413 ret = account_disconnect();
2415 if ( ret != ACCOUNT_ERROR_NONE ) {
2416 dts_fail(API_NAME, "failed");
2420 static void utc_account_get_package_name_negative(void)
2422 const char *API_NAME = __FUNCTION__;
2424 int account_id = -1;
2425 int ret = ACCOUNT_ERROR_NONE;
2426 ret = account_connect();
2428 if ( ret != ACCOUNT_ERROR_NONE ) {
2429 dts_fail(API_NAME, "failed");
2432 ret = account_create(&account);
2434 if ( ret != ACCOUNT_ERROR_NONE ) {
2435 dts_fail(API_NAME, "failed");
2438 ret = account_query_account_by_account_id(1, &account);
2440 if ( ret != ACCOUNT_ERROR_NONE ) {
2441 dts_fail(API_NAME, "failed");
2444 ret = account_get_package_name(account, NULL);
2446 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2447 dts_pass(API_NAME, "passed");
2449 dts_fail(API_NAME, "failed");
2452 ret = account_destroy(account);
2454 if ( ret != ACCOUNT_ERROR_NONE ) {
2455 dts_fail(API_NAME, "failed");
2458 ret = account_disconnect();
2460 if ( ret != ACCOUNT_ERROR_NONE ) {
2461 dts_fail(API_NAME, "failed");
2465 static void utc_account_get_access_token_positive(void)
2467 const char *API_NAME = __FUNCTION__;
2470 int account_id = -1;
2471 int ret = ACCOUNT_ERROR_NONE;
2472 ret = account_connect();
2474 if ( ret != ACCOUNT_ERROR_NONE ) {
2475 dts_fail(API_NAME, "failed");
2478 ret = account_create(&account);
2480 if ( ret != ACCOUNT_ERROR_NONE ) {
2481 dts_fail(API_NAME, "failed");
2484 ret = account_query_account_by_account_id(1, &account);
2486 if ( ret != ACCOUNT_ERROR_NONE ) {
2487 dts_fail(API_NAME, "failed");
2490 ret = account_get_access_token(account, &access_token);
2492 if ( ret == ACCOUNT_ERROR_NONE ) {
2493 dts_pass(API_NAME, "passed");
2495 dts_fail(API_NAME, "failed");
2498 _account_free_text(access_token);
2500 ret = account_destroy(account);
2502 if ( ret != ACCOUNT_ERROR_NONE ) {
2503 dts_fail(API_NAME, "failed");
2506 ret = account_disconnect();
2508 if ( ret != ACCOUNT_ERROR_NONE ) {
2509 dts_fail(API_NAME, "failed");
2513 static void utc_account_get_access_token_negative(void)
2515 const char *API_NAME = __FUNCTION__;
2517 int account_id = -1;
2518 int ret = ACCOUNT_ERROR_NONE;
2519 ret = account_connect();
2521 if ( ret != ACCOUNT_ERROR_NONE ) {
2522 dts_fail(API_NAME, "failed");
2525 ret = account_create(&account);
2527 if ( ret != ACCOUNT_ERROR_NONE ) {
2528 dts_fail(API_NAME, "failed");
2531 ret = account_query_account_by_account_id(1, &account);
2533 if ( ret != ACCOUNT_ERROR_NONE ) {
2534 dts_fail(API_NAME, "failed");
2537 ret = account_get_access_token(account, NULL);
2539 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2540 dts_pass(API_NAME, "passed");
2542 dts_fail(API_NAME, "failed");
2545 ret = account_destroy(account);
2547 if ( ret != ACCOUNT_ERROR_NONE ) {
2548 dts_fail(API_NAME, "failed");
2551 ret = account_disconnect();
2553 if ( ret != ACCOUNT_ERROR_NONE ) {
2554 dts_fail(API_NAME, "failed");
2558 static void utc_account_get_auth_type_positive(void)
2560 const char *API_NAME = __FUNCTION__;
2563 int account_id = -1;
2564 int ret = ACCOUNT_ERROR_NONE;
2565 ret = account_connect();
2567 if ( ret != ACCOUNT_ERROR_NONE ) {
2568 dts_fail(API_NAME, "failed");
2571 ret = account_create(&account);
2573 if ( ret != ACCOUNT_ERROR_NONE ) {
2574 dts_fail(API_NAME, "failed");
2577 ret = account_query_account_by_account_id(1, &account);
2579 if ( ret != ACCOUNT_ERROR_NONE ) {
2580 dts_fail(API_NAME, "failed");
2583 ret = account_get_auth_type(account, &auth_type);
2585 if ( ret == ACCOUNT_ERROR_NONE ) {
2586 dts_pass(API_NAME, "passed");
2588 dts_fail(API_NAME, "failed");
2591 ret = account_destroy(account);
2593 if ( ret != ACCOUNT_ERROR_NONE ) {
2594 dts_fail(API_NAME, "failed");
2597 ret = account_disconnect();
2599 if ( ret != ACCOUNT_ERROR_NONE ) {
2600 dts_fail(API_NAME, "failed");
2604 static void utc_account_get_auth_type_negative(void)
2606 const char *API_NAME = __FUNCTION__;
2608 int account_id = -1;
2609 int ret = ACCOUNT_ERROR_NONE;
2610 ret = account_connect();
2612 if ( ret != ACCOUNT_ERROR_NONE ) {
2613 dts_fail(API_NAME, "failed");
2616 ret = account_create(&account);
2618 if ( ret != ACCOUNT_ERROR_NONE ) {
2619 dts_fail(API_NAME, "failed");
2622 ret = account_query_account_by_account_id(1, &account);
2624 if ( ret != ACCOUNT_ERROR_NONE ) {
2625 dts_fail(API_NAME, "failed");
2628 ret = account_get_auth_type(account, NULL);
2630 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2631 dts_pass(API_NAME, "passed");
2633 dts_fail(API_NAME, "failed");
2636 ret = account_destroy(account);
2638 if ( ret != ACCOUNT_ERROR_NONE ) {
2639 dts_fail(API_NAME, "failed");
2642 ret = account_disconnect();
2644 if ( ret != ACCOUNT_ERROR_NONE ) {
2645 dts_fail(API_NAME, "failed");
2649 static void utc_account_get_secret_positive(void)
2651 const char *API_NAME = __FUNCTION__;
2653 account_secrecy_state_e secret;
2654 int account_id = -1;
2655 int ret = ACCOUNT_ERROR_NONE;
2656 ret = account_connect();
2658 if ( ret != ACCOUNT_ERROR_NONE ) {
2659 dts_fail(API_NAME, "failed");
2662 ret = account_create(&account);
2664 if ( ret != ACCOUNT_ERROR_NONE ) {
2665 dts_fail(API_NAME, "failed");
2668 ret = account_query_account_by_account_id(1, &account);
2670 if ( ret != ACCOUNT_ERROR_NONE ) {
2671 dts_fail(API_NAME, "failed");
2674 ret = account_get_secret(account, &secret);
2676 if ( ret == ACCOUNT_ERROR_NONE ) {
2677 dts_pass(API_NAME, "passed");
2679 dts_fail(API_NAME, "failed");
2682 ret = account_destroy(account);
2684 if ( ret != ACCOUNT_ERROR_NONE ) {
2685 dts_fail(API_NAME, "failed");
2688 ret = account_disconnect();
2690 if ( ret != ACCOUNT_ERROR_NONE ) {
2691 dts_fail(API_NAME, "failed");
2695 static void utc_account_get_sync_support_positive(void)
2697 const char *API_NAME = __FUNCTION__;
2699 account_sync_state_e sync_support;
2700 int account_id = -1;
2701 int ret = ACCOUNT_ERROR_NONE;
2702 ret = account_connect();
2704 if ( ret != ACCOUNT_ERROR_NONE ) {
2705 dts_fail(API_NAME, "failed");
2708 ret = account_create(&account);
2710 if ( ret != ACCOUNT_ERROR_NONE ) {
2711 dts_fail(API_NAME, "failed");
2714 ret = account_query_account_by_account_id(1, &account);
2716 if ( ret != ACCOUNT_ERROR_NONE ) {
2717 dts_fail(API_NAME, "failed");
2720 ret = account_get_sync_support(account, &sync_support);
2722 if ( ret == ACCOUNT_ERROR_NONE ) {
2723 dts_pass(API_NAME, "passed");
2725 dts_fail(API_NAME, "failed");
2728 ret = account_destroy(account);
2730 if ( ret != ACCOUNT_ERROR_NONE ) {
2731 dts_fail(API_NAME, "failed");
2734 ret = account_disconnect();
2736 if ( ret != ACCOUNT_ERROR_NONE ) {
2737 dts_fail(API_NAME, "failed");
2741 static void utc_account_get_secret_negative(void)
2743 const char *API_NAME = __FUNCTION__;
2745 int account_id = -1;
2746 int ret = ACCOUNT_ERROR_NONE;
2747 ret = account_connect();
2749 if ( ret != ACCOUNT_ERROR_NONE ) {
2750 dts_fail(API_NAME, "failed");
2753 ret = account_create(&account);
2755 if ( ret != ACCOUNT_ERROR_NONE ) {
2756 dts_fail(API_NAME, "failed");
2759 ret = account_query_account_by_account_id(1, &account);
2761 if ( ret != ACCOUNT_ERROR_NONE ) {
2762 dts_fail(API_NAME, "failed");
2765 ret = account_get_secret(account, NULL);
2767 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2768 dts_pass(API_NAME, "passed");
2770 dts_fail(API_NAME, "failed");
2773 ret = account_destroy(account);
2775 if ( ret != ACCOUNT_ERROR_NONE ) {
2776 dts_fail(API_NAME, "failed");
2779 ret = account_disconnect();
2781 if ( ret != ACCOUNT_ERROR_NONE ) {
2782 dts_fail(API_NAME, "failed");
2786 static void utc_account_get_sync_support_negative(void)
2788 const char *API_NAME = __FUNCTION__;
2790 int account_id = -1;
2791 int ret = ACCOUNT_ERROR_NONE;
2792 ret = account_connect();
2794 if ( ret != ACCOUNT_ERROR_NONE ) {
2795 dts_fail(API_NAME, "failed");
2798 ret = account_create(&account);
2800 if ( ret != ACCOUNT_ERROR_NONE ) {
2801 dts_fail(API_NAME, "failed");
2804 ret = account_query_account_by_account_id(1, &account);
2806 if ( ret != ACCOUNT_ERROR_NONE ) {
2807 dts_fail(API_NAME, "failed");
2810 ret = account_get_sync_support(account, NULL);
2812 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2813 dts_pass(API_NAME, "passed");
2815 dts_fail(API_NAME, "failed");
2818 ret = account_destroy(account);
2820 if ( ret != ACCOUNT_ERROR_NONE ) {
2821 dts_fail(API_NAME, "failed");
2824 ret = account_disconnect();
2826 if ( ret != ACCOUNT_ERROR_NONE ) {
2827 dts_fail(API_NAME, "failed");
2831 static void utc_account_get_user_text_positive(void)
2833 const char *API_NAME = __FUNCTION__;
2836 int account_id = -1;
2837 int ret = ACCOUNT_ERROR_NONE;
2838 ret = account_connect();
2840 if ( ret != ACCOUNT_ERROR_NONE ) {
2841 dts_fail(API_NAME, "failed");
2844 ret = account_create(&account);
2846 if ( ret != ACCOUNT_ERROR_NONE ) {
2847 dts_fail(API_NAME, "failed");
2850 ret = account_query_account_by_account_id(1, &account);
2852 if ( ret != ACCOUNT_ERROR_NONE ) {
2853 dts_fail(API_NAME, "failed");
2856 for (i = 0; i < 5; i++) {
2857 ret = account_get_user_text(account, i, &user_text);
2858 _account_free_text(user_text);
2861 if ( ret == ACCOUNT_ERROR_NONE ) {
2862 dts_pass(API_NAME, "passed");
2864 dts_fail(API_NAME, "failed");
2867 ret = account_destroy(account);
2869 if ( ret != ACCOUNT_ERROR_NONE ) {
2870 dts_fail(API_NAME, "failed");
2873 ret = account_disconnect();
2875 if ( ret != ACCOUNT_ERROR_NONE ) {
2876 dts_fail(API_NAME, "failed");
2880 static void utc_account_get_user_text_negative(void)
2882 const char *API_NAME = __FUNCTION__;
2884 int account_id = -1;
2885 int ret = ACCOUNT_ERROR_NONE;
2886 ret = account_connect();
2888 if ( ret != ACCOUNT_ERROR_NONE ) {
2889 dts_fail(API_NAME, "failed");
2892 ret = account_create(&account);
2894 if ( ret != ACCOUNT_ERROR_NONE ) {
2895 dts_fail(API_NAME, "failed");
2898 ret = account_query_account_by_account_id(1, &account);
2900 if ( ret != ACCOUNT_ERROR_NONE ) {
2901 dts_fail(API_NAME, "failed");
2904 for (i = 0; i < 5; i++)
2905 ret = account_get_user_text(account, i, NULL);
2907 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2908 dts_pass(API_NAME, "passed");
2910 dts_fail(API_NAME, "failed");
2913 ret = account_destroy(account);
2915 if ( ret != ACCOUNT_ERROR_NONE ) {
2916 dts_fail(API_NAME, "failed");
2919 ret = account_disconnect();
2921 if ( ret != ACCOUNT_ERROR_NONE ) {
2922 dts_fail(API_NAME, "failed");
2926 static void utc_account_get_user_int_positive(void)
2928 const char *API_NAME = __FUNCTION__;
2931 int account_id = -1;
2932 int ret = ACCOUNT_ERROR_NONE;
2933 ret = account_connect();
2935 if ( ret != ACCOUNT_ERROR_NONE ) {
2936 dts_fail(API_NAME, "failed");
2939 ret = account_create(&account);
2941 if ( ret != ACCOUNT_ERROR_NONE ) {
2942 dts_fail(API_NAME, "failed");
2945 ret = account_query_account_by_account_id(1, &account);
2947 if ( ret != ACCOUNT_ERROR_NONE ) {
2948 dts_fail(API_NAME, "failed");
2951 for (i = 0; i < 5; i++)
2952 ret = account_get_user_int(account, i, &user_int);
2954 if ( ret == ACCOUNT_ERROR_NONE ) {
2955 dts_pass(API_NAME, "passed");
2957 dts_fail(API_NAME, "failed");
2960 ret = account_insert_to_db(account, &account_id);
2962 if ( ret != ACCOUNT_ERROR_NONE ) {
2963 dts_fail(API_NAME, "failed");
2966 ret = account_destroy(account);
2968 if ( ret != ACCOUNT_ERROR_NONE ) {
2969 dts_fail(API_NAME, "failed");
2972 ret = account_disconnect();
2974 if ( ret != ACCOUNT_ERROR_NONE ) {
2975 dts_fail(API_NAME, "failed");
2979 static void utc_account_get_user_int_negative(void)
2981 const char *API_NAME = __FUNCTION__;
2983 int account_id = -1;
2984 int ret = ACCOUNT_ERROR_NONE;
2985 ret = account_connect();
2987 if ( ret != ACCOUNT_ERROR_NONE ) {
2988 dts_fail(API_NAME, "failed");
2991 ret = account_create(&account);
2993 if ( ret != ACCOUNT_ERROR_NONE ) {
2994 dts_fail(API_NAME, "failed");
2997 ret = account_query_account_by_account_id(1, &account);
2999 if ( ret != ACCOUNT_ERROR_NONE ) {
3000 dts_fail(API_NAME, "failed");
3003 for (i = 0; i < 5; i++)
3004 ret = account_get_user_int(NULL, i, NULL);
3006 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3007 dts_pass(API_NAME, "passed");
3009 dts_fail(API_NAME, "failed");
3012 ret = account_destroy(account);
3014 if ( ret != ACCOUNT_ERROR_NONE ) {
3015 dts_fail(API_NAME, "failed");
3018 ret = account_disconnect();
3020 if ( ret != ACCOUNT_ERROR_NONE ) {
3021 dts_fail(API_NAME, "failed");
3024 bool capability_call_back(account_capability_type_e capability_type, account_capability_state_e capability_state, void *user_data)
3029 static void utc_account_get_capability_positive(void)
3031 const char *API_NAME = __FUNCTION__;
3033 int account_id = -1;
3034 int ret = ACCOUNT_ERROR_NONE;
3035 ret = account_connect();
3037 if ( ret != ACCOUNT_ERROR_NONE ) {
3038 dts_fail(API_NAME, "failed");
3041 ret = account_create(&account);
3043 if ( ret != ACCOUNT_ERROR_NONE ) {
3044 dts_fail(API_NAME, "failed");
3047 ret = account_query_account_by_account_id(1, &account);
3049 if ( ret != ACCOUNT_ERROR_NONE ) {
3050 dts_fail(API_NAME, "failed");
3053 ret = account_get_capability(account, capability_call_back, NULL);
3055 if ( ret == ACCOUNT_ERROR_NONE ) {
3056 dts_pass(API_NAME, "passed");
3058 dts_fail(API_NAME, "failed");
3061 ret = account_destroy(account);
3063 if ( ret != ACCOUNT_ERROR_NONE ) {
3064 dts_fail(API_NAME, "failed");
3067 ret = account_disconnect();
3069 if ( ret != ACCOUNT_ERROR_NONE ) {
3070 dts_fail(API_NAME, "failed");
3074 static void utc_account_get_capability_negative(void)
3076 const char *API_NAME = __FUNCTION__;
3078 int account_id = -1;
3079 int ret = ACCOUNT_ERROR_NONE;
3080 ret = account_connect();
3082 if ( ret != ACCOUNT_ERROR_NONE ) {
3083 dts_fail(API_NAME, "failed");
3086 ret = account_create(&account);
3088 if ( ret != ACCOUNT_ERROR_NONE ) {
3089 dts_fail(API_NAME, "failed");
3092 ret = account_query_account_by_account_id(1, &account);
3094 if ( ret != ACCOUNT_ERROR_NONE ) {
3095 dts_fail(API_NAME, "failed");
3098 ret = account_get_capability(account, NULL, NULL);
3100 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3101 dts_pass(API_NAME, "passed");
3103 dts_fail(API_NAME, "failed");
3106 ret = account_destroy(account);
3108 if ( ret != ACCOUNT_ERROR_NONE ) {
3109 dts_fail(API_NAME, "failed");
3112 ret = account_disconnect();
3114 if ( ret != ACCOUNT_ERROR_NONE ) {
3115 dts_fail(API_NAME, "failed");
3119 bool account_call_back(account_h account, void *user_data)
3124 static void utc_account_foreach_account_from_db_positive(void)
3126 const char *API_NAME = __FUNCTION__;
3128 int account_id = -1;
3129 int ret = ACCOUNT_ERROR_NONE;
3130 ret = account_connect();
3132 if ( ret != ACCOUNT_ERROR_NONE ) {
3133 dts_fail(API_NAME, "failed");
3136 ret = account_foreach_account_from_db(account_call_back, NULL);
3138 if ( ret == ACCOUNT_ERROR_NONE ) {
3139 dts_pass(API_NAME, "passed");
3141 dts_fail(API_NAME, "failed");
3144 ret = account_disconnect();
3146 if ( ret != ACCOUNT_ERROR_NONE ) {
3147 dts_fail(API_NAME, "failed");
3151 static void utc_account_foreach_account_from_db_negative(void)
3153 const char *API_NAME = __FUNCTION__;
3155 int account_id = -1;
3156 int ret = ACCOUNT_ERROR_NONE;
3157 ret = account_connect();
3159 if ( ret != ACCOUNT_ERROR_NONE ) {
3160 dts_fail(API_NAME, "failed");
3163 ret = account_foreach_account_from_db(NULL, NULL);
3165 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3166 dts_pass(API_NAME, "passed");
3168 dts_fail(API_NAME, "failed");
3171 ret = account_disconnect();
3173 if ( ret != ACCOUNT_ERROR_NONE ) {
3174 dts_fail(API_NAME, "failed");
3178 static void utc_account_query_account_by_account_id_positive(void)
3180 const char *API_NAME = __FUNCTION__;
3182 int account_id = -1;
3183 int ret = ACCOUNT_ERROR_NONE;
3184 ret = account_connect();
3186 if ( ret != ACCOUNT_ERROR_NONE ) {
3187 dts_fail(API_NAME, "failed");
3190 ret = account_create(&account);
3192 if ( ret != ACCOUNT_ERROR_NONE ) {
3193 dts_fail(API_NAME, "failed");
3196 ret = account_query_account_by_account_id(1, &account);
3198 if ( ret == ACCOUNT_ERROR_NONE ) {
3199 dts_pass(API_NAME, "passed");
3201 dts_fail(API_NAME, "failed");
3204 ret = account_destroy(account);
3206 if ( ret != ACCOUNT_ERROR_NONE ) {
3207 dts_fail(API_NAME, "failed");
3210 ret = account_disconnect();
3212 if ( ret != ACCOUNT_ERROR_NONE ) {
3213 dts_fail(API_NAME, "failed");
3217 static void utc_account_query_account_by_account_id_negative(void)
3219 const char *API_NAME = __FUNCTION__;
3221 int account_id = -1;
3222 int ret = ACCOUNT_ERROR_NONE;
3223 ret = account_connect();
3225 if ( ret != ACCOUNT_ERROR_NONE ) {
3226 dts_fail(API_NAME, "failed");
3229 ret = account_create(&account);
3231 if ( ret != ACCOUNT_ERROR_NONE ) {
3232 dts_fail(API_NAME, "failed");
3235 ret = account_query_account_by_account_id(-999, NULL);
3237 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3238 dts_pass(API_NAME, "passed");
3240 dts_fail(API_NAME, "failed");
3243 ret = account_destroy(account);
3245 if ( ret != ACCOUNT_ERROR_NONE ) {
3246 dts_fail(API_NAME, "failed");
3249 ret = account_disconnect();
3251 if ( ret != ACCOUNT_ERROR_NONE ) {
3252 dts_fail(API_NAME, "failed");
3256 static void utc_account_query_account_by_user_name_positive(void)
3258 const char *API_NAME = __FUNCTION__;
3260 int account_id = -1;
3261 int ret = ACCOUNT_ERROR_NONE;
3262 ret = account_connect();
3264 if ( ret != ACCOUNT_ERROR_NONE ) {
3265 dts_fail(API_NAME, "failed");
3268 ret = account_query_account_by_user_name(account_call_back, "tarun.kr", NULL);
3270 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3271 dts_pass(API_NAME, "passed");
3273 dts_fail(API_NAME, "failed");
3276 ret = account_disconnect();
3278 if ( ret != ACCOUNT_ERROR_NONE ) {
3279 dts_fail(API_NAME, "failed");
3283 static void utc_account_query_account_by_user_name_negative(void)
3285 const char *API_NAME = __FUNCTION__;
3287 int account_id = -1;
3288 int ret = ACCOUNT_ERROR_NONE;
3289 ret = account_connect();
3291 if ( ret != ACCOUNT_ERROR_NONE ) {
3292 dts_fail(API_NAME, "failed");
3295 ret = account_query_account_by_user_name(account_call_back, NULL, NULL);
3297 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3298 dts_pass(API_NAME, "passed");
3300 dts_fail(API_NAME, "failed");
3303 ret = account_disconnect();
3305 if ( ret != ACCOUNT_ERROR_NONE ) {
3306 dts_fail(API_NAME, "failed");
3310 static void utc_account_query_account_by_package_name_positive(void)
3312 const char *API_NAME = __FUNCTION__;
3314 int account_id = -1;
3315 int ret = ACCOUNT_ERROR_NONE;
3316 ret = account_connect();
3318 if ( ret != ACCOUNT_ERROR_NONE ) {
3319 dts_fail(API_NAME, "failed");
3322 ret = account_query_account_by_package_name(account_call_back, TEST_PACKAGE_NAME, NULL);
3324 if ( ret == ACCOUNT_ERROR_NONE ) {
3325 dts_pass(API_NAME, "passed");
3327 dts_fail(API_NAME, "failed");
3330 ret = account_disconnect();
3332 if ( ret != ACCOUNT_ERROR_NONE ) {
3333 dts_fail(API_NAME, "failed");
3337 static void utc_account_query_account_by_package_name_negative(void)
3339 const char *API_NAME = __FUNCTION__;
3341 int account_id = -1;
3342 int ret = ACCOUNT_ERROR_NONE;
3343 ret = account_connect();
3345 if ( ret != ACCOUNT_ERROR_NONE ) {
3346 dts_fail(API_NAME, "failed");
3349 ret = account_query_account_by_package_name(account_call_back, NULL, NULL);
3351 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3352 dts_pass(API_NAME, "passed");
3354 dts_fail(API_NAME, "failed");
3357 ret = account_disconnect();
3359 if ( ret != ACCOUNT_ERROR_NONE ) {
3360 dts_fail(API_NAME, "failed");
3364 static void utc_account_query_account_by_capability_positive(void)
3366 const char *API_NAME = __FUNCTION__;
3368 int account_id = -1;
3369 int ret = ACCOUNT_ERROR_NONE;
3370 ret = account_connect();
3372 if ( ret != ACCOUNT_ERROR_NONE ) {
3373 dts_fail(API_NAME, "failed");
3376 ret = account_query_account_by_capability(account_call_back, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED, NULL);
3378 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3379 dts_pass(API_NAME, "passed");
3381 dts_fail(API_NAME, "failed");
3384 ret = account_disconnect();
3386 if ( ret != ACCOUNT_ERROR_NONE ) {
3387 dts_fail(API_NAME, "failed");
3391 static void utc_account_query_account_by_capability_negative(void)
3393 const char *API_NAME = __FUNCTION__;
3395 int account_id = -1;
3396 int ret = ACCOUNT_ERROR_NONE;
3397 ret = account_connect();
3399 if ( ret != ACCOUNT_ERROR_NONE ) {
3400 dts_fail(API_NAME, "failed");
3403 ret = account_query_account_by_capability(account_call_back, -999, -999, NULL);
3405 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3406 dts_pass(API_NAME, "passed");
3408 dts_fail(API_NAME, "failed");
3411 ret = account_disconnect();
3413 if ( ret != ACCOUNT_ERROR_NONE ) {
3414 dts_fail(API_NAME, "failed");
3418 static void utc_account_query_capability_by_account_id_positive(void)
3420 const char *API_NAME = __FUNCTION__;
3422 int account_id = -1;
3423 int ret = ACCOUNT_ERROR_NONE;
3424 ret = account_connect();
3426 if ( ret != ACCOUNT_ERROR_NONE ) {
3427 dts_fail(API_NAME, "failed");
3430 ret = account_query_capability_by_account_id(capability_call_back, 1, NULL);
3432 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3433 dts_pass(API_NAME, "passed");
3435 dts_fail(API_NAME, "failed");
3438 ret = account_disconnect();
3440 if ( ret != ACCOUNT_ERROR_NONE ) {
3441 dts_fail(API_NAME, "failed");
3445 static void utc_account_query_capability_by_account_id_negative(void)
3447 const char *API_NAME = __FUNCTION__;
3449 int account_id = -1;
3450 int ret = ACCOUNT_ERROR_NONE;
3451 ret = account_connect();
3453 if ( ret != ACCOUNT_ERROR_NONE ) {
3454 dts_fail(API_NAME, "failed");
3457 ret = account_query_capability_by_account_id(capability_call_back, -1, NULL);
3459 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3460 dts_pass(API_NAME, "passed");
3462 dts_fail(API_NAME, "failed");
3465 ret = account_disconnect();
3467 if ( ret != ACCOUNT_ERROR_NONE ) {
3468 dts_fail(API_NAME, "failed");
3472 static void utc_account_get_total_count_from_db_positive(void)
3474 const char *API_NAME = __FUNCTION__;
3476 int account_id = -1;
3478 int ret = ACCOUNT_ERROR_NONE;
3479 ret = account_connect();
3481 if ( ret != ACCOUNT_ERROR_NONE ) {
3482 dts_fail(API_NAME, "failed");
3485 ret = account_get_total_count_from_db(&count);
3487 if ( ret == ACCOUNT_ERROR_NONE ) {
3488 dts_pass(API_NAME, "passed");
3490 dts_fail(API_NAME, "failed");
3493 ret = account_disconnect();
3495 if ( ret != ACCOUNT_ERROR_NONE ) {
3496 dts_fail(API_NAME, "failed");
3500 static void utc_account_get_total_count_from_db_negative(void)
3502 const char *API_NAME = __FUNCTION__;
3504 int account_id = -1;
3505 int ret = ACCOUNT_ERROR_NONE;
3506 ret = account_connect();
3508 if ( ret != ACCOUNT_ERROR_NONE ) {
3509 dts_fail(API_NAME, "failed");
3512 ret = account_get_total_count_from_db(NULL);
3514 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3515 dts_pass(API_NAME, "passed");
3517 dts_fail(API_NAME, "failed");
3520 ret = account_disconnect();
3522 if ( ret != ACCOUNT_ERROR_NONE ) {
3523 dts_fail(API_NAME, "failed");
3527 static void utc_account_update_sync_status_by_id_positive(void)
3529 const char *API_NAME = __FUNCTION__;
3531 int account_id = -1;
3532 int ret = ACCOUNT_ERROR_NONE;
3533 ret = account_connect();
3535 if ( ret != ACCOUNT_ERROR_NONE ) {
3536 dts_fail(API_NAME, "failed");
3539 ret = account_update_sync_status_by_id(1, ACCOUNT_SYNC_STATUS_IDLE);
3541 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3542 dts_pass(API_NAME, "passed");
3544 dts_fail(API_NAME, "failed");
3547 ret = account_disconnect();
3549 if ( ret != ACCOUNT_ERROR_NONE ) {
3550 dts_fail(API_NAME, "failed");
3554 static void utc_account_update_sync_status_by_id_negative(void)
3556 const char *API_NAME = __FUNCTION__;
3558 int account_id = -1;
3559 int ret = ACCOUNT_ERROR_NONE;
3560 ret = account_connect();
3562 if ( ret != ACCOUNT_ERROR_NONE ) {
3563 dts_fail(API_NAME, "failed");
3566 ret = account_update_sync_status_by_id(-1, ACCOUNT_SYNC_STATUS_IDLE);
3568 if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3569 dts_pass(API_NAME, "passed");
3571 dts_fail(API_NAME, "failed");
3574 ret = account_disconnect();
3576 if ( ret != ACCOUNT_ERROR_NONE ) {
3577 dts_fail(API_NAME, "failed");
3582 static void utc_account_delete_from_db_by_id_positive(void)
3584 const char *API_NAME = __FUNCTION__;
3586 int account_id = -1;
3587 int ret = ACCOUNT_ERROR_NONE;
3588 ret = account_connect();
3590 if ( ret != ACCOUNT_ERROR_NONE ) {
3591 dts_fail(API_NAME, "failed");
3594 ret = account_delete_from_db_by_id(1);
3596 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3597 dts_pass(API_NAME, "passed");
3599 dts_fail(API_NAME, "failed");
3602 ret = account_disconnect();
3604 if ( ret != ACCOUNT_ERROR_NONE ) {
3605 dts_fail(API_NAME, "failed");
3609 static void utc_account_delete_from_db_by_id_negative(void)
3611 const char *API_NAME = __FUNCTION__;
3613 int account_id = -1;
3614 int ret = ACCOUNT_ERROR_NONE;
3615 ret = account_connect();
3617 if ( ret != ACCOUNT_ERROR_NONE ) {
3618 dts_fail(API_NAME, "failed");
3621 ret = account_delete_from_db_by_id(-1);
3623 if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3624 dts_pass(API_NAME, "passed");
3626 dts_fail(API_NAME, "failed");
3629 ret = account_disconnect();
3631 if ( ret != ACCOUNT_ERROR_NONE ) {
3632 dts_fail(API_NAME, "failed");
3637 static void utc_account_delete_from_db_by_user_name_positive(void)
3639 const char *API_NAME = __FUNCTION__;
3641 int account_id = -1;
3642 int ret = ACCOUNT_ERROR_NONE;
3643 ret = account_connect();
3645 if ( ret != ACCOUNT_ERROR_NONE ) {
3646 dts_fail(API_NAME, "failed");
3649 ret = account_delete_from_db_by_user_name("tarun.kr", TEST_PACKAGE_NAME);
3651 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3652 dts_pass(API_NAME, "passed");
3654 dts_fail(API_NAME, "failed");
3657 ret = account_disconnect();
3659 if ( ret != ACCOUNT_ERROR_NONE ) {
3660 dts_fail(API_NAME, "failed");
3664 static void utc_account_delete_from_db_by_user_name_negative(void)
3666 const char *API_NAME = __FUNCTION__;
3668 int account_id = -1;
3669 int ret = ACCOUNT_ERROR_NONE;
3670 ret = account_connect();
3672 if ( ret != ACCOUNT_ERROR_NONE ) {
3673 dts_fail(API_NAME, "failed");
3676 ret = account_delete_from_db_by_user_name(NULL, TEST_PACKAGE_NAME);
3678 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3679 dts_pass(API_NAME, "passed");
3681 dts_fail(API_NAME, "failed");
3684 ret = account_disconnect();
3686 if ( ret != ACCOUNT_ERROR_NONE ) {
3687 dts_fail(API_NAME, "failed");
3691 static void utc_account_delete_from_db_by_package_name_positive(void)
3693 const char *API_NAME = __FUNCTION__;
3695 int account_id = -1;
3696 int ret = ACCOUNT_ERROR_NONE;
3697 ret = account_connect();
3699 if ( ret != ACCOUNT_ERROR_NONE ) {
3700 dts_fail(API_NAME, "failed");
3703 ret = account_delete_from_db_by_package_name(TEST_PACKAGE_NAME);
3705 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3706 dts_pass(API_NAME, "passed");
3708 dts_fail(API_NAME, "failed");
3711 ret = account_disconnect();
3713 if ( ret != ACCOUNT_ERROR_NONE ) {
3714 dts_fail(API_NAME, "failed");
3718 static void utc_account_delete_from_db_by_package_name_negative(void)
3720 const char *API_NAME = __FUNCTION__;
3722 int account_id = -1;
3723 int ret = ACCOUNT_ERROR_NONE;
3724 ret = account_connect();
3726 if ( ret != ACCOUNT_ERROR_NONE ) {
3727 dts_fail(API_NAME, "failed");
3730 ret = account_delete_from_db_by_package_name(NULL);
3732 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3733 dts_pass(API_NAME, "passed");
3735 dts_fail(API_NAME, "failed");
3738 ret = account_disconnect();
3740 if ( ret != ACCOUNT_ERROR_NONE ) {
3741 dts_fail(API_NAME, "failed");
3745 static void utc_account_update_to_db_by_id_positive(void)
3747 const char *API_NAME = __FUNCTION__;
3749 int account_id = -1;
3750 int ret = ACCOUNT_ERROR_NONE;
3751 ret = account_connect();
3753 if ( ret != ACCOUNT_ERROR_NONE ) {
3754 dts_fail(API_NAME, "failed");
3757 ret = account_create(&account);
3759 if ( ret != ACCOUNT_ERROR_NONE ) {
3760 dts_fail(API_NAME, "failed");
3763 ret = account_set_user_name(account, "update-tarun.kr");
3765 if ( ret != ACCOUNT_ERROR_NONE ) {
3766 dts_fail(API_NAME, "failed");
3769 ret = account_set_package_name(account, TEST_PACKAGE_NAME);
3771 if ( ret != ACCOUNT_ERROR_NONE ) {
3772 dts_fail(API_NAME, "failed");
3775 ret = account_update_to_db_by_id(account, 1);
3777 if ( ret == ACCOUNT_ERROR_NONE ) {
3778 dts_pass(API_NAME, "passed");
3780 dts_fail(API_NAME, "failed");
3783 ret = account_destroy(account);
3785 if ( ret != ACCOUNT_ERROR_NONE ) {
3786 dts_fail(API_NAME, "failed");
3789 ret = account_disconnect();
3791 if ( ret != ACCOUNT_ERROR_NONE ) {
3792 dts_fail(API_NAME, "failed");
3796 static void utc_account_update_to_db_by_id_negative(void)
3798 const char *API_NAME = __FUNCTION__;
3800 int account_id = -1;
3801 int ret = ACCOUNT_ERROR_NONE;
3802 ret = account_connect();
3804 if ( ret != ACCOUNT_ERROR_NONE ) {
3805 dts_fail(API_NAME, "failed");
3808 ret = account_create(&account);
3810 if ( ret != ACCOUNT_ERROR_NONE ) {
3811 dts_fail(API_NAME, "failed");
3814 ret = account_update_to_db_by_id(account, -1);
3816 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3817 dts_pass(API_NAME, "passed");
3819 dts_fail(API_NAME, "failed");
3822 ret = account_destroy(account);
3824 if ( ret != ACCOUNT_ERROR_NONE ) {
3825 dts_fail(API_NAME, "failed");
3828 ret = account_disconnect();
3830 if ( ret != ACCOUNT_ERROR_NONE ) {
3831 dts_fail(API_NAME, "failed");
3835 static void utc_account_update_to_db_by_user_name_positive(void)
3837 const char *API_NAME = __FUNCTION__;
3839 int account_id = -1;
3840 int ret = ACCOUNT_ERROR_NONE;
3841 ret = account_connect();
3843 if ( ret != ACCOUNT_ERROR_NONE ) {
3844 dts_fail(API_NAME, "failed");
3847 ret = account_create(&account);
3849 if ( ret != ACCOUNT_ERROR_NONE ) {
3850 dts_fail(API_NAME, "failed");
3853 ret = account_set_user_name(account, "update-tarun.kr");
3855 if ( ret != ACCOUNT_ERROR_NONE ) {
3856 dts_fail(API_NAME, "failed");
3859 ret = account_set_package_name(account, TEST_PACKAGE_NAME);
3861 if ( ret != ACCOUNT_ERROR_NONE ) {
3862 dts_fail(API_NAME, "failed");
3865 ret = account_update_to_db_by_user_name(account, "tarun.kr", TEST_PACKAGE_NAME);
3867 if ( ret == ACCOUNT_ERROR_NONE ) {
3868 dts_pass(API_NAME, "passed");
3870 dts_fail(API_NAME, "failed");
3873 ret = account_destroy(account);
3875 if ( ret != ACCOUNT_ERROR_NONE ) {
3876 dts_fail(API_NAME, "failed");
3879 ret = account_disconnect();
3881 if ( ret != ACCOUNT_ERROR_NONE ) {
3882 dts_fail(API_NAME, "failed");
3886 static void utc_account_update_to_db_by_user_name_negative(void)
3888 const char *API_NAME = __FUNCTION__;
3890 int account_id = -1;
3891 int ret = ACCOUNT_ERROR_NONE;
3892 ret = account_connect();
3894 if ( ret != ACCOUNT_ERROR_NONE ) {
3895 dts_fail(API_NAME, "failed");
3898 ret = account_create(&account);
3900 if ( ret != ACCOUNT_ERROR_NONE ) {
3901 dts_fail(API_NAME, "failed");
3904 ret = account_update_to_db_by_user_name(account, NULL, TEST_PACKAGE_NAME);
3906 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3907 dts_pass(API_NAME, "passed");
3909 dts_fail(API_NAME, "failed");
3912 ret = account_destroy(account);
3914 if ( ret != ACCOUNT_ERROR_NONE ) {
3915 dts_fail(API_NAME, "failed");
3918 ret = account_disconnect();
3920 if ( ret != ACCOUNT_ERROR_NONE ) {
3921 dts_fail(API_NAME, "failed");
3925 // END of example for libaccounts-svc API unit test