From 7a6ede29e7e1ff4d0b5d963ff579bcd6c0009b0a Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 23 Aug 2024 18:19:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE=E5=90=8C=E6=AD=A5=E9=9C=80?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectApplicationControllerTests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java index 1724399932..b1df71fcc4 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java @@ -452,6 +452,13 @@ public class ProjectApplicationControllerTests extends BaseTest { Assertions.assertNotNull(updateResultHolder); ProjectApplication afterRequest = creatRequest(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CASE_ENABLE.name(), "true"); this.requestPost(CASE_UPDATE_URL, afterRequest); + Map falseConfigs = mockCaseFalseRelatedTestData(); + mvcResult = this.requestPostWithOkAndReturn(UPDATE_CASE_RELATED_CONFIG_URL + "/project_application_test_id", falseConfigs); + // 获取返回值 + returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + resultHolder = JSON.parseObject(returnData, ResultHolder.class); + // 返回请求正常 + Assertions.assertNotNull(resultHolder); } private Map mockRelatedTestData() { @@ -459,6 +466,18 @@ public class ProjectApplicationControllerTests extends BaseTest { Map configs = new HashMap<>(); configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig); configs.put("CASE_ENABLE", "true"); + configs.put("SYNC_ENABLE", "true"); + configs.put("CRON_EXPRESSION", "0 0 0 * * ?"); + return configs; + } + + private Map mockCaseFalseRelatedTestData() { + String jsonConfig = "{\"jiraKey\":\"111\",\"jiraIssueTypeId\":\"10086\",\"jiraStoryTypeId\":\"10010\"}"; + Map configs = new HashMap<>(); + configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig); + configs.put("CASE_ENABLE", "false"); + configs.put("SYNC_ENABLE", "true"); + configs.put("CRON_EXPRESSION", "0 0 0/1 * * ?"); return configs; }