Commit ba67314a authored by zhanhuasheng's avatar zhanhuasheng

bugfix

parent 75f3fc35
from Utils.sql_handler import test_env_conn
from TestData.automation.ai_test_data import AiTestData
product_select_sql = f'select * from `shopify_product` where shop_id = {AiTestData.shopId} and status = "active" and is_delete = 0 order by update_at desc'
product_select_sql = f'select * from `shopify_product` where shop_id = {AiTestData.shopId} and is_delete = 0 order by update_at desc'
product_select_result = test_env_conn.select_many_value(sql=product_select_sql)
......
from TestData.inbox.ticketInfo_test_data import ticketInfoData
all_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 1 and `is_ignore` = 0 and room_type != 2'
wait_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 2 and `is_ignore` = 0 and room_type != 2'
close_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 3 and `is_ignore` = 0 and room_type != 2'
your_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 1 and `allocation_uid` = {ticketInfoData.userId} and `is_ignore` = 0 and room_type != 2'
your_wait_ticket_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 2 and `allocation_uid` = {ticketInfoData.userId} and `is_ignore` = 0 and room_type != 2'
your_close_ticket_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 3 and `allocation_uid` = {ticketInfoData.userId} and `is_ignore` = 0 and room_type != 2'
all_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 1 and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
wait_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 2 and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
close_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 3 and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
your_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 1 and `allocation_uid` = {ticketInfoData.userId} and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
your_wait_ticket_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 2 and `allocation_uid` = {ticketInfoData.userId} and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
your_close_ticket_sql = f'select * from `im_room` where `cate_id` = {ticketInfoData.brandId} and `status` = 3 and `allocation_uid` = {ticketInfoData.userId} and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
all_ticket_num = len(ticketInfoData.ticket_info_db.select_many_value(sql=all_ticket_select_sql))
wait_ticket_num = len(ticketInfoData.ticket_info_db.select_many_value(sql=wait_ticket_select_sql))
......
from Utils.sql_handler import test_env_conn
from TestData.inbox.ticketStatus_test_data import ticketStatusData
all_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `is_ignore` = 0 and room_type != 2'
your_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `allocation_uid` = {ticketStatusData.userId} and `is_ignore` = 0 and room_type != 2'
unread_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `read_status` = 1 and `is_ignore` = 0 and room_type != 2'
unassigned_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `allocation_uid` = 0 and `is_ignore` = 0 and room_type != 2'
all_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
your_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `allocation_uid` = {ticketStatusData.userId} and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
unread_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `read_status` = 1 and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
unassigned_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `allocation_uid` = 0 and `is_ignore` = 0 and (`room_type` in (0,1) or (`room_type` = 3 and `ai_handle_status` = 100))'
chatbot_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `is_ignore` = 0 and room_type in (2,3)'
......
......@@ -19,20 +19,22 @@ macro_num = 0
whatsapp_id_list = ()
email_id_list = ()
facebook_id_list = ()
shop_select_sql = f'select * from `shop` where brand_id = {shopifyIntegrationData.brandId} and is_delete = 0 and `connect_status` = 2'
shop_select_result = test_env_conn.select_many_value(sql=shop_select_sql)
for shop in shop_select_result:
if shop['source'] == 1 :
js_shop_num += 1
elif shop['source'] == 2 :
shopify_shop_num += 1
if shop_id_list:
shop_select_sql = f'select * from `shop` where id in {shop_id_list} and brand_id = {shopifyIntegrationData.brandId} and is_delete = 0'
shop_select_result = test_env_conn.select_many_value(sql=shop_select_sql)
for shop in shop_select_result:
if shop['source'] == 1 and shop['connect_status'] == 2:
js_shop_num += 1
elif shop['source'] == 2 and shop['connect_status'] == 2:
shopify_shop_num += 1
elif shop['source'] == 3:
if shop['source'] == 3:
facebook_id_list += (shop['id'],)
elif shop['source'] == 4:
email_id_list += (shop['third_id'],)
elif shop['source'] == 5:
ins_shop_num += 1
elif shop['source'] == 6:
whatsapp_id_list += (shop['third_id'],)
......@@ -57,12 +59,15 @@ if whatsapp_id_list:
if facebook_id_list:
timeStamp = time.time()
if len(facebook_id_list) == 1:
facebook_select_sql = f'select * from im_facebook_channel_conf where site_id = {facebook_id_list[0]} and is_connected = 1 and ins_relate = "" and expires_at > {int(timeStamp)}'
facebook_select_sql = f'select * from im_facebook_channel_conf where site_id = {facebook_id_list[0]} and is_connected = 1 and expires_at > {int(timeStamp)}'
else:
facebook_select_sql = f'select * from im_facebook_channel_conf where site_id in {facebook_id_list} and is_connected = 1 and ins_relate = "" and expires_at > {int(timeStamp)}'
facebook_select_sql = f'select * from im_facebook_channel_conf where site_id in {facebook_id_list} and is_connected = 1 and expires_at > {int(timeStamp)}'
facebook_select_result = test_env_conn.select_many_value(sql=facebook_select_sql)
if facebook_select_result:
facebook_shop_num = len(facebook_select_result)
for facebook in facebook_select_result:
if facebook['ins_relate'] is not None:
ins_shop_num += 1
setattr(shopifyIntegrationData, 'shopify_shop_num', shopify_shop_num)
setattr(shopifyIntegrationData, 'js_shop_num', js_shop_num)
......
......@@ -154,6 +154,11 @@ class ReqHandler:
time.sleep(10) # 超限时,暂停30秒
print('接口超限3')
self.send_requests(case, var_class)
except pymysql.err.ProgrammingError:
from Utils import sql_handler
from Utils.config_handler import base_config
sql_handler.test_env_conn = sql_handler.SqlHandler(address=base_config.get_value('mysql','address'),port=int(base_config.get_value('mysql','port')),account=base_config.get_value('mysql','account'),password=base_config.get_value('mysql','password'))
self.send_requests(case, var_class)
except Exception as e:
import traceback
print(traceback.print_exc())
......
......@@ -76,15 +76,6 @@ api8:
- exec: {"code": "assert res.json()['data']['total'] == str(int('${url_num}') + 1)"}
api10:
title: 查询url接口
url: api/v1/willai/local/aiUrlList
method: post
data: {"page":1,"pageSize":100,"shopId":"${shopId}","v":"${v}","category": 1,"search": "","sortType": 0}
expected:
- eq: {"$.code": 0}
- eq: {"$.data.list[?(@.id == '${url_id}')].url": "${edit_url}"}
api11:
title: 刷新url
url: api/v1/willai/local/operateAiUrl
......@@ -95,7 +86,7 @@ api11:
api12:
title: 删除url
url: api/v1/willai/local/deleteAiUrl
url: api/v1/willai/local/operateAiUrl
method: post
data: {"shopId":"${shopId}","idList":["${url_id}"],"v":"${v}","selectAll": false,"status": 2,"excludeIdList": []}
expected:
......@@ -236,7 +227,7 @@ api28:
title: 查询in this knowledge的QA接口
url: api/v1/willai/local/aiQAList
method: post
data: {"shopId":"${shopId}","page":1,"pageSize":15,"status":2,"search":"","lastDayType":2,"searchType":1,"timeZone":"Asia/Shanghai","v":"${v}"}
data: {"shopId":"${shopId}","page":1,"pageSize":15,"status":2,"search":"","lastDayType":4,"searchType":1,"timeZone":"Asia/Shanghai","v":"${v}"}
expected:
- eq: {"$.code": 0}
- not_in_list: {"$.data.list[*].id": "${qa_id}"}
......
......@@ -53,6 +53,7 @@ api6:
title: c端主动发起会话触发rule
ws: customer
action: sendmsg
sleep: 4
data:
type: text
......@@ -77,6 +78,7 @@ api9:
title: c端主动发起会话触发rule
ws: customer
action: sendmsg
sleep: 2
data:
type: text
......
......@@ -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_06_channel.py',f'--alluredir=./allureReports/json','--clean-alluredir'])
pytest.main(['-vs','TestCase/billing',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告
pytest.main(['-vs',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告
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