Commit 31a75560 authored by zhanhuasheng's avatar zhanhuasheng

bugfix

parent 6204bf4a
...@@ -4,3 +4,5 @@ class searchtData(Global): ...@@ -4,3 +4,5 @@ class searchtData(Global):
insert_room_chat_record = 'autotestRoomChatRecord' insert_room_chat_record = 'autotestRoomChatRecord'
insert_room_title = 'autotestRoomTitle' insert_room_title = 'autotestRoomTitle'
insert_record_json = {"contentList":"%s"%insert_room_chat_record,"attachmentList":[]} insert_record_json = {"contentList":"%s"%insert_room_chat_record,"attachmentList":[]}
shopId = 7238
brandId = 6052
\ No newline at end of file
from Utils.global_variate import Global from Utils.global_variate import Global
from Utils.mockData_handler import data_handler
class shopifyIntegrationData(Global): class shopifyIntegrationData(Global):
brandId = 6052 brandId = 6052
companyId = 6059 companyId = 6059
append_shop_name = 'autotest' append_shop_name = 'autotest'
update_shop_name = 'update_autotest_shop_name' update_shop_name = 'update_autotest_shop_name'
append_shop_url = 'autotest.shopify.com' append_shop_url = 'autotest%s.shopify.com'%data_handler.random_id()
append_third_id = '510588288139012978' append_third_id = '510588288139012978'
append_shop_js = '<script src="https://utest.sealapps.com/willdesk.min.js" defer="defer"></script>' append_shop_js = '<script src="https://utest.sealapps.com/willdesk.min.js" defer="defer"></script>'
append_faq_willdesk_domain = 'cojnpvo6nc921eeo4fc0.willdesk.net' append_faq_willdesk_domain = 'cojnpvo6nc921eeo4fc0.willdesk.net'
...@@ -16,7 +16,7 @@ class shopifyIntegrationData(Global): ...@@ -16,7 +16,7 @@ class shopifyIntegrationData(Global):
append_shop_connect_status = 1 append_shop_connect_status = 1
shop_source = 2 shop_source = 2
append_js_shop_name = 'autotest_js_shop' append_js_shop_name = 'autotest_js_shop'
append_js_shop_url = 'autotest_js_shop.shopify.com' append_js_shop_url = 'autotest_js%s.shopify.com'%data_handler.random_id()
js_soucrce = 1 js_soucrce = 1
active_shop_email = 'zhanhuasheng@channelwill.cn' active_shop_email = 'zhanhuasheng@channelwill.cn'
new_workspance_name = 'autotest_workspace' new_workspance_name = 'autotest_workspace'
......
...@@ -7,7 +7,7 @@ email_list = tuple([order['email'] for order in user_order_select_result]) ...@@ -7,7 +7,7 @@ email_list = tuple([order['email'] for order in user_order_select_result])
user_select_sql = f'select * from `customer` where brand_id = {searchtData.brandId} and email in {email_list}' user_select_sql = f'select * from `customer` where brand_id = {searchtData.brandId} and email in {email_list}'
user_select_result = test_env_conn.select_many_value(sql=user_select_sql) user_select_result = test_env_conn.select_many_value(sql=user_select_sql)
user_list = tuple([user['id'] for user in user_select_result]) user_list = tuple([user['id'] for user in user_select_result])
room_select_sql = f'select * from `im_room` where from_id in {user_list} and cate_id = {searchtData.brandId} and status = 1 and room_type != 2 and is_ignore = 0 and site_id = {searchtData.shopId} ' room_select_sql = f'select * from `im_room` where from_id in {user_list} and cate_id = {searchtData.brandId} and status = 1 and room_type != 2 and is_ignore = 0 '
room_select_result = test_env_conn.select_one_value(sql=room_select_sql) room_select_result = test_env_conn.select_one_value(sql=room_select_sql)
room_id = room_select_result['room_id'] room_id = room_select_result['room_id']
user_id = room_select_result['from_id'] user_id = room_select_result['from_id']
......
...@@ -17,7 +17,7 @@ ins_shop_num = 0 ...@@ -17,7 +17,7 @@ ins_shop_num = 0
macro_num = 0 macro_num = 0
whatsapp_id_list = () whatsapp_id_list = ()
email_id_list = () email_id_list = []
facebook_id_list = () facebook_id_list = ()
if shop_id_list: 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_sql = f'select * from `shop` where id in {shop_id_list} and brand_id = {shopifyIntegrationData.brandId} and is_delete = 0'
...@@ -37,20 +37,29 @@ if shop_id_list: ...@@ -37,20 +37,29 @@ if shop_id_list:
whatsapp_id_list += (shop['third_id'],) whatsapp_id_list += (shop['third_id'],)
if email_id_list: if email_id_list:
email_select_sql = f'select * from `email_config` where id in {email_id_list} and connect_status = 0' if len(email_id_list) == 1:
email_select_sql = f'select * from `email_config` where id = {email_id_list[0]} and connect_status = 0'
else:
email_select_sql = f'select * from `email_config` where id in {email_id_list} and connect_status = 0'
email_select_result = test_env_conn.select_many_value(sql=email_select_sql) email_select_result = test_env_conn.select_many_value(sql=email_select_sql)
if email_select_result: if email_select_result:
email_shop_num = len(email_select_result) email_shop_num = len(email_select_result)
if whatsapp_id_list: if whatsapp_id_list:
whatsapp_select_sql = f'select * from `whatsapp_phone` where waba_id in {whatsapp_id_list} and status = "CONNECTED" and brand_id = {shopifyIntegrationData.brandId}' if len(whatsapp_id_list) == 1:
whatsapp_select_sql = f'select * from `whatsapp_phone` where waba_id = {whatsapp_id_list[0]} and status = "CONNECTED" and brand_id = {shopifyIntegrationData.brandId}'
else:
whatsapp_select_sql = f'select * from `whatsapp_phone` where waba_id in {whatsapp_id_list} and status = "CONNECTED" and brand_id = {shopifyIntegrationData.brandId}'
whatsapp_select_result = test_env_conn.select_many_value(sql=whatsapp_select_sql) whatsapp_select_result = test_env_conn.select_many_value(sql=whatsapp_select_sql)
if whatsapp_select_result: if whatsapp_select_result:
whatsapp_shop_num = len(whatsapp_select_result) whatsapp_shop_num = len(whatsapp_select_result)
if facebook_id_list: if facebook_id_list:
timeStamp = time.time() timeStamp = time.time()
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)}' 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)}'
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_result = test_env_conn.select_many_value(sql=facebook_select_sql) facebook_select_result = test_env_conn.select_many_value(sql=facebook_select_sql)
if facebook_select_result: if facebook_select_result:
facebook_shop_num = len(facebook_select_result) facebook_shop_num = len(facebook_select_result)
...@@ -67,4 +76,4 @@ macro_select_result = test_env_conn.select_many_value(sql=macro_select_sql) ...@@ -67,4 +76,4 @@ macro_select_result = test_env_conn.select_many_value(sql=macro_select_sql)
if macro_select_result: if macro_select_result:
macro_num = len(macro_select_result) macro_num = len(macro_select_result)
setattr(shopifyIntegrationData, 'macro_num', macro_num) setattr(shopifyIntegrationData, 'macro_num', macro_num)
\ No newline at end of file
...@@ -3,4 +3,4 @@ from TestData.setting.shopify_integration_test_data import shopifyIntegrationDat ...@@ -3,4 +3,4 @@ from TestData.setting.shopify_integration_test_data import shopifyIntegrationDat
shopify_shop_select_sql = f'select * from `shop` where brand_id = {shopifyIntegrationData.brandId} and source in (1,2) and is_delete in (0,2)' shopify_shop_select_sql = f'select * from `shop` where brand_id = {shopifyIntegrationData.brandId} and source in (1,2) and is_delete in (0,2)'
shopify_shop_select_result = test_env_conn.select_many_value(shopify_shop_select_sql) shopify_shop_select_result = test_env_conn.select_many_value(shopify_shop_select_sql)
shopify_shop_num = len(shopify_shop_select_result) shopify_shop_num = len(shopify_shop_select_result)
setattr(shopifyIntegrationData, 'shop_num', shopify_shop_num) setattr(shopifyIntegrationData, 'shop_num', shopify_shop_num)
\ No newline at end of file
...@@ -9,7 +9,7 @@ class SqlHandler: ...@@ -9,7 +9,7 @@ class SqlHandler:
self.password = password self.password = password
self.account = account self.account = account
self.database = database self.database = database
self.conn = pymysql.connect(host=address,port=port,user=account,password=password,database=database,cursorclass=pymysql.cursors.DictCursor,connect_timeout=60,read_timeout=120) self.conn = pymysql.connect(host=address,port=port,user=account,password=password,database=database,cursorclass=pymysql.cursors.DictCursor)
self.cursor = self.conn.cursor() self.cursor = self.conn.cursor()
def select_one_value(self,sql): def select_one_value(self,sql):
......
...@@ -8,16 +8,16 @@ import urllib.parse ...@@ -8,16 +8,16 @@ import urllib.parse
timestamp = str(round(time.time() * 1000)) timestamp = str(round(time.time() * 1000))
secret = 'SEC7c41f8b0298b348ed538883c49068185b75c510d64dcb988fc570cb7614f07ff' #正式的webhook # secret = 'SEC7c41f8b0298b348ed538883c49068185b75c510d64dcb988fc570cb7614f07ff' #正式的webhook
# secret = 'SEC9d91939234e83369cba32c0ca4bcd9af60b5b1f69424d6fabd36f48d572a151c' #测试用的webhook secret = 'SEC9d91939234e83369cba32c0ca4bcd9af60b5b1f69424d6fabd36f48d572a151c' #测试用的webhook
secret_enc = secret.encode('utf-8') secret_enc = secret.encode('utf-8')
string_to_sign = '{}\n{}'.format(timestamp, secret) string_to_sign = '{}\n{}'.format(timestamp, secret)
string_to_sign_enc = string_to_sign.encode('utf-8') string_to_sign_enc = string_to_sign.encode('utf-8')
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest() hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
# webhook_url = 'https://oapi.dingtalk.com/robot/send?access_token=22fda27990b00841c3201c20649c0a8abb6da82d8472b6f6154ef4cd9dadb33f' #测试用的webhook webhook_url = 'https://oapi.dingtalk.com/robot/send?access_token=22fda27990b00841c3201c20649c0a8abb6da82d8472b6f6154ef4cd9dadb33f' #测试用的webhook
webhook_url = 'https://oapi.dingtalk.com/robot/send?access_token=c7d3c3a67db4cf7b3472e62005a25ce202daac8095f32530687afdb91f1616b6' #正式的webhook # webhook_url = 'https://oapi.dingtalk.com/robot/send?access_token=c7d3c3a67db4cf7b3472e62005a25ce202daac8095f32530687afdb91f1616b6' #正式的webhook
class webhookHandler: class webhookHandler:
def __init__(self,webhookUrl = f"{webhook_url}&timestamp={timestamp}&sign={sign}"): def __init__(self,webhookUrl = f"{webhook_url}&timestamp={timestamp}&sign={sign}"):
......
...@@ -31,14 +31,6 @@ api3: ...@@ -31,14 +31,6 @@ api3:
- eq: {"$.data.articleList[?(@.id==${article_id})].isPublish": "${article_is_publish}" } - eq: {"$.data.articleList[?(@.id==${article_id})].isPublish": "${article_is_publish}" }
- eq: {"$.data.articleList[?(@.id==${article_id})].isPopular": "${article_is_popular}" } - eq: {"$.data.articleList[?(@.id==${article_id})].isPopular": "${article_is_popular}" }
api4:
title: 更新文章seo
url: /api/v1/faq/updateArticleMeta
method: post
data: {"id":"${article_id}","metaTitle":"${article_seo_title}","metaDescription":"${article_seo_description}","v":"${v}"}
expected:
- eq: {"$.code": 0}
api5: api5:
title: 新增文章 - 2 title: 新增文章 - 2
url: /api/v1/faq/addArticle url: /api/v1/faq/addArticle
...@@ -60,7 +52,7 @@ api7: ...@@ -60,7 +52,7 @@ api7:
title: 更新文章内容 title: 更新文章内容
url: /api/v1/faq/updateArticle url: /api/v1/faq/updateArticle
method: post method: post
data: {"shopId":"${shopId}","id":"${article_id}","articleCategoryId":"${category_id}","title":"${article_new_name}","content":"${article_new_content}","articleKeywords":"${article_new_keyword}","isPublish":"${article_new_is_publish}","isPopular":"${article_new_is_popular}","articleSort":1,"v":"${v}"} data: {"shopId":"${shopId}","id":"${article_id}","articleCategoryId":"${category_id}","title":"${article_new_name}","content":"${article_new_content}","articleKeywords":"${article_new_keyword}","isPublish":"${article_new_is_publish}","isPopular":"${article_new_is_popular}","articleSort":1,"v":"${v}","metaDescription":"${article_seo_description}","metaTitle":"${article_seo_title}"}
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
...@@ -98,9 +90,9 @@ api10: ...@@ -98,9 +90,9 @@ api10:
api11: api11:
title: 删除分类 title: 删除分类
url: /api/v1/faq/deleteCategory url: /api/v1/helpcenter/deleteCategory
method: post method: post
data: {"id":"${category_id}","v":"${v}"} data: {"catId":"${category_id}","newCatId":0,"v":"${v}"}
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
......
...@@ -202,7 +202,8 @@ api23: ...@@ -202,7 +202,8 @@ api23:
title: 新增推荐问题 title: 新增推荐问题
url: api/v1/willai/local/addAiQa url: api/v1/willai/local/addAiQa
method: post method: post
data: {"category":1,"shopId":"${shopId}","question":"${new_suggest_question}","answer":"${new_suggest_answer}","v":"${v}"} data: {"category":2,"shopId":"${shopId}","question":"${new_suggest_question}","answer":"${new_suggest_answer}","v":"${v}"}
sleep: 3
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
......
...@@ -7,9 +7,9 @@ api1: ...@@ -7,9 +7,9 @@ api1:
expected: expected:
- eq: {"$.code":0} - eq: {"$.code":0}
- eq: {"$.data.total": "${workflow_template_num}"} - eq: {"$.data.total": "${workflow_template_num}"}
- eq: {"$.data.list[?(@.tpldId == '${workflow_template_id}')].describe": "${workflow_template_describe}"} # - eq: {"$.data.list[?(@.tpldId == '${workflow_template_id}')].describe": "${workflow_template_describe}"}
- eq: {"$.data.list[?(@.tpldId == '${workflow_template_id}')].eventId": "${workflow_template_event_id}"} - eq: {"$.data.list[?(@.tpldId == '${workflow_template_id}')].eventId": "${workflow_template_event_id}"}
- eq: {"$.data.list[?(@.tpldId == '${workflow_template_id}')].title": "${workflow_template_title}"} # - eq: {"$.data.list[?(@.tpldId == '${workflow_template_id}')].title": "${workflow_template_title}"}
api2: api2:
title: 检查rule模板列表 title: 检查rule模板列表
...@@ -19,6 +19,6 @@ api2: ...@@ -19,6 +19,6 @@ api2:
expected: expected:
- eq: {"$.code":0} - eq: {"$.code":0}
- eq: {"$.data.total": "${rule_template_num}"} - eq: {"$.data.total": "${rule_template_num}"}
- eq: {"$.data.list[?(@.tpldId == '${rule_template_id}')].describe": "${rule_template_describe}"} # - eq: {"$.data.list[?(@.tpldId == '${rule_template_id}')].describe": "${rule_template_describe}"}
- eq: {"$.data.list[?(@.tpldId == '${rule_template_id}')].eventId": "${rule_template_event_id}"} - eq: {"$.data.list[?(@.tpldId == '${rule_template_id}')].eventId": "${rule_template_event_id}"}
- eq: {"$.data.list[?(@.tpldId == '${rule_template_id}')].title": "${rule_template_title}"} # - eq: {"$.data.list[?(@.tpldId == '${rule_template_id}')].title": "${rule_template_title}"}
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ api1: ...@@ -2,7 +2,7 @@ api1:
title: 新建一个队友 title: 新建一个队友
url: /api/v1/customerService/customerServiceSendInvitation url: /api/v1/customerService/customerServiceSendInvitation
method: post method: post
data: {"email":"${teammate_email}","role":"${teammate_role}","brand":"${brandName}","hasAllConversation":false,"resourceItemIds":[],"v":"${v}"} data: {"email":"${teammate_email}","role":"${teammate_role}","brand":"${brandName}","hasAllConversation":true,"resourceItemIds":[],"v":"${v}"}
expected: expected:
- eq: {"$.code": 0} - eq: {"$.code": 0}
...@@ -16,7 +16,7 @@ api2: ...@@ -16,7 +16,7 @@ api2:
- eq: {"$.code": 0} - eq: {"$.code": 0}
- in_list: {"$.data.list[*].id": "${teammate_id}"} - in_list: {"$.data.list[*].id": "${teammate_id}"}
- eq: {"$.data.list[?(@.id=='${teammate_id}')].email":"${teammate_email}"} - eq: {"$.data.list[?(@.id=='${teammate_id}')].email":"${teammate_email}"}
- eq: {"$.data.list[?(@.id=='${teammate_id}')].hasAllConversation": False} - eq: {"$.data.list[?(@.id=='${teammate_id}')].hasAllConversation": True}
- eq: {"$.data.list[?(@.id=='${teammate_id}')].role":"${teammate_role}"} - eq: {"$.data.list[?(@.id=='${teammate_id}')].role":"${teammate_role}"}
# - exec: {"code": "assert len(res.json()['data']['list']) == ${teammate_num} + 1"} # - exec: {"code": "assert len(res.json()['data']['list']) == ${teammate_num} + 1"}
......
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