Commit 02e01472 authored by zhanhuasheng's avatar zhanhuasheng

bugfix

parent ad82365b
......@@ -4,7 +4,7 @@ from Utils.sql_handler import test_env_conn
from TestData.inbox.ticketDetail_test_data import ticketDetailData
ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketDetailData.brandId} and `status` = 1 and `is_ignore` = 0'
ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketDetailData.brandId} and `status` = 1 and `is_ignore` = 0 and first_send_name != "Willdesk Team"'
ticket_select_result = test_env_conn.select_one_value(sql=ticket_select_sql)
ticket_room_id = ticket_select_result['room_id']
ticket_id = ticket_select_result['id']
......
import time
import jsonpath
import pymysql.err
import requests
import re
import os
......@@ -106,6 +107,9 @@ class ReqHandler:
logger.error(f'{title}用例执行失败,失败原因:断言不通过\n用例{case}\n期望值{expected}\n实际返回值{res.text}')
print(f'{title}用例执行失败,失败原因:断言不通过\n用例{case}\n期望值{expected}\n实际返回值{res.text}')
raise AssertionError
except pymysql.err.InterfaceError:
print('数据库连接失败')
raise pymysql.err.InterfaceError
except Exception as e:
import traceback
print(traceback.print_exc())
......
import subprocess
import requests
import time
......@@ -9,16 +8,16 @@ import urllib.parse
timestamp = str(round(time.time() * 1000))
secret = 'SEC80ae01de9c486a9f8531d4ec1ed09b8fbd5d9cc1b0ba171b0493f9bebfeb4807' #正式的webhook
# secret = 'SEC9d91939234e83369cba32c0ca4bcd9af60b5b1f69424d6fabd36f48d572a151c' #测试用的webhook
# secret = 'SEC80ae01de9c486a9f8531d4ec1ed09b8fbd5d9cc1b0ba171b0493f9bebfeb4807' #正式的webhook
secret = 'SEC9d91939234e83369cba32c0ca4bcd9af60b5b1f69424d6fabd36f48d572a151c' #测试用的webhook
secret_enc = secret.encode('utf-8')
string_to_sign = '{}\n{}'.format(timestamp, secret)
string_to_sign_enc = string_to_sign.encode('utf-8')
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
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=775093d6cbe22673b65e506f20aea7036cc58c4b9e89850f660eb798e4c149f6' #正式的webhook
webhook_url = 'https://oapi.dingtalk.com/robot/send?access_token=22fda27990b00841c3201c20649c0a8abb6da82d8472b6f6154ef4cd9dadb33f' #测试用的webhook
# webhook_url = 'https://oapi.dingtalk.com/robot/send?access_token=775093d6cbe22673b65e506f20aea7036cc58c4b9e89850f660eb798e4c149f6' #正式的webhook
class webhookHandler:
def __init__(self,webhookUrl = f"{webhook_url}&timestamp={timestamp}&sign={sign}"):
......
......@@ -40,14 +40,12 @@ class ws:
if self.websocket and self.websocket.open:
try:
await self.websocket.send(message)
print(f"Sent message: {message}")
time.sleep(0.5)
except websockets.ConnectionClosed as e:
await self.close()
except Exception:
print('error')
except Exception as e:
print('error:',e)
else:
print('send重新链接')
await self.connect()
await self.send_message(message)
......@@ -55,17 +53,14 @@ class ws:
if self.websocket and self.websocket.open:
try:
message = await self.websocket.recv()
print(f"Received message: {message}")
return message
except websockets.ConnectionClosed as e:
print('receive关闭链接')
await self.close()
except NameError:
return message
except Exception as e:
print(e)
else:
print('receive重新链接')
await self.connect()
return await self.receive_message()
......
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