feat: 修改从gitea上获取配置的逻辑
All checks were successful
Redis序列化结构检查 / redis-schema-check (push) Has been skipped
All checks were successful
Redis序列化结构检查 / redis-schema-check (push) Has been skipped
This commit is contained in:
@@ -38,4 +38,28 @@ class ConfigLoaderTest {
|
||||
assertFalse(config.getNotify().isEnabled());
|
||||
assertTrue(config.getBlockSeverities().contains("P2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadsWebhookUrlFromConfig(@org.junit.jupiter.api.io.TempDir Path tmp) throws IOException {
|
||||
Path cfg = tmp.resolve("biz.yaml");
|
||||
Files.write(cfg, ("notify:\n"
|
||||
+ " webhook_url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test\n"
|
||||
).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
CheckerConfig config = ConfigLoader.load(cfg);
|
||||
assertEquals("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test",
|
||||
config.getNotify().getWebhookUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
void legacyWebhookEnvUrlStillWorks(@org.junit.jupiter.api.io.TempDir Path tmp) throws IOException {
|
||||
Path cfg = tmp.resolve("biz.yaml");
|
||||
Files.write(cfg, ("notify:\n"
|
||||
+ " webhook_env: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=legacy\n"
|
||||
).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
CheckerConfig config = ConfigLoader.load(cfg);
|
||||
assertEquals("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=legacy",
|
||||
config.getNotify().getWebhookUrl());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user