[UTC][libaccount-service][ACR-1457][Unit Test Cases for deleted account info API] 99/214499/3
authorAbhishek Vijay <abhishek.v@samsung.com>
Mon, 23 Sep 2019 09:21:57 +0000 (14:51 +0530)
committerAbhishek Vijay <abhishek.v@samsung.com>
Mon, 23 Sep 2019 09:35:36 +0000 (09:35 +0000)
Change-Id: Ic052f3c7c8a9e30a6df5a6b43ba096762537a9cb
Signed-off-by: Abhishek Vijay <abhishek.v@samsung.com>
src/utc/accounts-svc/public.list
src/utc/accounts-svc/tct-accounts-svc-core_mobile.h
src/utc/accounts-svc/tct-accounts-svc-core_tizeniot.h
src/utc/accounts-svc/tct-accounts-svc-core_wearable.h
src/utc/accounts-svc/utc-accounts-svc.c

index 90c21f3be65924bb90062bab2d8e501c8b42c0b6..868cc9983a0a6c0ed194d7e4f97652a0699e7e9d 100755 (executable)
@@ -28,6 +28,7 @@ account_get_user_name
 account_get_user_text
 account_insert_to_db
 account_query_account_by_account_id
+account_query_deleted_account_info_by_account_id
 account_query_account_by_capability
 account_query_account_by_capability_type
 account_query_account_by_package_name
index c0dceaa4b20cb14c7497543c068c96f529dbb52f..9c6c480be377948e76981d8931206340983fce94 100755 (executable)
@@ -101,6 +101,8 @@ extern int utc_account_foreach_account_from_db_p(void);
 extern int utc_account_foreach_account_from_db_n(void);
 extern int utc_account_query_account_by_account_id_p(void);
 extern int utc_account_query_account_by_account_id_n(void);
+extern int utc_account_query_deleted_account_info_by_account_id_p(void);
+extern int utc_account_query_deleted_account_info_by_account_id_n(void);
 extern int utc_account_query_account_by_user_name_p(void);
 extern int utc_account_query_account_by_user_name_n(void);
 extern int utc_account_query_account_by_package_name_p(void);
@@ -250,6 +252,8 @@ testcase tc_array[] = {
        {"utc_account_foreach_account_from_db_n",utc_account_foreach_account_from_db_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_account_id_p",utc_account_query_account_by_account_id_p,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_account_id_n",utc_account_query_account_by_account_id_n,utc_account_startup,utc_account_cleanup},
+       {"utc_account_query_deleted_account_info_by_account_id_p",utc_account_query_deleted_account_info_by_account_id_p,utc_account_startup,utc_account_cleanup},
+       {"utc_account_query_deleted_account_info_by_account_id_n",utc_account_query_deleted_account_info_by_account_id_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_user_name_p",utc_account_query_account_by_user_name_p,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_user_name_n",utc_account_query_account_by_user_name_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_package_name_p",utc_account_query_account_by_package_name_p,utc_account_startup,utc_account_cleanup},
index c9172bbe3fe3d9b988a17230391745073cc40ed9..4927efcaa1c62d99c2a4a6c387bca535da75d4e4 100755 (executable)
@@ -98,6 +98,8 @@ extern int utc_account_foreach_account_from_db_p(void);
 extern int utc_account_foreach_account_from_db_n(void);
 extern int utc_account_query_account_by_account_id_p(void);
 extern int utc_account_query_account_by_account_id_n(void);
+extern int utc_account_query_deleted_account_info_by_account_id_p(void);
+extern int utc_account_query_deleted_account_info_by_account_id_n(void);
 extern int utc_account_query_account_by_user_name_p(void);
 extern int utc_account_query_account_by_user_name_n(void);
 extern int utc_account_query_account_by_package_name_p(void);
@@ -244,6 +246,8 @@ testcase tc_array[] = {
        {"utc_account_foreach_account_from_db_n",utc_account_foreach_account_from_db_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_account_id_p",utc_account_query_account_by_account_id_p,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_account_id_n",utc_account_query_account_by_account_id_n,utc_account_startup,utc_account_cleanup},
+       {"utc_account_query_deleted_account_info_by_account_id_p",utc_account_query_deleted_account_info_by_account_id_p,utc_account_startup,utc_account_cleanup},
+       {"utc_account_query_deleted_account_info_by_account_id_n",utc_account_query_deleted_account_info_by_account_id_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_user_name_p",utc_account_query_account_by_user_name_p,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_user_name_n",utc_account_query_account_by_user_name_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_package_name_p",utc_account_query_account_by_package_name_p,utc_account_startup,utc_account_cleanup},
index c9172bbe3fe3d9b988a17230391745073cc40ed9..4927efcaa1c62d99c2a4a6c387bca535da75d4e4 100755 (executable)
@@ -98,6 +98,8 @@ extern int utc_account_foreach_account_from_db_p(void);
 extern int utc_account_foreach_account_from_db_n(void);
 extern int utc_account_query_account_by_account_id_p(void);
 extern int utc_account_query_account_by_account_id_n(void);
+extern int utc_account_query_deleted_account_info_by_account_id_p(void);
+extern int utc_account_query_deleted_account_info_by_account_id_n(void);
 extern int utc_account_query_account_by_user_name_p(void);
 extern int utc_account_query_account_by_user_name_n(void);
 extern int utc_account_query_account_by_package_name_p(void);
@@ -244,6 +246,8 @@ testcase tc_array[] = {
        {"utc_account_foreach_account_from_db_n",utc_account_foreach_account_from_db_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_account_id_p",utc_account_query_account_by_account_id_p,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_account_id_n",utc_account_query_account_by_account_id_n,utc_account_startup,utc_account_cleanup},
+       {"utc_account_query_deleted_account_info_by_account_id_p",utc_account_query_deleted_account_info_by_account_id_p,utc_account_startup,utc_account_cleanup},
+       {"utc_account_query_deleted_account_info_by_account_id_n",utc_account_query_deleted_account_info_by_account_id_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_user_name_p",utc_account_query_account_by_user_name_p,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_user_name_n",utc_account_query_account_by_user_name_n,utc_account_startup,utc_account_cleanup},
        {"utc_account_query_account_by_package_name_p",utc_account_query_account_by_package_name_p,utc_account_startup,utc_account_cleanup},
index 868bc2c95d7b122f1cdc467f3a5c000268cf0365..01794d8134771d752da4d86d189bf3da2b2a379f 100755 (executable)
@@ -2879,6 +2879,143 @@ int utc_account_query_account_by_account_id_n(void)
        return 0;
 }
 
+/**
+ * @testcase           utc_account_query_deleted_account_info_by_account_id_p
+ * @since_tizen                5.5
+ * @description                Positive test case of account_query_deleted_account_info_by_account_id()
+ */
+int utc_account_query_deleted_account_info_by_account_id_p(void)
+{
+       assert(created);
+       int ret = ACCOUNT_ERROR_NONE;
+       int account_id = -1;
+       account_h ret_account = NULL;
+       account_h del_account = NULL;
+       char* ret_user_name = NULL;
+       char* del_user_name = NULL;
+       char* ret_package_name = NULL;
+       char* del_package_name = NULL;
+
+       account_capability_state_e ret_capability_type = 0;
+       account_capability_state_e del_capability_type = 0;
+
+       ret = account_set_user_name(account, user_name);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_set_package_name(account, package_name);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_set_capability(account, contact_capability, ACCOUNT_CAPABILITY_ENABLED);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* insert account */
+       ret = account_insert_to_db(account, &account_id);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* get inserted account handle */
+       ret = account_create(&ret_account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_query_account_by_account_id(account_id, &ret_account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* delete account */
+       ret = account_delete_from_db_by_id(account_id);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* get deleted account handle */
+       ret = account_create(&del_account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_query_deleted_account_info_by_account_id(account_id, &del_account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* get user-names of both inserted & deleted account handles */
+       ret = account_get_user_name(ret_account, &ret_user_name);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_get_user_name(del_account, &del_user_name);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* get package-names of both inserted & deleted account handles */
+       ret = account_get_package_name(ret_account, &ret_package_name);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_get_package_name(del_account, &del_package_name);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* get capabilities */
+       ret = account_get_capability(ret_account, contact_capability, &ret_capability_type);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_get_capability(del_account, contact_capability, &del_capability_type);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       /* compare inserted info with original info */
+       assert_eq(strcmp(ret_user_name, user_name), 0);
+       assert_eq(strcmp(ret_package_name, package_name), 0);
+       assert_eq(ret_capability_type, ACCOUNT_CAPABILITY_ENABLED);
+
+       /* compare deleted info with inserted info */
+       assert_eq(strcmp(ret_user_name, del_user_name), 0);
+       assert_eq(strcmp(ret_package_name, del_package_name), 0);
+       assert_eq(del_capability_type, ACCOUNT_CAPABILITY_ENABLED);
+
+       _account_free_text(ret_user_name);
+       _account_free_text(ret_package_name);
+
+       _account_free_text(del_user_name);
+       _account_free_text(del_package_name);
+
+       ret = account_destroy(ret_account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       ret = account_destroy(del_account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_NONE);}
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_account_query_deleted_account_info_by_account_id_n
+ * @since_tizen                5.5
+ * @description                Negative test case of account_query_deleted_account_info_by_account_id()
+ */
+int utc_account_query_deleted_account_info_by_account_id_n(void)
+{
+       assert(created);
+       int ret = ACCOUNT_ERROR_NONE;
+       int account_id = -1;
+       account_h ret_account = NULL;
+
+       ret = account_query_deleted_account_info_by_account_id(10000, NULL);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);}
+
+       ret = account_query_deleted_account_info_by_account_id(-9999, &account);
+       if(!is_account_supported){assert_eq(ret, ACCOUNT_ERROR_NOT_SUPPORTED);}
+       else{assert_eq(ret, ACCOUNT_ERROR_INVALID_PARAMETER);}
+
+       return 0;
+}
+
 /**
  * @testcase           utc_account_query_account_by_user_name_p
  * @since_tizen                2.3