Commit 73b80463 authored by zhanhuasheng's avatar zhanhuasheng

切正式环境

parent 02e01472
......@@ -8,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}"):
......@@ -31,7 +31,7 @@ class webhookHandler:
"msgtype": "markdown",
"markdown": {
"title":"#willdesk接口自动化测试报告",
"text": "#### 本次接口自动化测试结果如下 \n > ###### 用例总数:%s\n > ###### 成功用例数量:%s\n > ###### 失败用例数量:%s\n > ###### 报错用例数量:%s\n > ###### 跳过用例数量:%s \n > ###### 耗时:%s秒\n > ###### 报告生成时间:%s [测试报告](https://www.baidu.com)"%(result._numcollected,len(result.stats.get('passed', [])),len(result.stats.get('failed', [])),len(result.stats.get('error', [])),len(result.stats.get('skipped', [])),second,current_date_time_str)
"text": "#### 本次接口自动化测试结果如下 \n > ###### 用例总数:%s\n > ###### 成功用例数量:%s\n > ###### 失败用例数量:%s\n > ###### 报错用例数量:%s\n > ###### 跳过用例数量:%s \n > ###### 耗时:%s秒\n > ###### 报告生成时间:%s [测试报告](https://flow.aliyun.com/pipelines/3052941/current)"%(result._numcollected,len(result.stats.get('passed', [])),len(result.stats.get('failed', [])),len(result.stats.get('error', [])),len(result.stats.get('skipped', [])),second,current_date_time_str)
},
}
res = requests.post(url=self.webhookUrl,json=data)
......
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