-
-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from yaming116/add-wechat
feat: 添加微信机器人和补充单测
- Loading branch information
Showing
7 changed files
with
202 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
sonic-server-controller/src/test/java/org/cloud/sonic/controller/BaseUnit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.cloud.sonic.controller; | ||
|
||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
@SpringBootTest(classes = ControllerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@AutoConfigureMockMvc | ||
// 单元测试读取dev配置文件 | ||
@ActiveProfiles | ||
public class BaseUnit { | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
sonic-server-controller/src/test/java/org/cloud/sonic/controller/tools/RobotTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.cloud.sonic.controller.tools; | ||
|
||
import org.cloud.sonic.controller.BaseUnit; | ||
import org.cloud.sonic.controller.models.interfaces.RobotType; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
public class RobotTest extends BaseUnit { | ||
|
||
@Autowired | ||
RobotMsgTool robotMsgTool; | ||
|
||
private String wechatToken = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx"; | ||
|
||
private String feishuToken = "https://open.feishu.cn/open-apis/bot/v2/hook/xxx"; | ||
@Test | ||
public void sendDayReportMessage() { | ||
robotMsgTool.sendDayReportMessage(wechatToken, "" ,1, "2", | ||
"1", "2" , 1,2,3, RobotType.WeChat); | ||
} | ||
|
||
@Test | ||
public void sendDayReportMessage2() { | ||
robotMsgTool.sendDayReportMessage(wechatToken, "" ,1, "2", | ||
"1", "2" , 1,0,0, RobotType.WeChat); | ||
} | ||
|
||
@Test | ||
public void testSendErrorDevice1() { | ||
robotMsgTool.sendErrorDevice(wechatToken, "", RobotType.WeChat, 1, 80,"111"); | ||
} | ||
|
||
|
||
@Test | ||
public void testSendErrorDevice2() { | ||
robotMsgTool.sendErrorDevice(wechatToken, "", RobotType.WeChat, 2, 80,"111"); | ||
} | ||
|
||
@Test | ||
public void testSendErrorDeviceFeishu() { | ||
robotMsgTool.sendErrorDevice(feishuToken, "", RobotType.FeiShu, 1, 80,"测试"); | ||
} | ||
|
||
@Test | ||
public void testSendErrorDeviceFeishu2() { | ||
robotMsgTool.sendErrorDevice(feishuToken, "", RobotType.FeiShu, 2, 80,"测试"); | ||
} | ||
|
||
|
||
@Test | ||
public void sendWeekReportMessage() { | ||
robotMsgTool.sendWeekReportMessage(wechatToken, "" ,1, "2", | ||
"1", "2" , 1,0,0,100, RobotType.WeChat); | ||
} | ||
|
||
@Test | ||
public void sendResultFinishReport() { | ||
robotMsgTool.sendResultFinishReport(wechatToken, "","111", 1,1,1,1, | ||
1,RobotType.WeChat); | ||
} | ||
} |