From 72f4fc0a436e495a85fd755212387297282b475d Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Tue, 26 Mar 2024 17:35:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TestFile/inbox/channel_select.py | 29 ++++++++++++++- YamlCase/inbox/channel.yaml | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/TestFile/inbox/channel_select.py b/TestFile/inbox/channel_select.py index 73079dd..9e88129 100644 --- a/TestFile/inbox/channel_select.py +++ b/TestFile/inbox/channel_select.py @@ -11,7 +11,34 @@ setattr(channelData, 'channel_id', channel_id) setattr(channelData, 'channel_name', channel_name) setattr(channelData, 'channel_resource_id', channel_resource_id) -channel_open_room_select_sql = f'select * from `im_room` where site_id = {channel_rel_id} and status = 1' +channel_open_room_select_sql = f'select * from `im_room` where site_id = {channel_rel_id} and status = 1 and is_ignore = 0 ' channel_open_room_select_result = test_env_conn.select_many_value(sql=channel_open_room_select_sql) setattr(channelData, 'channel_open_room_num', len(channel_open_room_select_result)) +setattr(channelData, 'channel_open_room_num_add', len(channel_open_room_select_result) + 1) +customer_service_select_sql = f'select customer_service_id from `rel_customerservice_brand` where brand_id = {channelData.brandId} and is_activation = 1' +customer_service_select_result = test_env_conn.select_many_value(sql=customer_service_select_sql) +customer_service_id_list = [i['customer_service_id'] for i in customer_service_select_result] +customer_service_list_select_sql = f'select * from `customer_service` where id in {tuple(customer_service_id_list)} and customer_type = 0' +customer_service_list_select_result = test_env_conn.select_many_value(sql=customer_service_list_select_sql) + +customer_service_id = customer_service_list_select_result[0]['id'] +setattr(channelData, 'customer_service_num', len(customer_service_list_select_result)) +setattr(channelData, 'customer_service_id', customer_service_id) +setattr(channelData, 'customer_service_name', customer_service_list_select_result[0]['name']) +setattr(channelData, 'customer_service_image', customer_service_list_select_result[0]['profile']) +setattr(channelData, 'customer_service_email', customer_service_list_select_result[0]['email']) + +customer_channel_open_room_select_sql = f'select * from `im_room` where site_id = {channel_rel_id} and status = 1 and is_ignore = 0 and allocation_uid = {customer_service_id}' +customer_channel_open_room_select_result = test_env_conn.select_many_value(sql=customer_channel_open_room_select_sql) +setattr(channelData, 'customer_channel_open_room_num', len(customer_channel_open_room_select_result)) + +customer_open_room_select_sql = f'select * from `im_room` where status = 1 and is_ignore = 0 and allocation_uid = {customer_service_id}' +customer_open_room_select_result = test_env_conn.select_many_value(sql=customer_open_room_select_sql) +setattr(channelData, 'customer_open_room_num', len(customer_open_room_select_result)) +setattr(channelData, 'customer_open_room_num_add', len(customer_open_room_select_result) + 1) + + +other_room_select_sql = f'select * from `im_room` where allocation_uid != {customer_service_id} and cate_id = {channelData.brandId} and status = 1 limit 10' +other_room_select_result = test_env_conn.select_one_value(sql=other_room_select_sql) +setattr(channelData, 'other_room_id', other_room_select_result['room_id']) diff --git a/YamlCase/inbox/channel.yaml b/YamlCase/inbox/channel.yaml index 6834a44..68e0e0b 100644 --- a/YamlCase/inbox/channel.yaml +++ b/YamlCase/inbox/channel.yaml @@ -9,5 +9,66 @@ api1: - eq: {"$.data.list[?(@.id == '${channel_id}')].name" : "${channel_name}"} - eq: {"$.data.list[?(@.id == '${channel_id}')].openCount" : "${channel_open_room_num}"} - eq: {"$.data.list[?(@.id == '${channel_id}')].resourceId" : "${channel_resource_id}"} + - eq: {"$.data.list[?(@.id == '${channel_id}')].memberCount" : "${customer_service_num}"} + - eq: {"$.data.list[?(@.id == '${channel_id}')].members[?(@.id == '${customer_service_id}')].openedRoomCount" : "${customer_channel_open_room_num}"} + - eq: {"$.data.list[?(@.id == '${channel_id}')].members[?(@.id == '${customer_service_id}')].profile" : "${customer_service_image}"} + - eq: {"$.data.list[?(@.id == '${channel_id}')].members[?(@.id == '${customer_service_id}')].name" : "${customer_service_name}"} + - eq: {"$.data.list[?(@.id == '${channel_id}')].members[?(@.id == '${customer_service_id}')].email" : "${customer_service_email}"} +api2: + title: 检查渠道对应客服信息 + url: /api/v1/resource/getResourceItemList + method: post + data: {"resourceType":"teammates","v":"${v}"} + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].name" : "${customer_service_name}"} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].picture" : "${customer_service_image}"} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].openCount" : "${customer_open_room_num}"} + +api3: + title: 分配会话给客服 + url: /api/v1/chatRoom/operate + method: post + data: {"uid":"${customer_service_id}","uType":2,"platform":1,"roomId":"'${other_room_id}'","clientId":"${willdesk_clientId}","event":"allocat","username":"${name}","isMark":false,"allocationUid":"${customer_service_id}","v":"${v}"} + expected: + - eq: {"$.code" : 0} + +#api4: +# title: 检查会话是否分配成功 - channel +# url: /api/v1/resource/getResourceItemList +# method: post +# data: { "resourceType": "channel","v": "${v}" } +# expected: +# - eq: { "$.code": 0 } +# - eq: { "$.data.list[?(@.id == '${channel_id}')].openCount": "${channel_open_room_num_add}" } +# 先不做这个 +api5: + title: 检查会话是否分配成功 - teammates以及客服信息 + url: /api/v1/resource/getResourceItemList + method: post + data: {"resourceType":"teammates","v":"${v}"} + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].name" : "${customer_service_name}"} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].picture" : "${customer_service_image}"} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].openCount" : "${customer_open_room_num_add}"} + + +api6: + title: 把会话分配回去 + url: /api/v1/chatRoom/operate + method: post + data: {"uid":"${customer_service_id}","uType":2,"platform":1,"roomId":"'${other_room_id}'","clientId":"${willdesk_clientId}","event":"allocat","username":"${name}","isMark":false,"allocationUid":"0","v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api7: + title: 检查会话是否分配成功 - teammates + url: /api/v1/resource/getResourceItemList + method: post + data: {"resourceType":"teammates","v":"${v}"} + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.list[?(@.relId == '${customer_service_id}')].openCount" : "${customer_open_room_num}"} \ No newline at end of file -- GitLab