@ -73,20 +73,22 @@ function openim::test::auth() {
# Define a function to get a token for a specific user
# Define a function to get a token for a specific user
openim::test::get_token( ) {
openim::test::get_token( ) {
local user_id = " ${ 1 :- openIM123456 } " # Default user ID if not provided
local user_id = " ${ 1 :- openIM123456 } " # Default user ID if not provided
token_response = $( ${ CCURL } " ${ OperationID } " " ${ Header } " ${ INSECURE_OPENIMAPI } /auth/user_token \
token_response = $(
-d'{"secret": "' " $SECRET " '","platformID": 1,"userID": "' $user_id '"}' )
${ CCURL } " ${ OperationID } " " ${ Header } " ${ INSECURE_OPENIMAPI } /auth/user_token \
-d'{"secret": "' " $SECRET " '","platformID": 1,"userID": "' $user_id '"}'
)
token = $( echo $token_response | grep -Po 'token[" :]+\K[^"]+' )
token = $( echo $token_response | grep -Po 'token[" :]+\K[^"]+' )
echo " $token "
echo " $token "
}
}
Header = "-HContent-Type: application/json"
Header = "-HContent-Type: application/json"
OperationID = "-HoperationID: 1646445464564"
OperationID = "-HoperationID: 1646445464564"
Token = " -Htoken: $( openim::test::get_token) "
Token = " -Htoken: $( openim::test::get_token) "
# Forces a user to log out from the specified platform by user ID.
# Forces a user to log out from the specified platform by user ID.
openim::test::force_logout( ) {
openim::test::force_logout( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"platformID" : 2,
"platformID" : 2,
"userID" : "4950983283"
"userID" : "4950983283"
@ -100,7 +102,6 @@ local response=$(${CCURL} "${Token}" "${OperationID}" "${Header}" "${INSECURE_OP
openim::test::check_error " $response "
openim::test::check_error " $response "
}
}
#################################### User Module ####################################
#################################### User Module ####################################
# Registers a new user with provided user ID, nickname, and face URL using the API.
# Registers a new user with provided user ID, nickname, and face URL using the API.
@ -111,7 +112,8 @@ local nickname="${2:-cubxxw}"
local face_url = " ${ 3 :- https : //github.com/cubxxw } "
local face_url = " ${ 3 :- https : //github.com/cubxxw } "
# Create the request body using the provided or default values
# Create the request body using the provided or default values
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"secret" : " ${ SECRET } " ,
"secret" : " ${ SECRET } " ,
"users" : [
"users" : [
@ -136,7 +138,8 @@ openim::test::check_error "$user_register_response"
# Checks if the provided list of user IDs exist in the system.
# Checks if the provided list of user IDs exist in the system.
openim::test::check_user_account( ) {
openim::test::check_user_account( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"checkUserIDs" : [
"checkUserIDs" : [
" ${ 1 } " ,
" ${ 1 } " ,
@ -156,7 +159,8 @@ openim::test::check_error "$response"
# Retrieves a list of users with pagination, limited to a specific number per page.
# Retrieves a list of users with pagination, limited to a specific number per page.
openim::test::get_users( ) {
openim::test::get_users( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"pagination" : {
"pagination" : {
"pageNumber" : 1,
"pageNumber" : 1,
@ -174,7 +178,8 @@ openim::test::check_error "$response"
# Obtains detailed information for a list of user IDs.
# Obtains detailed information for a list of user IDs.
openim::test::get_users_info( ) {
openim::test::get_users_info( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userIDs" : [
"userIDs" : [
" ${ 1 } " ,
" ${ 1 } " ,
@ -192,7 +197,8 @@ openim::test::check_error "$response"
# Retrieves the online status for a list of user IDs.
# Retrieves the online status for a list of user IDs.
openim::test::get_users_online_status( ) {
openim::test::get_users_online_status( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userIDs" : [
"userIDs" : [
" ${ TEST_USER_ID } " ,
" ${ TEST_USER_ID } " ,
@ -212,7 +218,8 @@ openim::test::check_error "$response"
# Updates the information for a user, such as nickname and face URL.
# Updates the information for a user, such as nickname and face URL.
openim::test::update_user_info( ) {
openim::test::update_user_info( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userInfo" : {
"userInfo" : {
"userID" : " ${ TEST_USER_ID } " ,
"userID" : " ${ TEST_USER_ID } " ,
@ -231,7 +238,8 @@ openim::test::check_error "$response"
# Gets the online status for users that a particular user has subscribed to.
# Gets the online status for users that a particular user has subscribed to.
openim::test::get_subscribe_users_status( ) {
openim::test::get_subscribe_users_status( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ TEST_USER_ID } "
"userID" : " ${ TEST_USER_ID } "
}
}
@ -246,7 +254,8 @@ openim::test::check_error "$response"
# Subscribes to the online status of a list of users for a particular user ID.
# Subscribes to the online status of a list of users for a particular user ID.
openim::test::subscribe_users_status( ) {
openim::test::subscribe_users_status( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : "9168684795" ,
"userID" : "9168684795" ,
"userIDs" : [
"userIDs" : [
@ -267,7 +276,8 @@ openim::test::check_error "$response"
# Sets the global message receiving option for a user, determining their messaging preferences.
# Sets the global message receiving option for a user, determining their messaging preferences.
openim::test::set_global_msg_recv_opt( ) {
openim::test::set_global_msg_recv_opt( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ TEST_USER_ID } " ,
"userID" : " ${ TEST_USER_ID } " ,
"globalRecvMsgOpt" : 0
"globalRecvMsgOpt" : 0
@ -322,7 +332,8 @@ openim::log::success "User test suite completed successfully."
# Checks if two users are friends.
# Checks if two users are friends.
openim::test::is_friend( ) {
openim::test::is_friend( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID1" : " ${ 1 } " ,
"userID1" : " ${ 1 } " ,
"userID2" : " ${ 2 } "
"userID2" : " ${ 2 } "
@ -338,7 +349,8 @@ openim::test::check_error "$response"
# Deletes a friend for a user.
# Deletes a friend for a user.
openim::test::delete_friend( ) {
openim::test::delete_friend( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"ownerUserID" :" ${ 1 } " ,
"ownerUserID" :" ${ 1 } " ,
"friendUserID" :" ${ 2 } "
"friendUserID" :" ${ 2 } "
@ -354,7 +366,8 @@ openim::test::check_error "$response"
# Gets the friend application list for a user.
# Gets the friend application list for a user.
openim::test::get_friend_apply_list( ) {
openim::test::get_friend_apply_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ MANAGER_USERID_1 } " ,
"userID" : " ${ MANAGER_USERID_1 } " ,
"pagination" : {
"pagination" : {
@ -373,7 +386,8 @@ openim::test::check_error "$response"
# Gets the friend list for a user.
# Gets the friend list for a user.
openim::test::get_friend_list( ) {
openim::test::get_friend_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ 1 } " ,
"userID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -392,7 +406,8 @@ openim::test::check_error "$response"
# Sets a remark for a friend.
# Sets a remark for a friend.
openim::test::set_friend_remark( ) {
openim::test::set_friend_remark( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"ownerUserID" : " ${ 1 } " ,
"ownerUserID" : " ${ 1 } " ,
"friendUserID" : " ${ 2 } " ,
"friendUserID" : " ${ 2 } " ,
@ -409,7 +424,8 @@ openim::test::check_error "$response"
# Adds a friend request.
# Adds a friend request.
openim::test::add_friend( ) {
openim::test::add_friend( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"fromUserID" : " ${ 1 } " ,
"fromUserID" : " ${ 1 } " ,
"toUserID" : " ${ 2 } " ,
"toUserID" : " ${ 2 } " ,
@ -429,7 +445,8 @@ openim::test::check_error "$response"
openim::test::import_friend( ) {
openim::test::import_friend( ) {
local friend_ids = $( printf ', "%s"' " ${ @ : 2 } " )
local friend_ids = $( printf ', "%s"' " ${ @ : 2 } " )
friend_ids = ${ friend_ids : 2 }
friend_ids = ${ friend_ids : 2 }
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"ownerUserID" : " ${ 1 } " ,
"ownerUserID" : " ${ 1 } " ,
"friendUserIDs" : [ ${ friend_ids } ]
"friendUserIDs" : [ ${ friend_ids } ]
@ -443,10 +460,10 @@ local response=$(${CCURL} "${Token}" "${OperationID}" "${Header}" "${INSECURE_OP
openim::test::check_error " $response "
openim::test::check_error " $response "
}
}
# Responds to a friend request.
# Responds to a friend request.
openim::test::add_friend_response( ) {
openim::test::add_friend_response( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"fromUserID" : " ${ 1 } " ,
"fromUserID" : " ${ 1 } " ,
"toUserID" : " ${ 2 } " ,
"toUserID" : " ${ 2 } " ,
@ -464,7 +481,8 @@ openim::test::check_error "$response"
# Retrieves the friend application list that the user has applied for.
# Retrieves the friend application list that the user has applied for.
openim::test::get_self_friend_apply_list( ) {
openim::test::get_self_friend_apply_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ 1 } " ,
"userID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -483,7 +501,8 @@ openim::test::check_error "$response"
# Adds a user to the blacklist.
# Adds a user to the blacklist.
openim::test::add_black( ) {
openim::test::add_black( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"ownerUserID" : " ${ 1 } " ,
"ownerUserID" : " ${ 1 } " ,
"blackUserID" : " ${ 2 } "
"blackUserID" : " ${ 2 } "
@ -499,7 +518,8 @@ openim::test::check_error "$response"
# Removes a user from the blacklist.
# Removes a user from the blacklist.
openim::test::remove_black( ) {
openim::test::remove_black( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"ownerUserID" : " ${ 1 } " ,
"ownerUserID" : " ${ 1 } " ,
"blackUserID" : " ${ 2 } "
"blackUserID" : " ${ 2 } "
@ -515,7 +535,8 @@ openim::test::check_error "$response"
# Retrieves the blacklist for a user.
# Retrieves the blacklist for a user.
openim::test::get_black_list( ) {
openim::test::get_black_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ 1 } " ,
"userID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -544,9 +565,13 @@ local friendUserIDsArray=()
for friendUserID in " $@ " ; do
for friendUserID in " $@ " ; do
friendUserIDsArray += ( " \" ${ friendUserID } \" " )
friendUserIDsArray += ( " \" ${ friendUserID } \" " )
done
done
local friendUserIDs = $( IFS = ,; echo " ${ friendUserIDsArray [*] } " )
local friendUserIDs = $(
IFS = ,
echo " ${ friendUserIDsArray [*] } "
)
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"ownerUserID" : " ${ ownerUserID } " ,
"ownerUserID" : " ${ ownerUserID } " ,
"friendUserIDs" : [ ${ friendUserIDs } ] ,
"friendUserIDs" : [ ${ friendUserIDs } ] ,
@ -561,7 +586,6 @@ echo "Response: $response"
openim::test::check_error " $response "
openim::test::check_error " $response "
}
}
# [openim::test::friend function description]
# [openim::test::friend function description]
# The `openim::test::friend` function serves as a test suite for friend-related operations.
# The `openim::test::friend` function serves as a test suite for friend-related operations.
# It sequentially invokes all friend-related test functions to ensure the API's friend operations are functioning correctly.
# It sequentially invokes all friend-related test functions to ensure the API's friend operations are functioning correctly.
@ -631,12 +655,12 @@ openim::test::get_black_list "${TEST_USER_ID}"
openim::log::success "Friend test suite completed successfully."
openim::log::success "Friend test suite completed successfully."
}
}
#################################### Group Module ####################################
#################################### Group Module ####################################
# Creates a new group.
# Creates a new group.
openim::test::create_group( ) {
openim::test::create_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"memberUserIDs" : [
"memberUserIDs" : [
" ${ 1 } "
" ${ 1 } "
@ -669,7 +693,8 @@ openim::test::check_error "$response"
# Invites a user to join a group.
# Invites a user to join a group.
openim::test::invite_user_to_group( ) {
openim::test::invite_user_to_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"invitedUserIDs" : [
"invitedUserIDs" : [
@ -689,7 +714,8 @@ openim::test::check_error "$response"
# Transfers the ownership of a group to another user.
# Transfers the ownership of a group to another user.
openim::test::transfer_group( ) {
openim::test::transfer_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" :" ${ 1 } " ,
"groupID" :" ${ 1 } " ,
"oldOwnerUserID" :" ${ 2 } " ,
"oldOwnerUserID" :" ${ 2 } " ,
@ -706,7 +732,8 @@ openim::test::check_error "$response"
# Retrieves information about multiple groups.
# Retrieves information about multiple groups.
openim::test::get_groups_info( ) {
openim::test::get_groups_info( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupIDs" : [ " ${ 1 } " , " ${ 2 } " ]
"groupIDs" : [ " ${ 1 } " , " ${ 2 } " ]
}
}
@ -721,7 +748,8 @@ openim::test::check_error "$response"
# Removes a user from a group.
# Removes a user from a group.
openim::test::kick_group( ) {
openim::test::kick_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"kickedUserIDs" : [
"kickedUserIDs" : [
@ -740,7 +768,8 @@ openim::test::check_error "$response"
# Retrieves information about group members.
# Retrieves information about group members.
openim::test::get_group_members_info( ) {
openim::test::get_group_members_info( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"userIDs" : [ " ${ 2 } " ]
"userIDs" : [ " ${ 2 } " ]
@ -756,7 +785,8 @@ openim::test::check_error "$response"
# Retrieves a list of group members.
# Retrieves a list of group members.
openim::test::get_group_member_list( ) {
openim::test::get_group_member_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -775,7 +805,8 @@ openim::test::check_error "$response"
# Retrieves a list of groups that a user has joined.
# Retrieves a list of groups that a user has joined.
openim::test::get_joined_group_list( ) {
openim::test::get_joined_group_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"fromUserID" : " ${ 1 } " ,
"fromUserID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -792,10 +823,10 @@ local response=$(${CCURL} "${Token}" "${OperationID}" "${Header}" "${INSECURE_OP
openim::test::check_error " $response "
openim::test::check_error " $response "
}
}
# Sets group member information.
# Sets group member information.
openim::test::set_group_member_info( ) {
openim::test::set_group_member_info( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"members" : [
"members" : [
{
{
@ -819,7 +850,8 @@ openim::test::check_error "$response"
# Mutes a group.
# Mutes a group.
openim::test::mute_group( ) {
openim::test::mute_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } "
"groupID" : " ${ 1 } "
}
}
@ -834,7 +866,8 @@ openim::test::check_error "$response"
# Cancels the muting of a group.
# Cancels the muting of a group.
openim::test::cancel_mute_group( ) {
openim::test::cancel_mute_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } "
"groupID" : " ${ 1 } "
}
}
@ -849,7 +882,8 @@ openim::test::check_error "$response"
# Dismisses a group.
# Dismisses a group.
openim::test::dismiss_group( ) {
openim::test::dismiss_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" :" ${ 1 } "
"groupID" :" ${ 1 } "
}
}
@ -864,7 +898,8 @@ openim::test::check_error "$response"
# Cancels muting a group member.
# Cancels muting a group member.
openim::test::cancel_mute_group_member( ) {
openim::test::cancel_mute_group_member( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"userID" : " ${ 2 } "
"userID" : " ${ 2 } "
@ -880,7 +915,8 @@ openim::test::check_error "$response"
# Allows a user to join a group.
# Allows a user to join a group.
openim::test::join_group( ) {
openim::test::join_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"reqMessage" : "req msg join group" ,
"reqMessage" : "req msg join group" ,
@ -898,7 +934,8 @@ openim::test::check_error "$response"
# Sets group information.
# Sets group information.
openim::test::set_group_info( ) {
openim::test::set_group_info( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupInfoForSet" : {
"groupInfoForSet" : {
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
@ -921,10 +958,10 @@ local response=$(${CCURL} "${Token}" "${OperationID}" "${Header}" "${INSECURE_OP
openim::test::check_error " $response "
openim::test::check_error " $response "
}
}
# Allows a user to quit a group.
# Allows a user to quit a group.
openim::test::quit_group( ) {
openim::test::quit_group( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"userID" : " ${ 2 } "
"userID" : " ${ 2 } "
@ -940,7 +977,8 @@ openim::test::check_error "$response"
# Retrieves the list of group applications received by the user.
# Retrieves the list of group applications received by the user.
openim::test::get_recv_group_applicationList( ) {
openim::test::get_recv_group_applicationList( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"fromUserID" : " ${ 1 } " ,
"fromUserID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -959,7 +997,8 @@ openim::test::check_error "$response"
# Responds to a group application.
# Responds to a group application.
openim::test::group_application_response( ) {
openim::test::group_application_response( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"fromUserID" : " ${ 2 } " ,
"fromUserID" : " ${ 2 } " ,
@ -977,7 +1016,8 @@ openim::test::check_error "$response"
# Retrieves the list of group applications made by the user.
# Retrieves the list of group applications made by the user.
openim::test::get_user_req_group_applicationList( ) {
openim::test::get_user_req_group_applicationList( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ 1 } " ,
"userID" : " ${ 1 } " ,
"pagination" : {
"pagination" : {
@ -996,7 +1036,8 @@ openim::test::check_error "$response"
# Mutes a group member for a specified duration.
# Mutes a group member for a specified duration.
openim::test::mute_group_member( ) {
openim::test::mute_group_member( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"userID" : " ${ 2 } " ,
"userID" : " ${ 2 } " ,
@ -1013,7 +1054,8 @@ openim::test::check_error "$response"
# Retrieves a list of group applications from specific users.
# Retrieves a list of group applications from specific users.
openim::test::get_group_users_req_application_list( ) {
openim::test::get_group_users_req_application_list( ) {
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"groupID" : " ${ 1 } " ,
"groupID" : " ${ 1 } " ,
"userIDs" : [
"userIDs" : [
@ -1121,11 +1163,13 @@ openim::log::success "Group test suite completed successfully."
# Define a function to register a user
# Define a function to register a user
openim::register_user( ) {
openim::register_user( ) {
user_register_response = $( ${ CCURL } " ${ Header } " ${ INSECURE_OPENIMAPI } /user/user_register \
user_register_response = $(
${ CCURL } " ${ Header } " ${ INSECURE_OPENIMAPI } /user/user_register \
-d' {
-d' {
"secret" : "openIM123" ,
"secret" : "openIM123" ,
"users" : [ { "userID" : "11111112" ,"nickname" : "yourNickname" ,"faceURL" : "yourFaceURL" } ]
"users" : [ { "userID" : "11111112" ,"nickname" : "yourNickname" ,"faceURL" : "yourFaceURL" } ]
} ' )
} '
)
echo " $user_register_response "
echo " $user_register_response "
}
}
@ -1133,10 +1177,12 @@ echo "$user_register_response"
# Define a function to check the account
# Define a function to check the account
openim::test::check_account( ) {
openim::test::check_account( ) {
local token = $1
local token = $1
account_check_response = $( ${ CCURL } " ${ Header } " -H"operationID: 1646445464564" -H" token: ${ token } " ${ INSECURE_OPENIMAPI } /user/account_check \
account_check_response = $(
${ CCURL } " ${ Header } " -H"operationID: 1646445464564" -H" token: ${ token } " ${ INSECURE_OPENIMAPI } /user/account_check \
-d' {
-d' {
"checkUserIDs" : [ "11111111" ,"11111112" ]
"checkUserIDs" : [ "11111111" ,"11111112" ]
} ' )
} '
)
echo " $account_check_response "
echo " $account_check_response "
}
}
@ -1179,7 +1225,8 @@ local sendID="${1}"
local recvID = " ${ 2 } "
local recvID = " ${ 2 } "
local groupID = " ${ 3 } "
local groupID = " ${ 3 } "
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"sendID" : " ${ sendID } " ,
"sendID" : " ${ sendID } " ,
"recvID" : " ${ recvID } " ,
"recvID" : " ${ recvID } " ,
@ -1223,7 +1270,8 @@ local pageNumber="${6}"
local showNumber = " ${ 7 } "
local showNumber = " ${ 7 } "
# Construct the request body
# Construct the request body
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"sendID" : " ${ sendID } " ,
"sendID" : " ${ sendID } " ,
"recvID" : " ${ recvID } " ,
"recvID" : " ${ recvID } " ,
@ -1256,7 +1304,8 @@ local num="${5}"
local order = " ${ 6 } " # Assuming 0 for ascending, 1 for descending
local order = " ${ 6 } " # Assuming 0 for ascending, 1 for descending
# Construct the request body
# Construct the request body
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ userID } " ,
"userID" : " ${ userID } " ,
"seqRanges" : [
"seqRanges" : [
@ -1286,7 +1335,8 @@ local userID="${1}"
local conversationID = " ${ 2 } "
local conversationID = " ${ 2 } "
local seq = " ${ 3 } "
local seq = " ${ 3 } "
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ userID } " ,
"userID" : " ${ userID } " ,
"conversationID" : " ${ conversationID } " ,
"conversationID" : " ${ conversationID } " ,
@ -1301,12 +1351,12 @@ local response=$(${CCURL} "${Token}" "${OperationID}" "${Header}" "${INSECURE_OP
openim::test::check_error " $response "
openim::test::check_error " $response "
}
}
# Clears all messages for a user.
# Clears all messages for a user.
openim::test::user_clear_all_msg( ) {
openim::test::user_clear_all_msg( ) {
local userID = " ${ 1 } "
local userID = " ${ 1 } "
local request_body = $( cat <<EOF
local request_body = $(
cat <<EOF
{
{
"userID" : " ${ userID } "
"userID" : " ${ userID } "
}
}
@ -1322,8 +1372,7 @@ openim::test::check_error "$response"
# [openim::test::msg function description]
# [openim::test::msg function description]
# The `openim::test::msg` function serves as a test suite for message-related operations.
# The `openim::test::msg` function serves as a test suite for message-related operations.
# It sequentially invokes all message-related test functions to ensure the API's message operations are functioning correctly.
# It sequentially invokes all message-related test functions to ensure the API's message operations are functioning correctly.
function openim::test::msg( )
function openim::test::msg( ) {
{
local SEND_USER_ID = " ${ MANAGER_USERID_1 } " # This should be the sender's userID
local SEND_USER_ID = " ${ MANAGER_USERID_1 } " # This should be the sender's userID
local GROUP_ID = "" # GroupID if it's a group message
local GROUP_ID = "" # GroupID if it's a group message
local USER_ID = " $RANDOM "
local USER_ID = " $RANDOM "
@ -1352,7 +1401,6 @@ local NUM=5
local ORDER = 0 # Assuming 0 for ascending order
local ORDER = 0 # Assuming 0 for ascending order
openim::test::pull_msg_by_seq " ${ RECV_USER_ID } " " ${ CONVERSATION_ID } " " ${ BEGIN_SEQ } " " ${ END_SEQ } " " ${ NUM } " " ${ ORDER } "
openim::test::pull_msg_by_seq " ${ RECV_USER_ID } " " ${ CONVERSATION_ID } " " ${ BEGIN_SEQ } " " ${ END_SEQ } " " ${ NUM } " " ${ ORDER } "
# Assuming message sending was successful and returned a sequence number.
# Assuming message sending was successful and returned a sequence number.
local SEQ_NUMBER = 1 # This should be the actual sequence number of the message sent.
local SEQ_NUMBER = 1 # This should be the actual sequence number of the message sent.
@ -1375,7 +1423,6 @@ openim::test::man() {
openim::log::info "TODO: openim test man"
openim::log::info "TODO: openim test man"
}
}
#################################### Build Module ####################################
#################################### Build Module ####################################
# Function: openim::test::smoke
# Function: openim::test::smoke