diff options
author | Lokesh <l.kasana@samsung.com> | 2019-06-12 11:55:22 +0530 |
---|---|---|
committer | saerome kim <saerome.kim@samsung.com> | 2019-07-01 11:10:07 +0900 |
commit | 7de71b57fef0eb6ac6ea68d8ae33223572f64272 (patch) | |
tree | 205678625d1cf530ab90ad4ec1937ced7334c1f5 | |
parent | 3e5dee552b0224392aef824188282bc5ddd56c31 (diff) | |
download | user-awareness-7de71b57fef0eb6ac6ea68d8ae33223572f64272.tar.gz user-awareness-7de71b57fef0eb6ac6ea68d8ae33223572f64272.tar.bz2 user-awareness-7de71b57fef0eb6ac6ea68d8ae33223572f64272.zip |
UAT test case for Add/Remove of User/Device in Service and for ua_user_get_handle_by_account
Change-Id: Iee1468085a3ee8d28a42d9ec45d3aee561f39555
Signed-off-by: Lokesh <l.kasana@samsung.com>
-rw-r--r-- | test/uat-devices.c | 53 | ||||
-rw-r--r-- | test/uat-users.c | 83 |
2 files changed, 136 insertions, 0 deletions
diff --git a/test/uat-devices.c b/test/uat-devices.c index a2637bf..d6c3b2d 100644 --- a/test/uat-devices.c +++ b/test/uat-devices.c @@ -47,6 +47,8 @@ static char id_mobile_id[MENU_DATA_SIZE + 1] = {0,}; static char id_user[MENU_DATA_SIZE + 1] = {0,}; static char id_mobile_mac_type[MENU_DATA_SIZE + 1] = {0,}; +static char service[MENU_DATA_SIZE + 1] = {0,}; + static GSList *dev_list = NULL; /**< Device List */ static int device_count = 0; /**< Found device count */ @@ -620,6 +622,52 @@ static struct menu_data menu_ua_devlist_by_user[] = { { NULL, NULL, }, }; +static int run_ua_service_add_device( + MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("ua_service_add_device"); + + ret = ua_service_add_device(service, device); + + msg(" - ua_service_add_device() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} + +static int run_ua_service_remove_device( + MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("ua_service_remove_device"); + + ret = ua_service_remove_device(service, device); + + msg(" - ua_service_remove_device() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} + +static struct menu_data menu_ua_service_add_device[] = { + { "1", "service (e.g. 'ua.service.testing')", + NULL, NULL, service }, + { "2", "run", NULL, + run_ua_service_add_device, NULL }, + { NULL, NULL, }, +}; + +static struct menu_data menu_ua_service_remove_device[] = { + { "1", "service (e.g. 'ua.service.testing')", + NULL, NULL, service }, + { "2", "run", NULL, + run_ua_service_remove_device, NULL }, + { NULL, NULL, }, +}; + struct menu_data menu_ua_devices[] = { { "1", "ua_device_create", NULL, run_ua_device_create, NULL }, @@ -649,6 +697,11 @@ struct menu_data menu_ua_devices[] = { NULL, run_ua_foreach_all_registered_dev_info, NULL }, { "14", "ua_foreach_registered_dev_info_by_user", menu_ua_devlist_by_user, NULL, NULL }, + { "15", "ua_service_add_device", + menu_ua_service_add_device, NULL, NULL }, + { "16", "ua_service_remove_device", + menu_ua_service_remove_device, NULL, NULL }, + { NULL, NULL, }, }; diff --git a/test/uat-users.c b/test/uat-users.c index 47dd3b8..1e0c7e6 100644 --- a/test/uat-users.c +++ b/test/uat-users.c @@ -32,6 +32,9 @@ ua_user_h user = NULL; char user_account[MENU_DATA_SIZE + 1] = {0}; char user_name[MENU_DATA_SIZE + 1] = {0}; +static char account_string[MENU_DATA_SIZE + 1] = {0}; +static char service[MENU_DATA_SIZE + 1] = {0}; + GSList *user_list = NULL; /**< User List */ static int idx_user = 0; /**< Found device sequence number */ @@ -276,6 +279,80 @@ static struct menu_data menu_ua_user_name[] = { { NULL, NULL, }, }; +static int run_ua_user_get_handle_by_account(MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + ua_user_h user_handle; + + msg("ua_user_get_handle_by_account"); + + ret = ua_user_get_handle_by_account(account_string, &user_handle); + + msg(" - ua_user_get_handle_by_account() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + if (UA_ERROR_NONE == ret) { + msgb("User Handle [%p]", user_handle); +// TODO: is needed? destroy user, set user, update_user_info() + ua_user_destroy(user); + user = user_handle; + update_user_info(); + } + return RET_SUCCESS; +} + +static struct menu_data menu_ua_user_get_handle_by_account[] = { + { "1", "account", + NULL, NULL, account_string}, + { "2", "run", NULL, + run_ua_user_get_handle_by_account, NULL }, + { NULL, NULL, }, +}; + +static int run_ua_service_add_user(MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("ua_service_add_user"); + + ret = ua_service_add_user(service, user); + + msg(" - ua_service_add_user() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} + +static int run_ua_service_remove_user(MManager *mm, struct menu_data *menu) +{ + int ret = UA_ERROR_NONE; + + msg("ua_service_remove_user"); + + ret = ua_service_remove_user(service, user); + + msg(" - ua_service_remove_user() ret: [0x%X] [%s]", + ret, uat_get_error_str(ret)); + + return RET_SUCCESS; +} + +static struct menu_data menu_ua_service_add_user[] = { + { "1", "service (e.g. 'ua.service.testing'", + NULL, NULL, service}, + { "2", "run", NULL, + run_ua_service_add_user, NULL }, + { NULL, NULL, }, +}; + +static struct menu_data menu_ua_service_remove_user[] = { + { "1", "service (e.g. 'ua.service.testing'", + NULL, NULL, service}, + { "2", "run", NULL, + run_ua_service_remove_user, NULL }, + { NULL, NULL, }, +}; + struct menu_data menu_ua_users[] = { { "1", "ua_user_get_default_user", NULL, run_ua_get_default_user, NULL }, @@ -293,6 +370,12 @@ struct menu_data menu_ua_users[] = { NULL, run_ua_user_remove, NULL}, { "8", "ua_user_foreach_registered_users", NULL, run_ua_foreach_registered_users, NULL }, + { "9", "ua_user_get_handle_by_account", + menu_ua_user_get_handle_by_account, NULL, NULL }, + { "10", "ua_service_add_user", + menu_ua_service_add_user, NULL, NULL }, + { "11", "ua_service_remove_user", + menu_ua_service_remove_user, NULL, NULL }, { NULL, NULL, }, }; |