Commit 9633580d authored by zhanhuasheng's avatar zhanhuasheng

新增用例

parent 66f98af5
import pytest
from Utils import yaml_handler
from Utils import req_handler
from TestData.inbox.channel_test_data import channelData
class TestChannel:
yaml_path = r'inbox\channel.yaml'
yaml_data = yaml_handler.yaml_handler.get_case(yaml_path)
@pytest.mark.parametrize('case',yaml_data)
def test_channel(self,case):
print(case)
req_handler.ReqHandler.send_requests(case=case,var_class=channelData)
from Utils.global_variate import Global
class channelData(Global):
pass
# brandId = 6052
# shopId = 7238
from Utils.sql_handler import test_env_conn
from TestData.inbox.channel_test_data import channelData
channel_select_sql = f'select * from `resource_item` where brand_id = {channelData.brandId} and resource_id in (7,2,3,4,6)' #2:livechat 3:facebook 4:email 6:ins 7:whatsapp
channel_select_result = test_env_conn.select_many_value(sql=channel_select_sql)
channel_id = channel_select_result[0]['id']
channel_name = channel_select_result[0]['name']
channel_rel_id = channel_select_result[0]['rel_id']
channel_resource_id = channel_select_result[0]['resource_id']
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_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))
api1:
title: 检查渠道信息
url: /api/v1/resource/getResourceItemList
method: post
before_sql: inbox/channel_select.py
data: {"resourceType":"channel","v":"${v}"}
expected:
- eq: {"$.code" : 0}
- 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}"}
......@@ -158,3 +158,11 @@ api16:
- eq: { "$.data.list[8].content": "${img}" }
- like: { "$.data.list[8].senderUid": "${userId}" }
api17:
title: b端主动发起会话 - 笔记
ws: willdesk
action: sendmsg
data:
type: text
roomId: "${roomId}"
isNote: true
\ No newline at end of file
......@@ -4,7 +4,7 @@ from Utils.sql_handler import test_env_conn
if __name__ == '__main__':
try:
pytest.main(['-vs',r'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase\inbox\test_05_team.py',f'--alluredir=./allureReports','--clean-alluredir'])
pytest.main(['-vs',r'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase',f'--alluredir=./allureReports','--clean-alluredir'])
finally:
test_env_conn.close_db() #关闭数据库链接
......
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