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>
21 #include <tzplatform_config.h>
23 #define TEST_PACKAGE_NAME "com.samsung.facebook"
25 static void startup(void);
26 static void cleanup(void);
28 void (*tet_startup)(void) = startup;
29 void (*tet_cleanup)(void) = cleanup;
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);
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 */
222 static void startup(void)
228 static void cleanup(void)
233 static void _account_free_text(char *text)
241 // START example for libaccounts-svc API test case
243 static void utc_account_connect_positive(void)
245 const char *API_NAME = __FUNCTION__;
246 int ret = ACCOUNT_ERROR_NONE;
248 ret = account_connect();
250 if ( ret == ACCOUNT_ERROR_NONE ) {
251 dts_pass(API_NAME, "passed");
253 dts_fail(API_NAME, "failed");
258 static void utc_account_connect_negative(void)
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;
267 ret = rename(ACCT_PATH, ACCT_TEMP_PATH);
269 ret = rename(ACCT_JR_PATH, ACCT_TEMP_JR_PATH);
271 ret = account_connect();
273 if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
274 dts_pass(API_NAME, "passed");
276 dts_fail(API_NAME, "failed");
279 ret = rename(ACCT_TEMP_PATH, ACCT_PATH);
281 ret = rename(ACCT_TEMP_JR_PATH, ACCT_JR_PATH);
283 ret = account_disconnect();
284 if ( ret != ACCOUNT_ERROR_NONE) {
285 dts_fail(API_NAME, "failed");
289 static void utc_account_destroy_positive(void)
291 const char *API_NAME = __FUNCTION__;
292 int ret = ACCOUNT_ERROR_NONE;
294 ret = account_connect();
295 if ( ret != ACCOUNT_ERROR_NONE) {
296 dts_fail(API_NAME, "failed");
299 ret = account_disconnect();
301 if ( ret == ACCOUNT_ERROR_NONE ) {
302 dts_pass(API_NAME, "passed");
304 dts_fail(API_NAME, "failed");
309 static void utc_account_destroy_negative(void)
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;
319 ret = rename(ACCT_PATH, ACCT_TEMP_PATH);
321 ret = rename(ACCT_JR_PATH, ACCT_TEMP_JR_PATH);
323 ret = account_disconnect();
325 if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
326 dts_pass(API_NAME, "passed");
328 dts_fail(API_NAME, "failed");
331 ret = rename(ACCT_TEMP_PATH, ACCT_PATH);
333 ret = rename(ACCT_TEMP_JR_PATH, ACCT_JR_PATH);
336 static void utc_account_create_positive(void)
338 const char *API_NAME = __FUNCTION__;
340 int ret = ACCOUNT_ERROR_NONE;
342 ret = account_connect();
343 if ( ret != ACCOUNT_ERROR_NONE) {
344 dts_fail(API_NAME, "failed");
347 ret = account_create(&account);
349 if ( ret == ACCOUNT_ERROR_NONE ) {
350 dts_pass(API_NAME, "passed");
352 dts_fail(API_NAME, "failed");
355 ret = account_destroy(account);
356 if ( ret != ACCOUNT_ERROR_NONE) {
357 dts_fail(API_NAME, "failed");
360 ret = account_disconnect();
361 if ( ret != ACCOUNT_ERROR_NONE) {
362 dts_fail(API_NAME, "failed");
366 static void utc_account_create_negative(void)
368 const char *API_NAME = __FUNCTION__;
370 int ret = ACCOUNT_ERROR_NONE;
372 ret = account_connect();
373 if ( ret != ACCOUNT_ERROR_NONE) {
374 dts_fail(API_NAME, "failed");
377 ret = account_create(NULL);
379 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
380 dts_pass(API_NAME, "passed");
382 dts_fail(API_NAME, "failed");
385 ret = account_disconnect();
386 if ( ret != ACCOUNT_ERROR_NONE) {
387 dts_fail(API_NAME, "failed");
391 static void utc_account_insert_to_db_positive(void)
393 const char *API_NAME = __FUNCTION__;
396 int ret = ACCOUNT_ERROR_NONE;
397 ret = account_connect();
399 if ( ret != ACCOUNT_ERROR_NONE ) {
400 dts_fail(API_NAME, "failed");
403 ret = account_create(&account);
405 if ( ret != ACCOUNT_ERROR_NONE ) {
406 dts_fail(API_NAME, "failed");
409 ret = account_set_user_name(account, "tarun.kr");
411 if ( ret != ACCOUNT_ERROR_NONE ) {
412 dts_fail(API_NAME, "failed");
415 ret = account_set_package_name(account, TEST_PACKAGE_NAME);
417 if ( ret != ACCOUNT_ERROR_NONE ) {
418 dts_fail(API_NAME, "failed");
421 ret = account_insert_to_db(account, &account_id);
423 if ( ret == ACCOUNT_ERROR_NONE ) {
424 dts_pass(API_NAME, "passed");
426 dts_fail(API_NAME, "failed");
429 ret = account_destroy(account);
431 if ( ret != ACCOUNT_ERROR_NONE ) {
432 dts_fail(API_NAME, "failed");
435 ret = account_disconnect();
437 if ( ret != ACCOUNT_ERROR_NONE ) {
438 dts_fail(API_NAME, "failed");
442 static void utc_account_insert_to_db_negative(void)
444 const char *API_NAME = __FUNCTION__;
447 int ret = ACCOUNT_ERROR_NONE;
448 ret = account_connect();
450 if ( ret != ACCOUNT_ERROR_NONE ) {
451 dts_fail(API_NAME, "failed");
454 ret = account_create(&account);
456 if ( ret != ACCOUNT_ERROR_NONE ) {
457 dts_fail(API_NAME, "failed");
460 ret = account_insert_to_db(NULL, &account_id);
462 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
463 dts_pass(API_NAME, "passed");
465 dts_fail(API_NAME, "failed");
468 ret = account_destroy(account);
470 if ( ret != ACCOUNT_ERROR_NONE ) {
471 dts_fail(API_NAME, "failed");
474 ret = account_disconnect();
476 if ( ret != ACCOUNT_ERROR_NONE ) {
477 dts_fail(API_NAME, "failed");
481 static void utc_account_set_display_name_positive(void)
483 const char *API_NAME = __FUNCTION__;
486 int ret = ACCOUNT_ERROR_NONE;
487 ret = account_connect();
489 if ( ret != ACCOUNT_ERROR_NONE ) {
490 dts_fail(API_NAME, "failed");
493 ret = account_create(&account);
495 if ( ret != ACCOUNT_ERROR_NONE ) {
496 dts_fail(API_NAME, "failed");
499 ret = account_set_display_name(account, "tarun.kr");
501 if ( ret == ACCOUNT_ERROR_NONE ) {
502 dts_pass(API_NAME, "passed");
504 dts_fail(API_NAME, "failed");
507 ret = account_insert_to_db(account, &account_id);
509 if ( ret != ACCOUNT_ERROR_NONE ) {
510 dts_fail(API_NAME, "failed");
513 ret = account_destroy(account);
515 if ( ret != ACCOUNT_ERROR_NONE ) {
516 dts_fail(API_NAME, "failed");
519 ret = account_disconnect();
521 if ( ret != ACCOUNT_ERROR_NONE ) {
522 dts_fail(API_NAME, "failed");
526 static void utc_account_set_display_name_negative(void)
528 const char *API_NAME = __FUNCTION__;
531 int ret = ACCOUNT_ERROR_NONE;
532 ret = account_connect();
534 if ( ret != ACCOUNT_ERROR_NONE ) {
535 dts_fail(API_NAME, "failed");
538 ret = account_create(&account);
540 if ( ret != ACCOUNT_ERROR_NONE ) {
541 dts_fail(API_NAME, "failed");
543 ret = account_set_display_name(account, NULL);
545 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
546 dts_pass(API_NAME, "passed");
548 dts_fail(API_NAME, "failed");
551 ret = account_insert_to_db(account, &account_id);
553 if ( ret != ACCOUNT_ERROR_NONE ) {
554 dts_fail(API_NAME, "failed");
557 ret = account_destroy(account);
559 if ( ret != ACCOUNT_ERROR_NONE ) {
560 dts_fail(API_NAME, "failed");
563 ret = account_disconnect();
565 if ( ret != ACCOUNT_ERROR_NONE ) {
566 dts_fail(API_NAME, "failed");
570 static void utc_account_set_user_name_positive(void)
572 const char *API_NAME = __FUNCTION__;
575 int ret = ACCOUNT_ERROR_NONE;
576 ret = account_connect();
578 if ( ret != ACCOUNT_ERROR_NONE ) {
579 dts_fail(API_NAME, "failed");
582 ret = account_create(&account);
584 if ( ret != ACCOUNT_ERROR_NONE ) {
585 dts_fail(API_NAME, "failed");
588 ret = account_set_user_name(account, "tarun.kr");
590 if ( ret == ACCOUNT_ERROR_NONE ) {
591 dts_pass(API_NAME, "passed");
593 dts_fail(API_NAME, "failed");
596 ret = account_insert_to_db(account, &account_id);
598 if ( ret != ACCOUNT_ERROR_NONE ) {
599 dts_fail(API_NAME, "failed");
602 ret = account_destroy(account);
604 if ( ret != ACCOUNT_ERROR_NONE ) {
605 dts_fail(API_NAME, "failed");
608 ret = account_disconnect();
610 if ( ret != ACCOUNT_ERROR_NONE ) {
611 dts_fail(API_NAME, "failed");
615 static void utc_account_set_user_name_negative(void)
617 const char *API_NAME = __FUNCTION__;
620 int ret = ACCOUNT_ERROR_NONE;
621 ret = account_connect();
623 if ( ret != ACCOUNT_ERROR_NONE ) {
624 dts_fail(API_NAME, "failed");
627 ret = account_create(&account);
629 if ( ret != ACCOUNT_ERROR_NONE ) {
630 dts_fail(API_NAME, "failed");
632 ret = account_set_user_name(account, NULL);
634 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
635 dts_pass(API_NAME, "passed");
637 dts_fail(API_NAME, "failed");
640 ret = account_insert_to_db(account, &account_id);
642 if ( ret != ACCOUNT_ERROR_NONE ) {
643 dts_fail(API_NAME, "failed");
646 ret = account_destroy(account);
648 if ( ret != ACCOUNT_ERROR_NONE ) {
649 dts_fail(API_NAME, "failed");
652 ret = account_disconnect();
654 if ( ret != ACCOUNT_ERROR_NONE ) {
655 dts_fail(API_NAME, "failed");
659 static void utc_account_set_icon_path_positive(void)
661 const char *API_NAME = __FUNCTION__;
664 int ret = ACCOUNT_ERROR_NONE;
665 ret = account_connect();
667 if ( ret != ACCOUNT_ERROR_NONE ) {
668 dts_fail(API_NAME, "failed");
671 ret = account_create(&account);
673 if ( ret != ACCOUNT_ERROR_NONE ) {
674 dts_fail(API_NAME, "failed");
677 ret = account_set_icon_path(account, "icon-path");
679 if ( ret == ACCOUNT_ERROR_NONE ) {
680 dts_pass(API_NAME, "passed");
682 dts_fail(API_NAME, "failed");
685 ret = account_insert_to_db(account, &account_id);
687 if ( ret != ACCOUNT_ERROR_NONE ) {
688 dts_fail(API_NAME, "failed");
691 ret = account_destroy(account);
693 if ( ret != ACCOUNT_ERROR_NONE ) {
694 dts_fail(API_NAME, "failed");
697 ret = account_disconnect();
699 if ( ret != ACCOUNT_ERROR_NONE ) {
700 dts_fail(API_NAME, "failed");
704 static void utc_account_set_icon_path_negative(void)
706 const char *API_NAME = __FUNCTION__;
709 int ret = ACCOUNT_ERROR_NONE;
710 ret = account_connect();
712 if ( ret != ACCOUNT_ERROR_NONE ) {
713 dts_fail(API_NAME, "failed");
716 ret = account_create(&account);
718 if ( ret != ACCOUNT_ERROR_NONE ) {
719 dts_fail(API_NAME, "failed");
721 ret = account_set_icon_path(account, NULL);
723 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
724 dts_pass(API_NAME, "passed");
726 dts_fail(API_NAME, "failed");
729 ret = account_insert_to_db(account, &account_id);
731 if ( ret != ACCOUNT_ERROR_NONE ) {
732 dts_fail(API_NAME, "failed");
735 ret = account_destroy(account);
737 if ( ret != ACCOUNT_ERROR_NONE ) {
738 dts_fail(API_NAME, "failed");
741 ret = account_disconnect();
743 if ( ret != ACCOUNT_ERROR_NONE ) {
744 dts_fail(API_NAME, "failed");
748 static void utc_account_set_domain_name_positive(void)
750 const char *API_NAME = __FUNCTION__;
753 int ret = ACCOUNT_ERROR_NONE;
754 ret = account_connect();
756 if ( ret != ACCOUNT_ERROR_NONE ) {
757 dts_fail(API_NAME, "failed");
760 ret = account_create(&account);
762 if ( ret != ACCOUNT_ERROR_NONE ) {
763 dts_fail(API_NAME, "failed");
766 ret = account_set_domain_name(account, "domain-name");
768 if ( ret == ACCOUNT_ERROR_NONE ) {
769 dts_pass(API_NAME, "passed");
771 dts_fail(API_NAME, "failed");
774 ret = account_insert_to_db(account, &account_id);
776 if ( ret != ACCOUNT_ERROR_NONE ) {
777 dts_fail(API_NAME, "failed");
780 ret = account_destroy(account);
782 if ( ret != ACCOUNT_ERROR_NONE ) {
783 dts_fail(API_NAME, "failed");
786 ret = account_disconnect();
788 if ( ret != ACCOUNT_ERROR_NONE ) {
789 dts_fail(API_NAME, "failed");
793 static void utc_account_set_domain_name_negative(void)
795 const char *API_NAME = __FUNCTION__;
798 int ret = ACCOUNT_ERROR_NONE;
799 ret = account_connect();
801 if ( ret != ACCOUNT_ERROR_NONE ) {
802 dts_fail(API_NAME, "failed");
805 ret = account_create(&account);
807 if ( ret != ACCOUNT_ERROR_NONE ) {
808 dts_fail(API_NAME, "failed");
810 ret = account_set_domain_name(account, NULL);
812 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
813 dts_pass(API_NAME, "passed");
815 dts_fail(API_NAME, "failed");
818 ret = account_insert_to_db(account, &account_id);
820 if ( ret != ACCOUNT_ERROR_NONE ) {
821 dts_fail(API_NAME, "failed");
824 ret = account_destroy(account);
826 if ( ret != ACCOUNT_ERROR_NONE ) {
827 dts_fail(API_NAME, "failed");
830 ret = account_disconnect();
832 if ( ret != ACCOUNT_ERROR_NONE ) {
833 dts_fail(API_NAME, "failed");
837 static void utc_account_set_email_address_positive(void)
839 const char *API_NAME = __FUNCTION__;
842 int ret = ACCOUNT_ERROR_NONE;
843 ret = account_connect();
845 if ( ret != ACCOUNT_ERROR_NONE ) {
846 dts_fail(API_NAME, "failed");
849 ret = account_create(&account);
851 if ( ret != ACCOUNT_ERROR_NONE ) {
852 dts_fail(API_NAME, "failed");
855 ret = account_set_email_address(account, "email-address");
857 if ( ret == ACCOUNT_ERROR_NONE ) {
858 dts_pass(API_NAME, "passed");
860 dts_fail(API_NAME, "failed");
863 ret = account_insert_to_db(account, &account_id);
865 if ( ret != ACCOUNT_ERROR_NONE ) {
866 dts_fail(API_NAME, "failed");
869 ret = account_destroy(account);
871 if ( ret != ACCOUNT_ERROR_NONE ) {
872 dts_fail(API_NAME, "failed");
875 ret = account_disconnect();
877 if ( ret != ACCOUNT_ERROR_NONE ) {
878 dts_fail(API_NAME, "failed");
882 static void utc_account_set_email_address_negative(void)
884 const char *API_NAME = __FUNCTION__;
887 int ret = ACCOUNT_ERROR_NONE;
888 ret = account_connect();
890 if ( ret != ACCOUNT_ERROR_NONE ) {
891 dts_fail(API_NAME, "failed");
894 ret = account_create(&account);
896 if ( ret != ACCOUNT_ERROR_NONE ) {
897 dts_fail(API_NAME, "failed");
899 ret = account_set_email_address(account, NULL);
901 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
902 dts_pass(API_NAME, "passed");
904 dts_fail(API_NAME, "failed");
907 ret = account_insert_to_db(account, &account_id);
909 if ( ret != ACCOUNT_ERROR_NONE ) {
910 dts_fail(API_NAME, "failed");
913 ret = account_destroy(account);
915 if ( ret != ACCOUNT_ERROR_NONE ) {
916 dts_fail(API_NAME, "failed");
919 ret = account_disconnect();
921 if ( ret != ACCOUNT_ERROR_NONE ) {
922 dts_fail(API_NAME, "failed");
926 static void utc_account_set_source_positive(void)
928 const char *API_NAME = __FUNCTION__;
931 int ret = ACCOUNT_ERROR_NONE;
932 ret = account_connect();
934 if ( ret != ACCOUNT_ERROR_NONE ) {
935 dts_fail(API_NAME, "failed");
938 ret = account_create(&account);
940 if ( ret != ACCOUNT_ERROR_NONE ) {
941 dts_fail(API_NAME, "failed");
944 ret = account_set_source(account, "source");
946 if ( ret == ACCOUNT_ERROR_NONE ) {
947 dts_pass(API_NAME, "passed");
949 dts_fail(API_NAME, "failed");
952 ret = account_insert_to_db(account, &account_id);
954 if ( ret != ACCOUNT_ERROR_NONE ) {
955 dts_fail(API_NAME, "failed");
958 ret = account_destroy(account);
960 if ( ret != ACCOUNT_ERROR_NONE ) {
961 dts_fail(API_NAME, "failed");
964 ret = account_disconnect();
966 if ( ret != ACCOUNT_ERROR_NONE ) {
967 dts_fail(API_NAME, "failed");
971 static void utc_account_set_source_negative(void)
973 const char *API_NAME = __FUNCTION__;
976 int ret = ACCOUNT_ERROR_NONE;
977 ret = account_connect();
979 if ( ret != ACCOUNT_ERROR_NONE ) {
980 dts_fail(API_NAME, "failed");
983 ret = account_create(&account);
985 if ( ret != ACCOUNT_ERROR_NONE ) {
986 dts_fail(API_NAME, "failed");
988 ret = account_set_source(account, NULL);
990 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
991 dts_pass(API_NAME, "passed");
993 dts_fail(API_NAME, "failed");
996 ret = account_insert_to_db(account, &account_id);
998 if ( ret != ACCOUNT_ERROR_NONE ) {
999 dts_fail(API_NAME, "failed");
1002 ret = account_destroy(account);
1004 if ( ret != ACCOUNT_ERROR_NONE ) {
1005 dts_fail(API_NAME, "failed");
1008 ret = account_disconnect();
1010 if ( ret != ACCOUNT_ERROR_NONE ) {
1011 dts_fail(API_NAME, "failed");
1015 static void utc_account_set_package_name_positive(void)
1017 const char *API_NAME = __FUNCTION__;
1019 int account_id = -1;
1020 int ret = ACCOUNT_ERROR_NONE;
1021 ret = account_connect();
1023 if ( ret != ACCOUNT_ERROR_NONE ) {
1024 dts_fail(API_NAME, "failed");
1027 ret = account_create(&account);
1029 if ( ret != ACCOUNT_ERROR_NONE ) {
1030 dts_fail(API_NAME, "failed");
1033 ret = account_set_package_name(account, "package_name");
1035 if ( ret == ACCOUNT_ERROR_NONE ) {
1036 dts_pass(API_NAME, "passed");
1038 dts_fail(API_NAME, "failed");
1041 ret = account_insert_to_db(account, &account_id);
1043 if ( ret != ACCOUNT_ERROR_NONE ) {
1044 dts_fail(API_NAME, "failed");
1047 ret = account_destroy(account);
1049 if ( ret != ACCOUNT_ERROR_NONE ) {
1050 dts_fail(API_NAME, "failed");
1053 ret = account_disconnect();
1055 if ( ret != ACCOUNT_ERROR_NONE ) {
1056 dts_fail(API_NAME, "failed");
1060 static void utc_account_set_package_name_negative(void)
1062 const char *API_NAME = __FUNCTION__;
1064 int account_id = -1;
1065 int ret = ACCOUNT_ERROR_NONE;
1066 ret = account_connect();
1068 if ( ret != ACCOUNT_ERROR_NONE ) {
1069 dts_fail(API_NAME, "failed");
1072 ret = account_create(&account);
1074 if ( ret != ACCOUNT_ERROR_NONE ) {
1075 dts_fail(API_NAME, "failed");
1077 ret = account_set_package_name(account, NULL);
1079 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1080 dts_pass(API_NAME, "passed");
1082 dts_fail(API_NAME, "failed");
1085 ret = account_insert_to_db(account, &account_id);
1087 if ( ret != ACCOUNT_ERROR_NONE ) {
1088 dts_fail(API_NAME, "failed");
1091 ret = account_destroy(account);
1093 if ( ret != ACCOUNT_ERROR_NONE ) {
1094 dts_fail(API_NAME, "failed");
1097 ret = account_disconnect();
1099 if ( ret != ACCOUNT_ERROR_NONE ) {
1100 dts_fail(API_NAME, "failed");
1104 static void utc_account_set_access_token_positive(void)
1106 const char *API_NAME = __FUNCTION__;
1108 int account_id = -1;
1109 int ret = ACCOUNT_ERROR_NONE;
1110 ret = account_connect();
1112 if ( ret != ACCOUNT_ERROR_NONE ) {
1113 dts_fail(API_NAME, "failed");
1116 ret = account_create(&account);
1118 if ( ret != ACCOUNT_ERROR_NONE ) {
1119 dts_fail(API_NAME, "failed");
1122 ret = account_set_access_token(account, "access_token");
1124 if ( ret == ACCOUNT_ERROR_NONE ) {
1125 dts_pass(API_NAME, "passed");
1127 dts_fail(API_NAME, "failed");
1130 ret = account_insert_to_db(account, &account_id);
1132 if ( ret != ACCOUNT_ERROR_NONE ) {
1133 dts_fail(API_NAME, "failed");
1136 ret = account_destroy(account);
1138 if ( ret != ACCOUNT_ERROR_NONE ) {
1139 dts_fail(API_NAME, "failed");
1142 ret = account_disconnect();
1144 if ( ret != ACCOUNT_ERROR_NONE ) {
1145 dts_fail(API_NAME, "failed");
1149 static void utc_account_set_access_token_negative(void)
1151 const char *API_NAME = __FUNCTION__;
1153 int account_id = -1;
1154 int ret = ACCOUNT_ERROR_NONE;
1155 ret = account_connect();
1157 if ( ret != ACCOUNT_ERROR_NONE ) {
1158 dts_fail(API_NAME, "failed");
1161 ret = account_create(&account);
1163 if ( ret != ACCOUNT_ERROR_NONE ) {
1164 dts_fail(API_NAME, "failed");
1166 ret = account_set_access_token(account, NULL);
1168 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1169 dts_pass(API_NAME, "passed");
1171 dts_fail(API_NAME, "failed");
1174 ret = account_insert_to_db(account, &account_id);
1176 if ( ret != ACCOUNT_ERROR_NONE ) {
1177 dts_fail(API_NAME, "failed");
1180 ret = account_destroy(account);
1182 if ( ret != ACCOUNT_ERROR_NONE ) {
1183 dts_fail(API_NAME, "failed");
1186 ret = account_disconnect();
1188 if ( ret != ACCOUNT_ERROR_NONE ) {
1189 dts_fail(API_NAME, "failed");
1193 static void utc_account_set_auth_type_positive(void)
1195 const char *API_NAME = __FUNCTION__;
1197 int account_id = -1;
1198 int ret = ACCOUNT_ERROR_NONE;
1199 ret = account_connect();
1201 if ( ret != ACCOUNT_ERROR_NONE ) {
1202 dts_fail(API_NAME, "failed");
1205 ret = account_create(&account);
1207 if ( ret != ACCOUNT_ERROR_NONE ) {
1208 dts_fail(API_NAME, "failed");
1211 ret = account_set_auth_type(account, ACCOUNT_AUTH_TYPE_XAUTH);
1213 if ( ret == ACCOUNT_ERROR_NONE ) {
1214 dts_pass(API_NAME, "passed");
1216 dts_fail(API_NAME, "failed");
1219 ret = account_insert_to_db(account, &account_id);
1221 if ( ret != ACCOUNT_ERROR_NONE ) {
1222 dts_fail(API_NAME, "failed");
1225 ret = account_destroy(account);
1227 if ( ret != ACCOUNT_ERROR_NONE ) {
1228 dts_fail(API_NAME, "failed");
1231 ret = account_disconnect();
1233 if ( ret != ACCOUNT_ERROR_NONE ) {
1234 dts_fail(API_NAME, "failed");
1238 static void utc_account_set_auth_type_negative(void)
1240 const char *API_NAME = __FUNCTION__;
1242 int account_id = -1;
1243 int ret = ACCOUNT_ERROR_NONE;
1244 ret = account_connect();
1246 if ( ret != ACCOUNT_ERROR_NONE ) {
1247 dts_fail(API_NAME, "failed");
1250 ret = account_create(&account);
1252 if ( ret != ACCOUNT_ERROR_NONE ) {
1253 dts_fail(API_NAME, "failed");
1255 ret = account_set_auth_type(account, -999);
1257 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1258 dts_pass(API_NAME, "passed");
1260 dts_fail(API_NAME, "failed");
1263 ret = account_insert_to_db(account, &account_id);
1265 if ( ret != ACCOUNT_ERROR_NONE ) {
1266 dts_fail(API_NAME, "failed");
1269 ret = account_destroy(account);
1271 if ( ret != ACCOUNT_ERROR_NONE ) {
1272 dts_fail(API_NAME, "failed");
1275 ret = account_disconnect();
1277 if ( ret != ACCOUNT_ERROR_NONE ) {
1278 dts_fail(API_NAME, "failed");
1282 static void utc_account_set_secret_positive(void)
1284 const char *API_NAME = __FUNCTION__;
1286 int account_id = -1;
1287 int ret = ACCOUNT_ERROR_NONE;
1288 ret = account_connect();
1290 if ( ret != ACCOUNT_ERROR_NONE ) {
1291 dts_fail(API_NAME, "failed");
1294 ret = account_create(&account);
1296 if ( ret != ACCOUNT_ERROR_NONE ) {
1297 dts_fail(API_NAME, "failed");
1300 ret = account_set_secret(account, ACCOUNT_SECRECY_INVISIBLE);
1302 if ( ret == ACCOUNT_ERROR_NONE ) {
1303 dts_pass(API_NAME, "passed");
1305 dts_fail(API_NAME, "failed");
1308 ret = account_insert_to_db(account, &account_id);
1310 if ( ret != ACCOUNT_ERROR_NONE ) {
1311 dts_fail(API_NAME, "failed");
1314 ret = account_destroy(account);
1316 if ( ret != ACCOUNT_ERROR_NONE ) {
1317 dts_fail(API_NAME, "failed");
1320 ret = account_disconnect();
1322 if ( ret != ACCOUNT_ERROR_NONE ) {
1323 dts_fail(API_NAME, "failed");
1327 static void utc_account_set_secret_negative(void)
1329 const char *API_NAME = __FUNCTION__;
1331 int account_id = -1;
1332 int ret = ACCOUNT_ERROR_NONE;
1333 ret = account_connect();
1335 if ( ret != ACCOUNT_ERROR_NONE ) {
1336 dts_fail(API_NAME, "failed");
1339 ret = account_create(&account);
1341 if ( ret != ACCOUNT_ERROR_NONE ) {
1342 dts_fail(API_NAME, "failed");
1344 ret = account_set_secret(account, -999);
1346 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1347 dts_pass(API_NAME, "passed");
1349 dts_fail(API_NAME, "failed");
1352 ret = account_insert_to_db(account, &account_id);
1354 if ( ret != ACCOUNT_ERROR_NONE ) {
1355 dts_fail(API_NAME, "failed");
1358 ret = account_destroy(account);
1360 if ( ret != ACCOUNT_ERROR_NONE ) {
1361 dts_fail(API_NAME, "failed");
1364 ret = account_disconnect();
1366 if ( ret != ACCOUNT_ERROR_NONE ) {
1367 dts_fail(API_NAME, "failed");
1371 static void utc_account_set_sync_support_positive(void)
1373 const char *API_NAME = __FUNCTION__;
1375 int account_id = -1;
1376 int ret = ACCOUNT_ERROR_NONE;
1377 ret = account_connect();
1379 if ( ret != ACCOUNT_ERROR_NONE ) {
1380 dts_fail(API_NAME, "failed");
1383 ret = account_create(&account);
1385 if ( ret != ACCOUNT_ERROR_NONE ) {
1386 dts_fail(API_NAME, "failed");
1389 ret = account_set_sync_support(account, ACCOUNT_SYNC_STATUS_IDLE);
1391 if ( ret == ACCOUNT_ERROR_NONE ) {
1392 dts_pass(API_NAME, "passed");
1394 dts_fail(API_NAME, "failed");
1397 ret = account_insert_to_db(account, &account_id);
1399 if ( ret != ACCOUNT_ERROR_NONE ) {
1400 dts_fail(API_NAME, "failed");
1403 ret = account_destroy(account);
1405 if ( ret != ACCOUNT_ERROR_NONE ) {
1406 dts_fail(API_NAME, "failed");
1409 ret = account_disconnect();
1411 if ( ret != ACCOUNT_ERROR_NONE ) {
1412 dts_fail(API_NAME, "failed");
1416 static void utc_account_set_sync_support_negative(void)
1418 const char *API_NAME = __FUNCTION__;
1420 int account_id = -1;
1421 int ret = ACCOUNT_ERROR_NONE;
1422 ret = account_connect();
1424 if ( ret != ACCOUNT_ERROR_NONE ) {
1425 dts_fail(API_NAME, "failed");
1428 ret = account_create(&account);
1430 if ( ret != ACCOUNT_ERROR_NONE ) {
1431 dts_fail(API_NAME, "failed");
1433 ret = account_set_sync_support(account, -999);
1435 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1436 dts_pass(API_NAME, "passed");
1438 dts_fail(API_NAME, "failed");
1441 ret = account_insert_to_db(account, &account_id);
1443 if ( ret != ACCOUNT_ERROR_NONE ) {
1444 dts_fail(API_NAME, "failed");
1447 ret = account_destroy(account);
1449 if ( ret != ACCOUNT_ERROR_NONE ) {
1450 dts_fail(API_NAME, "failed");
1453 ret = account_disconnect();
1455 if ( ret != ACCOUNT_ERROR_NONE ) {
1456 dts_fail(API_NAME, "failed");
1460 static void utc_account_set_user_text_positive(void)
1462 const char *API_NAME = __FUNCTION__;
1464 int account_id = -1;
1465 int ret = ACCOUNT_ERROR_NONE;
1466 ret = account_connect();
1468 if ( ret != ACCOUNT_ERROR_NONE ) {
1469 dts_fail(API_NAME, "failed");
1472 ret = account_create(&account);
1474 if ( ret != ACCOUNT_ERROR_NONE ) {
1475 dts_fail(API_NAME, "failed");
1478 for ( i = 0; i < 5; i++)
1479 ret = account_set_user_text(account, i, "user-text");
1481 if ( ret == ACCOUNT_ERROR_NONE ) {
1482 dts_pass(API_NAME, "passed");
1484 dts_fail(API_NAME, "failed");
1487 ret = account_insert_to_db(account, &account_id);
1489 if ( ret != ACCOUNT_ERROR_NONE ) {
1490 dts_fail(API_NAME, "failed");
1493 ret = account_destroy(account);
1495 if ( ret != ACCOUNT_ERROR_NONE ) {
1496 dts_fail(API_NAME, "failed");
1499 ret = account_disconnect();
1501 if ( ret != ACCOUNT_ERROR_NONE ) {
1502 dts_fail(API_NAME, "failed");
1506 static void utc_account_set_user_text_negative(void)
1508 const char *API_NAME = __FUNCTION__;
1510 int account_id = -1;
1511 int ret = ACCOUNT_ERROR_NONE;
1512 ret = account_connect();
1514 if ( ret != ACCOUNT_ERROR_NONE ) {
1515 dts_fail(API_NAME, "failed");
1518 ret = account_create(&account);
1520 if ( ret != ACCOUNT_ERROR_NONE ) {
1521 dts_fail(API_NAME, "failed");
1525 for (i = 0; i < 5; i++)
1526 ret = account_set_user_text(account, i, NULL);
1528 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1529 dts_pass(API_NAME, "passed");
1531 dts_fail(API_NAME, "failed");
1534 ret = account_insert_to_db(account, &account_id);
1536 if ( ret != ACCOUNT_ERROR_NONE ) {
1537 dts_fail(API_NAME, "failed");
1540 ret = account_destroy(account);
1542 if ( ret != ACCOUNT_ERROR_NONE ) {
1543 dts_fail(API_NAME, "failed");
1546 ret = account_disconnect();
1548 if ( ret != ACCOUNT_ERROR_NONE ) {
1549 dts_fail(API_NAME, "failed");
1553 static void utc_account_set_user_int_positive(void)
1555 const char *API_NAME = __FUNCTION__;
1557 int account_id = -1;
1558 int ret = ACCOUNT_ERROR_NONE;
1559 ret = account_connect();
1561 if ( ret != ACCOUNT_ERROR_NONE ) {
1562 dts_fail(API_NAME, "failed");
1565 ret = account_create(&account);
1567 if ( ret != ACCOUNT_ERROR_NONE ) {
1568 dts_fail(API_NAME, "failed");
1571 for (i = 0; i < 5; i++)
1572 ret = account_set_user_int(account, i, 999);
1574 if ( ret == ACCOUNT_ERROR_NONE ) {
1575 dts_pass(API_NAME, "passed");
1577 dts_fail(API_NAME, "failed");
1580 ret = account_insert_to_db(account, &account_id);
1582 if ( ret != ACCOUNT_ERROR_NONE ) {
1583 dts_fail(API_NAME, "failed");
1586 ret = account_destroy(account);
1588 if ( ret != ACCOUNT_ERROR_NONE ) {
1589 dts_fail(API_NAME, "failed");
1592 ret = account_disconnect();
1594 if ( ret != ACCOUNT_ERROR_NONE ) {
1595 dts_fail(API_NAME, "failed");
1599 static void utc_account_set_user_int_negative(void)
1601 const char *API_NAME = __FUNCTION__;
1603 int account_id = -1;
1604 int ret = ACCOUNT_ERROR_NONE;
1605 ret = account_connect();
1607 if ( ret != ACCOUNT_ERROR_NONE ) {
1608 dts_fail(API_NAME, "failed");
1611 ret = account_create(&account);
1613 if ( ret != ACCOUNT_ERROR_NONE ) {
1614 dts_fail(API_NAME, "failed");
1617 for (i = 0; i < 5; i++)
1618 ret = account_set_user_int(NULL, i, 999);
1620 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1621 dts_pass(API_NAME, "passed");
1623 dts_fail(API_NAME, "failed");
1626 ret = account_insert_to_db(account, &account_id);
1628 if ( ret != ACCOUNT_ERROR_NONE ) {
1629 dts_fail(API_NAME, "failed");
1632 ret = account_destroy(account);
1634 if ( ret != ACCOUNT_ERROR_NONE ) {
1635 dts_fail(API_NAME, "failed");
1638 ret = account_disconnect();
1640 if ( ret != ACCOUNT_ERROR_NONE ) {
1641 dts_fail(API_NAME, "failed");
1645 static void utc_account_set_capability_positive(void)
1647 const char *API_NAME = __FUNCTION__;
1649 int account_id = -1;
1650 int ret = ACCOUNT_ERROR_NONE;
1651 ret = account_connect();
1653 if ( ret != ACCOUNT_ERROR_NONE ) {
1654 dts_fail(API_NAME, "failed");
1657 ret = account_create(&account);
1659 if ( ret != ACCOUNT_ERROR_NONE ) {
1660 dts_fail(API_NAME, "failed");
1663 ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
1665 if ( ret == ACCOUNT_ERROR_NONE ) {
1666 dts_pass(API_NAME, "passed");
1668 dts_fail(API_NAME, "failed");
1671 ret = account_insert_to_db(account, &account_id);
1673 if ( ret != ACCOUNT_ERROR_NONE ) {
1674 dts_fail(API_NAME, "failed");
1677 ret = account_destroy(account);
1679 if ( ret != ACCOUNT_ERROR_NONE ) {
1680 dts_fail(API_NAME, "failed");
1683 ret = account_disconnect();
1685 if ( ret != ACCOUNT_ERROR_NONE ) {
1686 dts_fail(API_NAME, "failed");
1690 static void utc_account_set_capability_negative(void)
1692 const char *API_NAME = __FUNCTION__;
1694 int account_id = -1;
1695 int ret = ACCOUNT_ERROR_NONE;
1696 ret = account_connect();
1698 if ( ret != ACCOUNT_ERROR_NONE ) {
1699 dts_fail(API_NAME, "failed");
1702 ret = account_create(&account);
1704 if ( ret != ACCOUNT_ERROR_NONE ) {
1705 dts_fail(API_NAME, "failed");
1708 ret = account_set_capability(account, -100, -5);
1710 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1711 dts_pass(API_NAME, "passed");
1713 dts_fail(API_NAME, "failed");
1716 ret = account_insert_to_db(account, &account_id);
1718 if ( ret != ACCOUNT_ERROR_NONE ) {
1719 dts_fail(API_NAME, "failed");
1722 ret = account_destroy(account);
1724 if ( ret != ACCOUNT_ERROR_NONE ) {
1725 dts_fail(API_NAME, "failed");
1728 ret = account_disconnect();
1730 if ( ret != ACCOUNT_ERROR_NONE ) {
1731 dts_fail(API_NAME, "failed");
1735 static void utc_account_get_display_name_positive(void)
1737 const char *API_NAME = __FUNCTION__;
1738 char * display_name;
1740 int account_id = -1;
1741 int ret = ACCOUNT_ERROR_NONE;
1742 ret = account_connect();
1744 if ( ret != ACCOUNT_ERROR_NONE ) {
1745 dts_fail(API_NAME, "failed");
1748 ret = account_create(&account);
1750 if ( ret != ACCOUNT_ERROR_NONE ) {
1751 dts_fail(API_NAME, "failed");
1754 ret = account_query_account_by_account_id(1, &account);
1756 if ( ret != ACCOUNT_ERROR_NONE ) {
1757 dts_fail(API_NAME, "failed");
1760 ret = account_get_display_name(account, &display_name);
1762 if ( ret == ACCOUNT_ERROR_NONE ) {
1763 dts_pass(API_NAME, "passed");
1765 dts_fail(API_NAME, "failed");
1768 _account_free_text(display_name);
1770 ret = account_destroy(account);
1772 if ( ret != ACCOUNT_ERROR_NONE ) {
1773 dts_fail(API_NAME, "failed");
1776 ret = account_disconnect();
1778 if ( ret != ACCOUNT_ERROR_NONE ) {
1779 dts_fail(API_NAME, "failed");
1783 static void utc_account_get_display_name_negative(void)
1785 const char *API_NAME = __FUNCTION__;
1787 int account_id = -1;
1788 int ret = ACCOUNT_ERROR_NONE;
1789 ret = account_connect();
1791 if ( ret != ACCOUNT_ERROR_NONE ) {
1792 dts_fail(API_NAME, "failed");
1795 ret = account_create(&account);
1797 if ( ret != ACCOUNT_ERROR_NONE ) {
1798 dts_fail(API_NAME, "failed");
1802 ret = account_query_account_by_account_id(1, &account);
1804 if ( ret != ACCOUNT_ERROR_NONE ) {
1805 dts_fail(API_NAME, "failed");
1808 ret = account_get_display_name(account, NULL);
1810 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1811 dts_pass(API_NAME, "passed");
1813 dts_fail(API_NAME, "failed");
1816 ret = account_destroy(account);
1818 if ( ret != ACCOUNT_ERROR_NONE ) {
1819 dts_fail(API_NAME, "failed");
1822 ret = account_disconnect();
1824 if ( ret != ACCOUNT_ERROR_NONE ) {
1825 dts_fail(API_NAME, "failed");
1829 static void utc_account_get_account_id_positive(void)
1831 const char *API_NAME = __FUNCTION__;
1833 int account_id = -1;
1834 int ret = ACCOUNT_ERROR_NONE;
1835 ret = account_connect();
1837 if ( ret != ACCOUNT_ERROR_NONE ) {
1838 dts_fail(API_NAME, "failed");
1841 ret = account_create(&account);
1843 if ( ret != ACCOUNT_ERROR_NONE ) {
1844 dts_fail(API_NAME, "failed");
1847 ret = account_query_account_by_account_id(1, &account);
1849 if ( ret != ACCOUNT_ERROR_NONE ) {
1850 dts_fail(API_NAME, "failed");
1853 ret = account_get_account_id(account, &account_id);
1855 if ( ret == ACCOUNT_ERROR_NONE ) {
1856 dts_pass(API_NAME, "passed");
1858 dts_fail(API_NAME, "failed");
1861 ret = account_destroy(account);
1863 if ( ret != ACCOUNT_ERROR_NONE ) {
1864 dts_fail(API_NAME, "failed");
1867 ret = account_disconnect();
1869 if ( ret != ACCOUNT_ERROR_NONE ) {
1870 dts_fail(API_NAME, "failed");
1874 static void utc_account_get_account_id_negative(void)
1876 const char *API_NAME = __FUNCTION__;
1878 int account_id = -1;
1879 int ret = ACCOUNT_ERROR_NONE;
1880 ret = account_connect();
1882 if ( ret != ACCOUNT_ERROR_NONE ) {
1883 dts_fail(API_NAME, "failed");
1886 ret = account_create(&account);
1888 if ( ret != ACCOUNT_ERROR_NONE ) {
1889 dts_fail(API_NAME, "failed");
1892 ret = account_query_account_by_account_id(1, &account);
1894 if ( ret != ACCOUNT_ERROR_NONE ) {
1895 dts_fail(API_NAME, "failed");
1898 ret = account_get_account_id(account, NULL);
1900 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1901 dts_pass(API_NAME, "passed");
1903 dts_fail(API_NAME, "failed");
1906 ret = account_destroy(account);
1908 if ( ret != ACCOUNT_ERROR_NONE ) {
1909 dts_fail(API_NAME, "failed");
1912 ret = account_disconnect();
1914 if ( ret != ACCOUNT_ERROR_NONE ) {
1915 dts_fail(API_NAME, "failed");
1919 static void utc_account_get_user_name_positive(void)
1921 const char *API_NAME = __FUNCTION__;
1924 int account_id = -1;
1925 int ret = ACCOUNT_ERROR_NONE;
1926 ret = account_connect();
1928 if ( ret != ACCOUNT_ERROR_NONE ) {
1929 dts_fail(API_NAME, "failed");
1932 ret = account_create(&account);
1934 if ( ret != ACCOUNT_ERROR_NONE ) {
1935 dts_fail(API_NAME, "failed");
1938 ret = account_query_account_by_account_id(1, &account);
1940 if ( ret != ACCOUNT_ERROR_NONE ) {
1941 dts_fail(API_NAME, "failed");
1944 ret = account_get_user_name(account, &user_name);
1946 if ( ret == ACCOUNT_ERROR_NONE ) {
1947 dts_pass(API_NAME, "passed");
1949 dts_fail(API_NAME, "failed");
1952 _account_free_text(user_name);
1954 ret = account_destroy(account);
1956 if ( ret != ACCOUNT_ERROR_NONE ) {
1957 dts_fail(API_NAME, "failed");
1960 ret = account_disconnect();
1962 if ( ret != ACCOUNT_ERROR_NONE ) {
1963 dts_fail(API_NAME, "failed");
1967 static void utc_account_get_user_name_negative(void)
1969 const char *API_NAME = __FUNCTION__;
1971 int account_id = -1;
1972 int ret = ACCOUNT_ERROR_NONE;
1973 ret = account_connect();
1975 if ( ret != ACCOUNT_ERROR_NONE ) {
1976 dts_fail(API_NAME, "failed");
1979 ret = account_create(&account);
1981 if ( ret != ACCOUNT_ERROR_NONE ) {
1982 dts_fail(API_NAME, "failed");
1985 ret = account_query_account_by_account_id(1, &account);
1987 if ( ret != ACCOUNT_ERROR_NONE ) {
1988 dts_fail(API_NAME, "failed");
1991 ret = account_get_user_name(account, NULL);
1993 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
1994 dts_pass(API_NAME, "passed");
1996 dts_fail(API_NAME, "failed");
1999 ret = account_destroy(account);
2001 if ( ret != ACCOUNT_ERROR_NONE ) {
2002 dts_fail(API_NAME, "failed");
2005 ret = account_disconnect();
2007 if ( ret != ACCOUNT_ERROR_NONE ) {
2008 dts_fail(API_NAME, "failed");
2012 static void utc_account_get_icon_path_positive(void)
2014 const char *API_NAME = __FUNCTION__;
2017 int account_id = -1;
2018 int ret = ACCOUNT_ERROR_NONE;
2019 ret = account_connect();
2021 if ( ret != ACCOUNT_ERROR_NONE ) {
2022 dts_fail(API_NAME, "failed");
2025 ret = account_create(&account);
2027 if ( ret != ACCOUNT_ERROR_NONE ) {
2028 dts_fail(API_NAME, "failed");
2031 ret = account_query_account_by_account_id(1, &account);
2033 if ( ret != ACCOUNT_ERROR_NONE ) {
2034 dts_fail(API_NAME, "failed");
2037 ret = account_get_icon_path(account, &icon_path);
2039 if ( ret == ACCOUNT_ERROR_NONE ) {
2040 dts_pass(API_NAME, "passed");
2042 dts_fail(API_NAME, "failed");
2045 _account_free_text(icon_path);
2047 ret = account_destroy(account);
2049 if ( ret != ACCOUNT_ERROR_NONE ) {
2050 dts_fail(API_NAME, "failed");
2053 ret = account_disconnect();
2055 if ( ret != ACCOUNT_ERROR_NONE ) {
2056 dts_fail(API_NAME, "failed");
2060 static void utc_account_get_icon_path_negative(void)
2062 const char *API_NAME = __FUNCTION__;
2064 int account_id = -1;
2065 int ret = ACCOUNT_ERROR_NONE;
2066 ret = account_connect();
2068 if ( ret != ACCOUNT_ERROR_NONE ) {
2069 dts_fail(API_NAME, "failed");
2072 ret = account_create(&account);
2074 if ( ret != ACCOUNT_ERROR_NONE ) {
2075 dts_fail(API_NAME, "failed");
2078 ret = account_query_account_by_account_id(1, &account);
2080 if ( ret != ACCOUNT_ERROR_NONE ) {
2081 dts_fail(API_NAME, "failed");
2084 ret = account_get_icon_path(account, NULL);
2086 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2087 dts_pass(API_NAME, "passed");
2089 dts_fail(API_NAME, "failed");
2092 ret = account_destroy(account);
2094 if ( ret != ACCOUNT_ERROR_NONE ) {
2095 dts_fail(API_NAME, "failed");
2098 ret = account_disconnect();
2100 if ( ret != ACCOUNT_ERROR_NONE ) {
2101 dts_fail(API_NAME, "failed");
2105 static void utc_account_get_domain_name_positive(void)
2107 const char *API_NAME = __FUNCTION__;
2110 int account_id = -1;
2111 int ret = ACCOUNT_ERROR_NONE;
2112 ret = account_connect();
2114 if ( ret != ACCOUNT_ERROR_NONE ) {
2115 dts_fail(API_NAME, "failed");
2118 ret = account_create(&account);
2120 if ( ret != ACCOUNT_ERROR_NONE ) {
2121 dts_fail(API_NAME, "failed");
2124 ret = account_query_account_by_account_id(1, &account);
2126 if ( ret != ACCOUNT_ERROR_NONE ) {
2127 dts_fail(API_NAME, "failed");
2130 ret = account_get_domain_name(account, &domain_name);
2132 if ( ret == ACCOUNT_ERROR_NONE ) {
2133 dts_pass(API_NAME, "passed");
2135 dts_fail(API_NAME, "failed");
2138 _account_free_text(domain_name);
2140 ret = account_destroy(account);
2142 if ( ret != ACCOUNT_ERROR_NONE ) {
2143 dts_fail(API_NAME, "failed");
2146 ret = account_disconnect();
2148 if ( ret != ACCOUNT_ERROR_NONE ) {
2149 dts_fail(API_NAME, "failed");
2153 static void utc_account_get_domain_name_negative(void)
2155 const char *API_NAME = __FUNCTION__;
2157 int account_id = -1;
2158 int ret = ACCOUNT_ERROR_NONE;
2159 ret = account_connect();
2161 if ( ret != ACCOUNT_ERROR_NONE ) {
2162 dts_fail(API_NAME, "failed");
2165 ret = account_create(&account);
2167 if ( ret != ACCOUNT_ERROR_NONE ) {
2168 dts_fail(API_NAME, "failed");
2171 ret = account_query_account_by_account_id(1, &account);
2173 if ( ret != ACCOUNT_ERROR_NONE ) {
2174 dts_fail(API_NAME, "failed");
2177 ret = account_get_domain_name(account, NULL);
2179 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2180 dts_pass(API_NAME, "passed");
2182 dts_fail(API_NAME, "failed");
2185 ret = account_destroy(account);
2187 if ( ret != ACCOUNT_ERROR_NONE ) {
2188 dts_fail(API_NAME, "failed");
2191 ret = account_disconnect();
2193 if ( ret != ACCOUNT_ERROR_NONE ) {
2194 dts_fail(API_NAME, "failed");
2198 static void utc_account_get_email_address_positive(void)
2200 const char *API_NAME = __FUNCTION__;
2202 char *email_address;
2203 int account_id = -1;
2204 int ret = ACCOUNT_ERROR_NONE;
2205 ret = account_connect();
2207 if ( ret != ACCOUNT_ERROR_NONE ) {
2208 dts_fail(API_NAME, "failed");
2211 ret = account_create(&account);
2213 if ( ret != ACCOUNT_ERROR_NONE ) {
2214 dts_fail(API_NAME, "failed");
2217 ret = account_query_account_by_account_id(1, &account);
2219 if ( ret != ACCOUNT_ERROR_NONE ) {
2220 dts_fail(API_NAME, "failed");
2223 ret = account_get_email_address(account, &email_address);
2225 if ( ret == ACCOUNT_ERROR_NONE ) {
2226 dts_pass(API_NAME, "passed");
2228 dts_fail(API_NAME, "failed");
2231 _account_free_text(email_address);
2233 ret = account_destroy(account);
2235 if ( ret != ACCOUNT_ERROR_NONE ) {
2236 dts_fail(API_NAME, "failed");
2239 ret = account_disconnect();
2241 if ( ret != ACCOUNT_ERROR_NONE ) {
2242 dts_fail(API_NAME, "failed");
2246 static void utc_account_get_email_address_negative(void)
2248 const char *API_NAME = __FUNCTION__;
2250 int account_id = -1;
2251 int ret = ACCOUNT_ERROR_NONE;
2252 ret = account_connect();
2254 if ( ret != ACCOUNT_ERROR_NONE ) {
2255 dts_fail(API_NAME, "failed");
2258 ret = account_create(&account);
2260 if ( ret != ACCOUNT_ERROR_NONE ) {
2261 dts_fail(API_NAME, "failed");
2264 ret = account_query_account_by_account_id(1, &account);
2266 if ( ret != ACCOUNT_ERROR_NONE ) {
2267 dts_fail(API_NAME, "failed");
2270 ret = account_get_email_address(account, NULL);
2272 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2273 dts_pass(API_NAME, "passed");
2275 dts_fail(API_NAME, "failed");
2278 ret = account_destroy(account);
2280 if ( ret != ACCOUNT_ERROR_NONE ) {
2281 dts_fail(API_NAME, "failed");
2284 ret = account_disconnect();
2286 if ( ret != ACCOUNT_ERROR_NONE ) {
2287 dts_fail(API_NAME, "failed");
2291 static void utc_account_get_source_positive(void)
2293 const char *API_NAME = __FUNCTION__;
2296 int account_id = -1;
2297 int ret = ACCOUNT_ERROR_NONE;
2298 ret = account_connect();
2300 if ( ret != ACCOUNT_ERROR_NONE ) {
2301 dts_fail(API_NAME, "failed");
2304 ret = account_create(&account);
2306 if ( ret != ACCOUNT_ERROR_NONE ) {
2307 dts_fail(API_NAME, "failed");
2310 ret = account_query_account_by_account_id(1, &account);
2312 if ( ret != ACCOUNT_ERROR_NONE ) {
2313 dts_fail(API_NAME, "failed");
2316 ret = account_get_source(account, &source);
2318 if ( ret == ACCOUNT_ERROR_NONE ) {
2319 dts_pass(API_NAME, "passed");
2321 dts_fail(API_NAME, "failed");
2324 _account_free_text(source);
2326 ret = account_destroy(account);
2328 if ( ret != ACCOUNT_ERROR_NONE ) {
2329 dts_fail(API_NAME, "failed");
2332 ret = account_disconnect();
2334 if ( ret != ACCOUNT_ERROR_NONE ) {
2335 dts_fail(API_NAME, "failed");
2339 static void utc_account_get_source_negative(void)
2341 const char *API_NAME = __FUNCTION__;
2343 int account_id = -1;
2344 int ret = ACCOUNT_ERROR_NONE;
2345 ret = account_connect();
2347 if ( ret != ACCOUNT_ERROR_NONE ) {
2348 dts_fail(API_NAME, "failed");
2351 ret = account_create(&account);
2353 if ( ret != ACCOUNT_ERROR_NONE ) {
2354 dts_fail(API_NAME, "failed");
2357 ret = account_query_account_by_account_id(1, &account);
2359 if ( ret != ACCOUNT_ERROR_NONE ) {
2360 dts_fail(API_NAME, "failed");
2363 ret = account_get_source(account, NULL);
2365 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2366 dts_pass(API_NAME, "passed");
2368 dts_fail(API_NAME, "failed");
2371 ret = account_destroy(account);
2373 if ( ret != ACCOUNT_ERROR_NONE ) {
2374 dts_fail(API_NAME, "failed");
2377 ret = account_disconnect();
2379 if ( ret != ACCOUNT_ERROR_NONE ) {
2380 dts_fail(API_NAME, "failed");
2384 static void utc_account_get_package_name_positive(void)
2386 const char *API_NAME = __FUNCTION__;
2389 int account_id = -1;
2390 int ret = ACCOUNT_ERROR_NONE;
2391 ret = account_connect();
2393 if ( ret != ACCOUNT_ERROR_NONE ) {
2394 dts_fail(API_NAME, "failed");
2397 ret = account_create(&account);
2399 if ( ret != ACCOUNT_ERROR_NONE ) {
2400 dts_fail(API_NAME, "failed");
2403 ret = account_query_account_by_account_id(1, &account);
2405 if ( ret != ACCOUNT_ERROR_NONE ) {
2406 dts_fail(API_NAME, "failed");
2409 ret = account_get_package_name(account, &package_name);
2411 if ( ret == ACCOUNT_ERROR_NONE ) {
2412 dts_pass(API_NAME, "passed");
2414 dts_fail(API_NAME, "failed");
2417 _account_free_text(package_name);
2419 ret = account_destroy(account);
2421 if ( ret != ACCOUNT_ERROR_NONE ) {
2422 dts_fail(API_NAME, "failed");
2425 ret = account_disconnect();
2427 if ( ret != ACCOUNT_ERROR_NONE ) {
2428 dts_fail(API_NAME, "failed");
2432 static void utc_account_get_package_name_negative(void)
2434 const char *API_NAME = __FUNCTION__;
2436 int account_id = -1;
2437 int ret = ACCOUNT_ERROR_NONE;
2438 ret = account_connect();
2440 if ( ret != ACCOUNT_ERROR_NONE ) {
2441 dts_fail(API_NAME, "failed");
2444 ret = account_create(&account);
2446 if ( ret != ACCOUNT_ERROR_NONE ) {
2447 dts_fail(API_NAME, "failed");
2450 ret = account_query_account_by_account_id(1, &account);
2452 if ( ret != ACCOUNT_ERROR_NONE ) {
2453 dts_fail(API_NAME, "failed");
2456 ret = account_get_package_name(account, NULL);
2458 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2459 dts_pass(API_NAME, "passed");
2461 dts_fail(API_NAME, "failed");
2464 ret = account_destroy(account);
2466 if ( ret != ACCOUNT_ERROR_NONE ) {
2467 dts_fail(API_NAME, "failed");
2470 ret = account_disconnect();
2472 if ( ret != ACCOUNT_ERROR_NONE ) {
2473 dts_fail(API_NAME, "failed");
2477 static void utc_account_get_access_token_positive(void)
2479 const char *API_NAME = __FUNCTION__;
2482 int account_id = -1;
2483 int ret = ACCOUNT_ERROR_NONE;
2484 ret = account_connect();
2486 if ( ret != ACCOUNT_ERROR_NONE ) {
2487 dts_fail(API_NAME, "failed");
2490 ret = account_create(&account);
2492 if ( ret != ACCOUNT_ERROR_NONE ) {
2493 dts_fail(API_NAME, "failed");
2496 ret = account_query_account_by_account_id(1, &account);
2498 if ( ret != ACCOUNT_ERROR_NONE ) {
2499 dts_fail(API_NAME, "failed");
2502 ret = account_get_access_token(account, &access_token);
2504 if ( ret == ACCOUNT_ERROR_NONE ) {
2505 dts_pass(API_NAME, "passed");
2507 dts_fail(API_NAME, "failed");
2510 _account_free_text(access_token);
2512 ret = account_destroy(account);
2514 if ( ret != ACCOUNT_ERROR_NONE ) {
2515 dts_fail(API_NAME, "failed");
2518 ret = account_disconnect();
2520 if ( ret != ACCOUNT_ERROR_NONE ) {
2521 dts_fail(API_NAME, "failed");
2525 static void utc_account_get_access_token_negative(void)
2527 const char *API_NAME = __FUNCTION__;
2529 int account_id = -1;
2530 int ret = ACCOUNT_ERROR_NONE;
2531 ret = account_connect();
2533 if ( ret != ACCOUNT_ERROR_NONE ) {
2534 dts_fail(API_NAME, "failed");
2537 ret = account_create(&account);
2539 if ( ret != ACCOUNT_ERROR_NONE ) {
2540 dts_fail(API_NAME, "failed");
2543 ret = account_query_account_by_account_id(1, &account);
2545 if ( ret != ACCOUNT_ERROR_NONE ) {
2546 dts_fail(API_NAME, "failed");
2549 ret = account_get_access_token(account, NULL);
2551 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2552 dts_pass(API_NAME, "passed");
2554 dts_fail(API_NAME, "failed");
2557 ret = account_destroy(account);
2559 if ( ret != ACCOUNT_ERROR_NONE ) {
2560 dts_fail(API_NAME, "failed");
2563 ret = account_disconnect();
2565 if ( ret != ACCOUNT_ERROR_NONE ) {
2566 dts_fail(API_NAME, "failed");
2570 static void utc_account_get_auth_type_positive(void)
2572 const char *API_NAME = __FUNCTION__;
2575 int account_id = -1;
2576 int ret = ACCOUNT_ERROR_NONE;
2577 ret = account_connect();
2579 if ( ret != ACCOUNT_ERROR_NONE ) {
2580 dts_fail(API_NAME, "failed");
2583 ret = account_create(&account);
2585 if ( ret != ACCOUNT_ERROR_NONE ) {
2586 dts_fail(API_NAME, "failed");
2589 ret = account_query_account_by_account_id(1, &account);
2591 if ( ret != ACCOUNT_ERROR_NONE ) {
2592 dts_fail(API_NAME, "failed");
2595 ret = account_get_auth_type(account, &auth_type);
2597 if ( ret == ACCOUNT_ERROR_NONE ) {
2598 dts_pass(API_NAME, "passed");
2600 dts_fail(API_NAME, "failed");
2603 ret = account_destroy(account);
2605 if ( ret != ACCOUNT_ERROR_NONE ) {
2606 dts_fail(API_NAME, "failed");
2609 ret = account_disconnect();
2611 if ( ret != ACCOUNT_ERROR_NONE ) {
2612 dts_fail(API_NAME, "failed");
2616 static void utc_account_get_auth_type_negative(void)
2618 const char *API_NAME = __FUNCTION__;
2620 int account_id = -1;
2621 int ret = ACCOUNT_ERROR_NONE;
2622 ret = account_connect();
2624 if ( ret != ACCOUNT_ERROR_NONE ) {
2625 dts_fail(API_NAME, "failed");
2628 ret = account_create(&account);
2630 if ( ret != ACCOUNT_ERROR_NONE ) {
2631 dts_fail(API_NAME, "failed");
2634 ret = account_query_account_by_account_id(1, &account);
2636 if ( ret != ACCOUNT_ERROR_NONE ) {
2637 dts_fail(API_NAME, "failed");
2640 ret = account_get_auth_type(account, NULL);
2642 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2643 dts_pass(API_NAME, "passed");
2645 dts_fail(API_NAME, "failed");
2648 ret = account_destroy(account);
2650 if ( ret != ACCOUNT_ERROR_NONE ) {
2651 dts_fail(API_NAME, "failed");
2654 ret = account_disconnect();
2656 if ( ret != ACCOUNT_ERROR_NONE ) {
2657 dts_fail(API_NAME, "failed");
2661 static void utc_account_get_secret_positive(void)
2663 const char *API_NAME = __FUNCTION__;
2665 account_secrecy_state_e secret;
2666 int account_id = -1;
2667 int ret = ACCOUNT_ERROR_NONE;
2668 ret = account_connect();
2670 if ( ret != ACCOUNT_ERROR_NONE ) {
2671 dts_fail(API_NAME, "failed");
2674 ret = account_create(&account);
2676 if ( ret != ACCOUNT_ERROR_NONE ) {
2677 dts_fail(API_NAME, "failed");
2680 ret = account_query_account_by_account_id(1, &account);
2682 if ( ret != ACCOUNT_ERROR_NONE ) {
2683 dts_fail(API_NAME, "failed");
2686 ret = account_get_secret(account, &secret);
2688 if ( ret == ACCOUNT_ERROR_NONE ) {
2689 dts_pass(API_NAME, "passed");
2691 dts_fail(API_NAME, "failed");
2694 ret = account_destroy(account);
2696 if ( ret != ACCOUNT_ERROR_NONE ) {
2697 dts_fail(API_NAME, "failed");
2700 ret = account_disconnect();
2702 if ( ret != ACCOUNT_ERROR_NONE ) {
2703 dts_fail(API_NAME, "failed");
2707 static void utc_account_get_sync_support_positive(void)
2709 const char *API_NAME = __FUNCTION__;
2711 account_sync_state_e sync_support;
2712 int account_id = -1;
2713 int ret = ACCOUNT_ERROR_NONE;
2714 ret = account_connect();
2716 if ( ret != ACCOUNT_ERROR_NONE ) {
2717 dts_fail(API_NAME, "failed");
2720 ret = account_create(&account);
2722 if ( ret != ACCOUNT_ERROR_NONE ) {
2723 dts_fail(API_NAME, "failed");
2726 ret = account_query_account_by_account_id(1, &account);
2728 if ( ret != ACCOUNT_ERROR_NONE ) {
2729 dts_fail(API_NAME, "failed");
2732 ret = account_get_sync_support(account, &sync_support);
2734 if ( ret == ACCOUNT_ERROR_NONE ) {
2735 dts_pass(API_NAME, "passed");
2737 dts_fail(API_NAME, "failed");
2740 ret = account_destroy(account);
2742 if ( ret != ACCOUNT_ERROR_NONE ) {
2743 dts_fail(API_NAME, "failed");
2746 ret = account_disconnect();
2748 if ( ret != ACCOUNT_ERROR_NONE ) {
2749 dts_fail(API_NAME, "failed");
2753 static void utc_account_get_secret_negative(void)
2755 const char *API_NAME = __FUNCTION__;
2757 int account_id = -1;
2758 int ret = ACCOUNT_ERROR_NONE;
2759 ret = account_connect();
2761 if ( ret != ACCOUNT_ERROR_NONE ) {
2762 dts_fail(API_NAME, "failed");
2765 ret = account_create(&account);
2767 if ( ret != ACCOUNT_ERROR_NONE ) {
2768 dts_fail(API_NAME, "failed");
2771 ret = account_query_account_by_account_id(1, &account);
2773 if ( ret != ACCOUNT_ERROR_NONE ) {
2774 dts_fail(API_NAME, "failed");
2777 ret = account_get_secret(account, NULL);
2779 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2780 dts_pass(API_NAME, "passed");
2782 dts_fail(API_NAME, "failed");
2785 ret = account_destroy(account);
2787 if ( ret != ACCOUNT_ERROR_NONE ) {
2788 dts_fail(API_NAME, "failed");
2791 ret = account_disconnect();
2793 if ( ret != ACCOUNT_ERROR_NONE ) {
2794 dts_fail(API_NAME, "failed");
2798 static void utc_account_get_sync_support_negative(void)
2800 const char *API_NAME = __FUNCTION__;
2802 int account_id = -1;
2803 int ret = ACCOUNT_ERROR_NONE;
2804 ret = account_connect();
2806 if ( ret != ACCOUNT_ERROR_NONE ) {
2807 dts_fail(API_NAME, "failed");
2810 ret = account_create(&account);
2812 if ( ret != ACCOUNT_ERROR_NONE ) {
2813 dts_fail(API_NAME, "failed");
2816 ret = account_query_account_by_account_id(1, &account);
2818 if ( ret != ACCOUNT_ERROR_NONE ) {
2819 dts_fail(API_NAME, "failed");
2822 ret = account_get_sync_support(account, NULL);
2824 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2825 dts_pass(API_NAME, "passed");
2827 dts_fail(API_NAME, "failed");
2830 ret = account_destroy(account);
2832 if ( ret != ACCOUNT_ERROR_NONE ) {
2833 dts_fail(API_NAME, "failed");
2836 ret = account_disconnect();
2838 if ( ret != ACCOUNT_ERROR_NONE ) {
2839 dts_fail(API_NAME, "failed");
2843 static void utc_account_get_user_text_positive(void)
2845 const char *API_NAME = __FUNCTION__;
2848 int account_id = -1;
2849 int ret = ACCOUNT_ERROR_NONE;
2850 ret = account_connect();
2852 if ( ret != ACCOUNT_ERROR_NONE ) {
2853 dts_fail(API_NAME, "failed");
2856 ret = account_create(&account);
2858 if ( ret != ACCOUNT_ERROR_NONE ) {
2859 dts_fail(API_NAME, "failed");
2862 ret = account_query_account_by_account_id(1, &account);
2864 if ( ret != ACCOUNT_ERROR_NONE ) {
2865 dts_fail(API_NAME, "failed");
2868 for (i = 0; i < 5; i++) {
2869 ret = account_get_user_text(account, i, &user_text);
2870 _account_free_text(user_text);
2873 if ( ret == ACCOUNT_ERROR_NONE ) {
2874 dts_pass(API_NAME, "passed");
2876 dts_fail(API_NAME, "failed");
2879 ret = account_destroy(account);
2881 if ( ret != ACCOUNT_ERROR_NONE ) {
2882 dts_fail(API_NAME, "failed");
2885 ret = account_disconnect();
2887 if ( ret != ACCOUNT_ERROR_NONE ) {
2888 dts_fail(API_NAME, "failed");
2892 static void utc_account_get_user_text_negative(void)
2894 const char *API_NAME = __FUNCTION__;
2896 int account_id = -1;
2897 int ret = ACCOUNT_ERROR_NONE;
2898 ret = account_connect();
2900 if ( ret != ACCOUNT_ERROR_NONE ) {
2901 dts_fail(API_NAME, "failed");
2904 ret = account_create(&account);
2906 if ( ret != ACCOUNT_ERROR_NONE ) {
2907 dts_fail(API_NAME, "failed");
2910 ret = account_query_account_by_account_id(1, &account);
2912 if ( ret != ACCOUNT_ERROR_NONE ) {
2913 dts_fail(API_NAME, "failed");
2916 for (i = 0; i < 5; i++)
2917 ret = account_get_user_text(account, i, NULL);
2919 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
2920 dts_pass(API_NAME, "passed");
2922 dts_fail(API_NAME, "failed");
2925 ret = account_destroy(account);
2927 if ( ret != ACCOUNT_ERROR_NONE ) {
2928 dts_fail(API_NAME, "failed");
2931 ret = account_disconnect();
2933 if ( ret != ACCOUNT_ERROR_NONE ) {
2934 dts_fail(API_NAME, "failed");
2938 static void utc_account_get_user_int_positive(void)
2940 const char *API_NAME = __FUNCTION__;
2943 int account_id = -1;
2944 int ret = ACCOUNT_ERROR_NONE;
2945 ret = account_connect();
2947 if ( ret != ACCOUNT_ERROR_NONE ) {
2948 dts_fail(API_NAME, "failed");
2951 ret = account_create(&account);
2953 if ( ret != ACCOUNT_ERROR_NONE ) {
2954 dts_fail(API_NAME, "failed");
2957 ret = account_query_account_by_account_id(1, &account);
2959 if ( ret != ACCOUNT_ERROR_NONE ) {
2960 dts_fail(API_NAME, "failed");
2963 for (i = 0; i < 5; i++)
2964 ret = account_get_user_int(account, i, &user_int);
2966 if ( ret == ACCOUNT_ERROR_NONE ) {
2967 dts_pass(API_NAME, "passed");
2969 dts_fail(API_NAME, "failed");
2972 ret = account_insert_to_db(account, &account_id);
2974 if ( ret != ACCOUNT_ERROR_NONE ) {
2975 dts_fail(API_NAME, "failed");
2978 ret = account_destroy(account);
2980 if ( ret != ACCOUNT_ERROR_NONE ) {
2981 dts_fail(API_NAME, "failed");
2984 ret = account_disconnect();
2986 if ( ret != ACCOUNT_ERROR_NONE ) {
2987 dts_fail(API_NAME, "failed");
2991 static void utc_account_get_user_int_negative(void)
2993 const char *API_NAME = __FUNCTION__;
2995 int account_id = -1;
2996 int ret = ACCOUNT_ERROR_NONE;
2997 ret = account_connect();
2999 if ( ret != ACCOUNT_ERROR_NONE ) {
3000 dts_fail(API_NAME, "failed");
3003 ret = account_create(&account);
3005 if ( ret != ACCOUNT_ERROR_NONE ) {
3006 dts_fail(API_NAME, "failed");
3009 ret = account_query_account_by_account_id(1, &account);
3011 if ( ret != ACCOUNT_ERROR_NONE ) {
3012 dts_fail(API_NAME, "failed");
3015 for (i = 0; i < 5; i++)
3016 ret = account_get_user_int(NULL, i, NULL);
3018 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3019 dts_pass(API_NAME, "passed");
3021 dts_fail(API_NAME, "failed");
3024 ret = account_destroy(account);
3026 if ( ret != ACCOUNT_ERROR_NONE ) {
3027 dts_fail(API_NAME, "failed");
3030 ret = account_disconnect();
3032 if ( ret != ACCOUNT_ERROR_NONE ) {
3033 dts_fail(API_NAME, "failed");
3036 bool capability_call_back(account_capability_type_e capability_type, account_capability_state_e capability_state, void *user_data)
3041 static void utc_account_get_capability_positive(void)
3043 const char *API_NAME = __FUNCTION__;
3045 int account_id = -1;
3046 int ret = ACCOUNT_ERROR_NONE;
3047 ret = account_connect();
3049 if ( ret != ACCOUNT_ERROR_NONE ) {
3050 dts_fail(API_NAME, "failed");
3053 ret = account_create(&account);
3055 if ( ret != ACCOUNT_ERROR_NONE ) {
3056 dts_fail(API_NAME, "failed");
3059 ret = account_query_account_by_account_id(1, &account);
3061 if ( ret != ACCOUNT_ERROR_NONE ) {
3062 dts_fail(API_NAME, "failed");
3065 ret = account_get_capability(account, capability_call_back, NULL);
3067 if ( ret == ACCOUNT_ERROR_NONE ) {
3068 dts_pass(API_NAME, "passed");
3070 dts_fail(API_NAME, "failed");
3073 ret = account_destroy(account);
3075 if ( ret != ACCOUNT_ERROR_NONE ) {
3076 dts_fail(API_NAME, "failed");
3079 ret = account_disconnect();
3081 if ( ret != ACCOUNT_ERROR_NONE ) {
3082 dts_fail(API_NAME, "failed");
3086 static void utc_account_get_capability_negative(void)
3088 const char *API_NAME = __FUNCTION__;
3090 int account_id = -1;
3091 int ret = ACCOUNT_ERROR_NONE;
3092 ret = account_connect();
3094 if ( ret != ACCOUNT_ERROR_NONE ) {
3095 dts_fail(API_NAME, "failed");
3098 ret = account_create(&account);
3100 if ( ret != ACCOUNT_ERROR_NONE ) {
3101 dts_fail(API_NAME, "failed");
3104 ret = account_query_account_by_account_id(1, &account);
3106 if ( ret != ACCOUNT_ERROR_NONE ) {
3107 dts_fail(API_NAME, "failed");
3110 ret = account_get_capability(account, NULL, NULL);
3112 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3113 dts_pass(API_NAME, "passed");
3115 dts_fail(API_NAME, "failed");
3118 ret = account_destroy(account);
3120 if ( ret != ACCOUNT_ERROR_NONE ) {
3121 dts_fail(API_NAME, "failed");
3124 ret = account_disconnect();
3126 if ( ret != ACCOUNT_ERROR_NONE ) {
3127 dts_fail(API_NAME, "failed");
3131 bool account_call_back(account_h account, void *user_data)
3136 static void utc_account_foreach_account_from_db_positive(void)
3138 const char *API_NAME = __FUNCTION__;
3140 int account_id = -1;
3141 int ret = ACCOUNT_ERROR_NONE;
3142 ret = account_connect();
3144 if ( ret != ACCOUNT_ERROR_NONE ) {
3145 dts_fail(API_NAME, "failed");
3148 ret = account_foreach_account_from_db(account_call_back, NULL);
3150 if ( ret == ACCOUNT_ERROR_NONE ) {
3151 dts_pass(API_NAME, "passed");
3153 dts_fail(API_NAME, "failed");
3156 ret = account_disconnect();
3158 if ( ret != ACCOUNT_ERROR_NONE ) {
3159 dts_fail(API_NAME, "failed");
3163 static void utc_account_foreach_account_from_db_negative(void)
3165 const char *API_NAME = __FUNCTION__;
3167 int account_id = -1;
3168 int ret = ACCOUNT_ERROR_NONE;
3169 ret = account_connect();
3171 if ( ret != ACCOUNT_ERROR_NONE ) {
3172 dts_fail(API_NAME, "failed");
3175 ret = account_foreach_account_from_db(NULL, NULL);
3177 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3178 dts_pass(API_NAME, "passed");
3180 dts_fail(API_NAME, "failed");
3183 ret = account_disconnect();
3185 if ( ret != ACCOUNT_ERROR_NONE ) {
3186 dts_fail(API_NAME, "failed");
3190 static void utc_account_query_account_by_account_id_positive(void)
3192 const char *API_NAME = __FUNCTION__;
3194 int account_id = -1;
3195 int ret = ACCOUNT_ERROR_NONE;
3196 ret = account_connect();
3198 if ( ret != ACCOUNT_ERROR_NONE ) {
3199 dts_fail(API_NAME, "failed");
3202 ret = account_create(&account);
3204 if ( ret != ACCOUNT_ERROR_NONE ) {
3205 dts_fail(API_NAME, "failed");
3208 ret = account_query_account_by_account_id(1, &account);
3210 if ( ret == ACCOUNT_ERROR_NONE ) {
3211 dts_pass(API_NAME, "passed");
3213 dts_fail(API_NAME, "failed");
3216 ret = account_destroy(account);
3218 if ( ret != ACCOUNT_ERROR_NONE ) {
3219 dts_fail(API_NAME, "failed");
3222 ret = account_disconnect();
3224 if ( ret != ACCOUNT_ERROR_NONE ) {
3225 dts_fail(API_NAME, "failed");
3229 static void utc_account_query_account_by_account_id_negative(void)
3231 const char *API_NAME = __FUNCTION__;
3233 int account_id = -1;
3234 int ret = ACCOUNT_ERROR_NONE;
3235 ret = account_connect();
3237 if ( ret != ACCOUNT_ERROR_NONE ) {
3238 dts_fail(API_NAME, "failed");
3241 ret = account_create(&account);
3243 if ( ret != ACCOUNT_ERROR_NONE ) {
3244 dts_fail(API_NAME, "failed");
3247 ret = account_query_account_by_account_id(-999, NULL);
3249 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3250 dts_pass(API_NAME, "passed");
3252 dts_fail(API_NAME, "failed");
3255 ret = account_destroy(account);
3257 if ( ret != ACCOUNT_ERROR_NONE ) {
3258 dts_fail(API_NAME, "failed");
3261 ret = account_disconnect();
3263 if ( ret != ACCOUNT_ERROR_NONE ) {
3264 dts_fail(API_NAME, "failed");
3268 static void utc_account_query_account_by_user_name_positive(void)
3270 const char *API_NAME = __FUNCTION__;
3272 int account_id = -1;
3273 int ret = ACCOUNT_ERROR_NONE;
3274 ret = account_connect();
3276 if ( ret != ACCOUNT_ERROR_NONE ) {
3277 dts_fail(API_NAME, "failed");
3280 ret = account_query_account_by_user_name(account_call_back, "tarun.kr", NULL);
3282 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3283 dts_pass(API_NAME, "passed");
3285 dts_fail(API_NAME, "failed");
3288 ret = account_disconnect();
3290 if ( ret != ACCOUNT_ERROR_NONE ) {
3291 dts_fail(API_NAME, "failed");
3295 static void utc_account_query_account_by_user_name_negative(void)
3297 const char *API_NAME = __FUNCTION__;
3299 int account_id = -1;
3300 int ret = ACCOUNT_ERROR_NONE;
3301 ret = account_connect();
3303 if ( ret != ACCOUNT_ERROR_NONE ) {
3304 dts_fail(API_NAME, "failed");
3307 ret = account_query_account_by_user_name(account_call_back, NULL, NULL);
3309 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3310 dts_pass(API_NAME, "passed");
3312 dts_fail(API_NAME, "failed");
3315 ret = account_disconnect();
3317 if ( ret != ACCOUNT_ERROR_NONE ) {
3318 dts_fail(API_NAME, "failed");
3322 static void utc_account_query_account_by_package_name_positive(void)
3324 const char *API_NAME = __FUNCTION__;
3326 int account_id = -1;
3327 int ret = ACCOUNT_ERROR_NONE;
3328 ret = account_connect();
3330 if ( ret != ACCOUNT_ERROR_NONE ) {
3331 dts_fail(API_NAME, "failed");
3334 ret = account_query_account_by_package_name(account_call_back, TEST_PACKAGE_NAME, NULL);
3336 if ( ret == ACCOUNT_ERROR_NONE ) {
3337 dts_pass(API_NAME, "passed");
3339 dts_fail(API_NAME, "failed");
3342 ret = account_disconnect();
3344 if ( ret != ACCOUNT_ERROR_NONE ) {
3345 dts_fail(API_NAME, "failed");
3349 static void utc_account_query_account_by_package_name_negative(void)
3351 const char *API_NAME = __FUNCTION__;
3353 int account_id = -1;
3354 int ret = ACCOUNT_ERROR_NONE;
3355 ret = account_connect();
3357 if ( ret != ACCOUNT_ERROR_NONE ) {
3358 dts_fail(API_NAME, "failed");
3361 ret = account_query_account_by_package_name(account_call_back, NULL, NULL);
3363 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3364 dts_pass(API_NAME, "passed");
3366 dts_fail(API_NAME, "failed");
3369 ret = account_disconnect();
3371 if ( ret != ACCOUNT_ERROR_NONE ) {
3372 dts_fail(API_NAME, "failed");
3376 static void utc_account_query_account_by_capability_positive(void)
3378 const char *API_NAME = __FUNCTION__;
3380 int account_id = -1;
3381 int ret = ACCOUNT_ERROR_NONE;
3382 ret = account_connect();
3384 if ( ret != ACCOUNT_ERROR_NONE ) {
3385 dts_fail(API_NAME, "failed");
3388 ret = account_query_account_by_capability(account_call_back, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED, NULL);
3390 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3391 dts_pass(API_NAME, "passed");
3393 dts_fail(API_NAME, "failed");
3396 ret = account_disconnect();
3398 if ( ret != ACCOUNT_ERROR_NONE ) {
3399 dts_fail(API_NAME, "failed");
3403 static void utc_account_query_account_by_capability_negative(void)
3405 const char *API_NAME = __FUNCTION__;
3407 int account_id = -1;
3408 int ret = ACCOUNT_ERROR_NONE;
3409 ret = account_connect();
3411 if ( ret != ACCOUNT_ERROR_NONE ) {
3412 dts_fail(API_NAME, "failed");
3415 ret = account_query_account_by_capability(account_call_back, -999, -999, NULL);
3417 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3418 dts_pass(API_NAME, "passed");
3420 dts_fail(API_NAME, "failed");
3423 ret = account_disconnect();
3425 if ( ret != ACCOUNT_ERROR_NONE ) {
3426 dts_fail(API_NAME, "failed");
3430 static void utc_account_query_capability_by_account_id_positive(void)
3432 const char *API_NAME = __FUNCTION__;
3434 int account_id = -1;
3435 int ret = ACCOUNT_ERROR_NONE;
3436 ret = account_connect();
3438 if ( ret != ACCOUNT_ERROR_NONE ) {
3439 dts_fail(API_NAME, "failed");
3442 ret = account_query_capability_by_account_id(capability_call_back, 1, NULL);
3444 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3445 dts_pass(API_NAME, "passed");
3447 dts_fail(API_NAME, "failed");
3450 ret = account_disconnect();
3452 if ( ret != ACCOUNT_ERROR_NONE ) {
3453 dts_fail(API_NAME, "failed");
3457 static void utc_account_query_capability_by_account_id_negative(void)
3459 const char *API_NAME = __FUNCTION__;
3461 int account_id = -1;
3462 int ret = ACCOUNT_ERROR_NONE;
3463 ret = account_connect();
3465 if ( ret != ACCOUNT_ERROR_NONE ) {
3466 dts_fail(API_NAME, "failed");
3469 ret = account_query_capability_by_account_id(capability_call_back, -1, NULL);
3471 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3472 dts_pass(API_NAME, "passed");
3474 dts_fail(API_NAME, "failed");
3477 ret = account_disconnect();
3479 if ( ret != ACCOUNT_ERROR_NONE ) {
3480 dts_fail(API_NAME, "failed");
3484 static void utc_account_get_total_count_from_db_positive(void)
3486 const char *API_NAME = __FUNCTION__;
3488 int account_id = -1;
3490 int ret = ACCOUNT_ERROR_NONE;
3491 ret = account_connect();
3493 if ( ret != ACCOUNT_ERROR_NONE ) {
3494 dts_fail(API_NAME, "failed");
3497 ret = account_get_total_count_from_db(&count);
3499 if ( ret == ACCOUNT_ERROR_NONE ) {
3500 dts_pass(API_NAME, "passed");
3502 dts_fail(API_NAME, "failed");
3505 ret = account_disconnect();
3507 if ( ret != ACCOUNT_ERROR_NONE ) {
3508 dts_fail(API_NAME, "failed");
3512 static void utc_account_get_total_count_from_db_negative(void)
3514 const char *API_NAME = __FUNCTION__;
3516 int account_id = -1;
3517 int ret = ACCOUNT_ERROR_NONE;
3518 ret = account_connect();
3520 if ( ret != ACCOUNT_ERROR_NONE ) {
3521 dts_fail(API_NAME, "failed");
3524 ret = account_get_total_count_from_db(NULL);
3526 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3527 dts_pass(API_NAME, "passed");
3529 dts_fail(API_NAME, "failed");
3532 ret = account_disconnect();
3534 if ( ret != ACCOUNT_ERROR_NONE ) {
3535 dts_fail(API_NAME, "failed");
3539 static void utc_account_update_sync_status_by_id_positive(void)
3541 const char *API_NAME = __FUNCTION__;
3543 int account_id = -1;
3544 int ret = ACCOUNT_ERROR_NONE;
3545 ret = account_connect();
3547 if ( ret != ACCOUNT_ERROR_NONE ) {
3548 dts_fail(API_NAME, "failed");
3551 ret = account_update_sync_status_by_id(1, ACCOUNT_SYNC_STATUS_IDLE);
3553 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3554 dts_pass(API_NAME, "passed");
3556 dts_fail(API_NAME, "failed");
3559 ret = account_disconnect();
3561 if ( ret != ACCOUNT_ERROR_NONE ) {
3562 dts_fail(API_NAME, "failed");
3566 static void utc_account_update_sync_status_by_id_negative(void)
3568 const char *API_NAME = __FUNCTION__;
3570 int account_id = -1;
3571 int ret = ACCOUNT_ERROR_NONE;
3572 ret = account_connect();
3574 if ( ret != ACCOUNT_ERROR_NONE ) {
3575 dts_fail(API_NAME, "failed");
3578 ret = account_update_sync_status_by_id(-1, ACCOUNT_SYNC_STATUS_IDLE);
3580 if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3581 dts_pass(API_NAME, "passed");
3583 dts_fail(API_NAME, "failed");
3586 ret = account_disconnect();
3588 if ( ret != ACCOUNT_ERROR_NONE ) {
3589 dts_fail(API_NAME, "failed");
3594 static void utc_account_delete_from_db_by_id_positive(void)
3596 const char *API_NAME = __FUNCTION__;
3598 int account_id = -1;
3599 int ret = ACCOUNT_ERROR_NONE;
3600 ret = account_connect();
3602 if ( ret != ACCOUNT_ERROR_NONE ) {
3603 dts_fail(API_NAME, "failed");
3606 ret = account_delete_from_db_by_id(1);
3608 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3609 dts_pass(API_NAME, "passed");
3611 dts_fail(API_NAME, "failed");
3614 ret = account_disconnect();
3616 if ( ret != ACCOUNT_ERROR_NONE ) {
3617 dts_fail(API_NAME, "failed");
3621 static void utc_account_delete_from_db_by_id_negative(void)
3623 const char *API_NAME = __FUNCTION__;
3625 int account_id = -1;
3626 int ret = ACCOUNT_ERROR_NONE;
3627 ret = account_connect();
3629 if ( ret != ACCOUNT_ERROR_NONE ) {
3630 dts_fail(API_NAME, "failed");
3633 ret = account_delete_from_db_by_id(-1);
3635 if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3636 dts_pass(API_NAME, "passed");
3638 dts_fail(API_NAME, "failed");
3641 ret = account_disconnect();
3643 if ( ret != ACCOUNT_ERROR_NONE ) {
3644 dts_fail(API_NAME, "failed");
3649 static void utc_account_delete_from_db_by_user_name_positive(void)
3651 const char *API_NAME = __FUNCTION__;
3653 int account_id = -1;
3654 int ret = ACCOUNT_ERROR_NONE;
3655 ret = account_connect();
3657 if ( ret != ACCOUNT_ERROR_NONE ) {
3658 dts_fail(API_NAME, "failed");
3661 ret = account_delete_from_db_by_user_name("tarun.kr", TEST_PACKAGE_NAME);
3663 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3664 dts_pass(API_NAME, "passed");
3666 dts_fail(API_NAME, "failed");
3669 ret = account_disconnect();
3671 if ( ret != ACCOUNT_ERROR_NONE ) {
3672 dts_fail(API_NAME, "failed");
3676 static void utc_account_delete_from_db_by_user_name_negative(void)
3678 const char *API_NAME = __FUNCTION__;
3680 int account_id = -1;
3681 int ret = ACCOUNT_ERROR_NONE;
3682 ret = account_connect();
3684 if ( ret != ACCOUNT_ERROR_NONE ) {
3685 dts_fail(API_NAME, "failed");
3688 ret = account_delete_from_db_by_user_name(NULL, TEST_PACKAGE_NAME);
3690 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3691 dts_pass(API_NAME, "passed");
3693 dts_fail(API_NAME, "failed");
3696 ret = account_disconnect();
3698 if ( ret != ACCOUNT_ERROR_NONE ) {
3699 dts_fail(API_NAME, "failed");
3703 static void utc_account_delete_from_db_by_package_name_positive(void)
3705 const char *API_NAME = __FUNCTION__;
3707 int account_id = -1;
3708 int ret = ACCOUNT_ERROR_NONE;
3709 ret = account_connect();
3711 if ( ret != ACCOUNT_ERROR_NONE ) {
3712 dts_fail(API_NAME, "failed");
3715 ret = account_delete_from_db_by_package_name(TEST_PACKAGE_NAME);
3717 if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
3718 dts_pass(API_NAME, "passed");
3720 dts_fail(API_NAME, "failed");
3723 ret = account_disconnect();
3725 if ( ret != ACCOUNT_ERROR_NONE ) {
3726 dts_fail(API_NAME, "failed");
3730 static void utc_account_delete_from_db_by_package_name_negative(void)
3732 const char *API_NAME = __FUNCTION__;
3734 int account_id = -1;
3735 int ret = ACCOUNT_ERROR_NONE;
3736 ret = account_connect();
3738 if ( ret != ACCOUNT_ERROR_NONE ) {
3739 dts_fail(API_NAME, "failed");
3742 ret = account_delete_from_db_by_package_name(NULL);
3744 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3745 dts_pass(API_NAME, "passed");
3747 dts_fail(API_NAME, "failed");
3750 ret = account_disconnect();
3752 if ( ret != ACCOUNT_ERROR_NONE ) {
3753 dts_fail(API_NAME, "failed");
3757 static void utc_account_update_to_db_by_id_positive(void)
3759 const char *API_NAME = __FUNCTION__;
3761 int account_id = -1;
3762 int ret = ACCOUNT_ERROR_NONE;
3763 ret = account_connect();
3765 if ( ret != ACCOUNT_ERROR_NONE ) {
3766 dts_fail(API_NAME, "failed");
3769 ret = account_create(&account);
3771 if ( ret != ACCOUNT_ERROR_NONE ) {
3772 dts_fail(API_NAME, "failed");
3775 ret = account_set_user_name(account, "update-tarun.kr");
3777 if ( ret != ACCOUNT_ERROR_NONE ) {
3778 dts_fail(API_NAME, "failed");
3781 ret = account_set_package_name(account, TEST_PACKAGE_NAME);
3783 if ( ret != ACCOUNT_ERROR_NONE ) {
3784 dts_fail(API_NAME, "failed");
3787 ret = account_update_to_db_by_id(account, 1);
3789 if ( ret == ACCOUNT_ERROR_NONE ) {
3790 dts_pass(API_NAME, "passed");
3792 dts_fail(API_NAME, "failed");
3795 ret = account_destroy(account);
3797 if ( ret != ACCOUNT_ERROR_NONE ) {
3798 dts_fail(API_NAME, "failed");
3801 ret = account_disconnect();
3803 if ( ret != ACCOUNT_ERROR_NONE ) {
3804 dts_fail(API_NAME, "failed");
3808 static void utc_account_update_to_db_by_id_negative(void)
3810 const char *API_NAME = __FUNCTION__;
3812 int account_id = -1;
3813 int ret = ACCOUNT_ERROR_NONE;
3814 ret = account_connect();
3816 if ( ret != ACCOUNT_ERROR_NONE ) {
3817 dts_fail(API_NAME, "failed");
3820 ret = account_create(&account);
3822 if ( ret != ACCOUNT_ERROR_NONE ) {
3823 dts_fail(API_NAME, "failed");
3826 ret = account_update_to_db_by_id(account, -1);
3828 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3829 dts_pass(API_NAME, "passed");
3831 dts_fail(API_NAME, "failed");
3834 ret = account_destroy(account);
3836 if ( ret != ACCOUNT_ERROR_NONE ) {
3837 dts_fail(API_NAME, "failed");
3840 ret = account_disconnect();
3842 if ( ret != ACCOUNT_ERROR_NONE ) {
3843 dts_fail(API_NAME, "failed");
3847 static void utc_account_update_to_db_by_user_name_positive(void)
3849 const char *API_NAME = __FUNCTION__;
3851 int account_id = -1;
3852 int ret = ACCOUNT_ERROR_NONE;
3853 ret = account_connect();
3855 if ( ret != ACCOUNT_ERROR_NONE ) {
3856 dts_fail(API_NAME, "failed");
3859 ret = account_create(&account);
3861 if ( ret != ACCOUNT_ERROR_NONE ) {
3862 dts_fail(API_NAME, "failed");
3865 ret = account_set_user_name(account, "update-tarun.kr");
3867 if ( ret != ACCOUNT_ERROR_NONE ) {
3868 dts_fail(API_NAME, "failed");
3871 ret = account_set_package_name(account, TEST_PACKAGE_NAME);
3873 if ( ret != ACCOUNT_ERROR_NONE ) {
3874 dts_fail(API_NAME, "failed");
3877 ret = account_update_to_db_by_user_name(account, "tarun.kr", TEST_PACKAGE_NAME);
3879 if ( ret == ACCOUNT_ERROR_NONE ) {
3880 dts_pass(API_NAME, "passed");
3882 dts_fail(API_NAME, "failed");
3885 ret = account_destroy(account);
3887 if ( ret != ACCOUNT_ERROR_NONE ) {
3888 dts_fail(API_NAME, "failed");
3891 ret = account_disconnect();
3893 if ( ret != ACCOUNT_ERROR_NONE ) {
3894 dts_fail(API_NAME, "failed");
3898 static void utc_account_update_to_db_by_user_name_negative(void)
3900 const char *API_NAME = __FUNCTION__;
3902 int account_id = -1;
3903 int ret = ACCOUNT_ERROR_NONE;
3904 ret = account_connect();
3906 if ( ret != ACCOUNT_ERROR_NONE ) {
3907 dts_fail(API_NAME, "failed");
3910 ret = account_create(&account);
3912 if ( ret != ACCOUNT_ERROR_NONE ) {
3913 dts_fail(API_NAME, "failed");
3916 ret = account_update_to_db_by_user_name(account, NULL, TEST_PACKAGE_NAME);
3918 if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
3919 dts_pass(API_NAME, "passed");
3921 dts_fail(API_NAME, "failed");
3924 ret = account_destroy(account);
3926 if ( ret != ACCOUNT_ERROR_NONE ) {
3927 dts_fail(API_NAME, "failed");
3930 ret = account_disconnect();
3932 if ( ret != ACCOUNT_ERROR_NONE ) {
3933 dts_fail(API_NAME, "failed");
3937 // END of example for libaccounts-svc API unit test