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