diff --git a/httpfpt/core/conf.toml b/httpfpt/core/conf.toml
index 087d386..24977df 100644
--- a/httpfpt/core/conf.toml
+++ b/httpfpt/core/conf.toml
@@ -49,11 +49,11 @@ proxies.https = ''
send = false
# 企业微信
-[wechat_talk]
+[wechat]
webhook = ''
proxies.http = ''
proxies.https = ''
-send_report = false
+send = false
# 请求发送
diff --git a/httpfpt/core/get_conf.py b/httpfpt/core/get_conf.py
index 19fe8bb..4bbf5e0 100644
--- a/httpfpt/core/get_conf.py
+++ b/httpfpt/core/get_conf.py
@@ -68,16 +68,16 @@ def __init__(self) -> None:
self.FEISHU_SEND = glom(self.__config, 'feishu.send')
# 企业微信
- self.WECHAT_TALK_WEBHOOK = glom(self.__config, 'wechat_talk.webhook')
- self.WECHAT_TALK_PROXY = {
- 'http': glom(self.__config, 'wechat_talk.proxies.http')
- if glom(self.__config, 'wechat_talk.proxies.http') != ''
+ self.WECHAT_WEBHOOK = glom(self.__config, 'wechat.webhook')
+ self.WECHAT_PROXY = {
+ 'http': glom(self.__config, 'wechat.proxies.http')
+ if glom(self.__config, 'wechat.proxies.http') != ''
else None,
- 'https': glom(self.__config, 'wechat_talk.proxies.https')
- if glom(self.__config, 'wechat_talk.proxies.https') != ''
+ 'https': glom(self.__config, 'wechat.proxies.https')
+ if glom(self.__config, 'wechat.proxies.https') != ''
else None,
}
- self.WECHAT_TALK_REPORT_SEND = glom(self.__config, 'wechat_talk.send_report')
+ self.WECHAT_SEND = glom(self.__config, 'wechat.send')
# 请求发送
self.REQUEST_TIMEOUT = glom(self.__config, 'request.timeout')
diff --git a/httpfpt/run.py b/httpfpt/run.py
index 0160e65..9a48744 100644
--- a/httpfpt/run.py
+++ b/httpfpt/run.py
@@ -29,7 +29,7 @@
from httpfpt.utils.send_report.dingding import DingDing
from httpfpt.utils.send_report.email import SendEmail
from httpfpt.utils.send_report.feishu import FeiShu
-from httpfpt.utils.send_report.wechat import Wechat
+from httpfpt.utils.send_report.wechat import WeChat
from httpfpt.utils.time_control import get_current_time
@@ -140,8 +140,8 @@ def startup(
if config.FEISHU_SEND:
FeiShu(test_result).send()
- if config.WECHAT_TALK_REPORT_SEND:
- Wechat(test_result).send()
+ if config.WECHAT_SEND:
+ WeChat(test_result).send()
if allure:
if not os.path.exists(ALLURE_REPORT_ENV_FILE):
diff --git a/httpfpt/utils/send_report/wechat.py b/httpfpt/utils/send_report/wechat.py
index 911b77b..50af58a 100644
--- a/httpfpt/utils/send_report/wechat.py
+++ b/httpfpt/utils/send_report/wechat.py
@@ -5,7 +5,7 @@
from httpfpt.core.get_conf import config
-class Wechat:
+class WeChat:
def __init__(self, content: dict):
self.content = content
@@ -18,35 +18,23 @@ def send(self) -> None:
data = {
'msgtype': 'markdown',
'markdown': {
- "content": "# {}\n"
- "> 👤 测试人员:**{}**\n"
- "> 🤖 测试结果:**{}**\n"
- "> ✅ 通过用例: **{}**\n"
- "> 🔧 失败用例: **{}**\n"
- "> ❌ 错误用例: **{}**\n"
- "> ⚠️ 跳过用例: **{}**\n"
- "> 🈴 总数用例: **{}**\n"
- "> ⌛ 开始时间: **{}**\n"
- "> ⏱️ 执行耗时: **{}**\n"
- "> ➡️ 查看报告: [点击跳转](https://foryourself)".format(
- config.TEST_REPORT_TITLE,
- config.TESTER_NAME,
- self.content["result"],
- self.content["passed"],
- self.content['failed'],
- self.content['error'],
- self.content['skipped'],
- self.content['total'],
- self.content['started_time'],
- self.content['elapsed'],
- )
+ 'content': f"# {config.TEST_REPORT_TITLE}\n"
+ f"> 👤 测试人员: **{config.TESTER_NAME}**\n"
+ f"> 🤖 测试结果: **{self.content['result']}**\n"
+ f"> ✅ 通过用例: **{self.content['passed']}**\n"
+ f"> 🔧 失败用例: **{self.content['failed']}**\n"
+ f"> ❌ 错误用例: **{self.content['error']}**\n"
+ f"> ⚠️ 跳过用例: **{self.content['skipped']}**\n"
+ f"> ⌛ 开始时间: **{self.content['started_time']}**\n"
+ f"> ⏱️ 执行耗时: **{self.content['elapsed']}**\n"
+ "> ➡️ 查看报告: [点击跳转](https://foryourself)"
},
}
response = requests.session().post(
- url=config.WECHAT_TALK_WEBHOOK,
+ url=config.WECHAT_WEBHOOK,
json=data,
headers=headers,
- proxies=config.WECHAT_TALK_PROXY, # type: ignore
+ proxies=config.WECHAT_PROXY, # type: ignore
)
response.raise_for_status()
except Exception as e: