"TestData/git@172.16.40.31:zhanhuasheng/willdesk_apiauto.git" did not exist on "cabd450c1f6ea85479035cbdcb42b4e06ac224ba"
Commit 72f4fc0a authored by zhanhuasheng's avatar zhanhuasheng

新增用例

parent 9633580d
...@@ -11,7 +11,34 @@ setattr(channelData, 'channel_id', channel_id) ...@@ -11,7 +11,34 @@ setattr(channelData, 'channel_id', channel_id)
setattr(channelData, 'channel_name', channel_name) setattr(channelData, 'channel_name', channel_name)
setattr(channelData, 'channel_resource_id', channel_resource_id) 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) 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', 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'])
...@@ -9,5 +9,66 @@ api1: ...@@ -9,5 +9,66 @@ api1:
- eq: {"$.data.list[?(@.id == '${channel_id}')].name" : "${channel_name}"} - 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}')].openCount" : "${channel_open_room_num}"}
- eq: {"$.data.list[?(@.id == '${channel_id}')].resourceId" : "${channel_resource_id}"} - 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment