refactor(接口测试): 获取项目模板是否启用接口,去除无用的模版类型

--bug=1044851 --user=陈建星 【系统设置】组织-模版的接口:/organization/template/enable/config/100001?_t=1723022622529返回信息错误 https://www.tapd.cn/55049933/s/1561263
This commit is contained in:
AgAngle 2024-08-12 17:50:02 +08:00 committed by Craftsman
parent 82769d360a
commit d99bde8ba9
4 changed files with 4 additions and 4 deletions

View File

@ -400,7 +400,7 @@ public class ProjectTemplateService extends BaseTemplateService {
ProjectService.checkResourceExist(projectId);
ProjectDTO project = projectService.getProjectById(projectId);
HashMap<String, Boolean> templateEnableConfig = new HashMap<>();
Arrays.stream(TemplateScene.values())
List.of(TemplateScene.FUNCTIONAL, TemplateScene.BUG)
.forEach(scene ->
templateEnableConfig.put(scene.name(), !isOrganizationTemplateEnable(project.getOrganizationId(), scene.name())));
return templateEnableConfig;

View File

@ -493,7 +493,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
// @@请求成功
MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID);
Map resultData = getResultData(mvcResult, Map.class);
Assertions.assertEquals(resultData.size(), TemplateScene.values().length);
Assertions.assertEquals(resultData.size(), 2);
Assertions.assertFalse((Boolean) resultData.get(TemplateScene.FUNCTIONAL.name()));
changeOrgTemplateEnable(false);
mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID);

View File

@ -218,7 +218,7 @@ public class OrganizationTemplateService extends BaseTemplateService {
public Map<String, Boolean> getOrganizationTemplateEnableConfig(String organizationId) {
OrganizationService.checkResourceExist(organizationId);
HashMap<String, Boolean> templateEnableConfig = new HashMap<>();
Arrays.stream(TemplateScene.values())
List.of(TemplateScene.FUNCTIONAL, TemplateScene.BUG)
.forEach(scene ->
templateEnableConfig.put(scene.name(), isOrganizationTemplateEnable(organizationId, scene.name())));
return templateEnableConfig;

View File

@ -521,7 +521,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
// @@请求成功
MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);
Map resultData = getResultData(mvcResult, Map.class);
Assertions.assertEquals(resultData.size(), TemplateScene.values().length);
Assertions.assertEquals(resultData.size(), 2);
Assertions.assertTrue((Boolean) resultData.get(TemplateScene.FUNCTIONAL.name()));
changeOrgTemplateEnable(false);
mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);