refactor(接口测试): 获取项目模板是否启用接口,去除无用的模版类型
--bug=1044851 --user=陈建星 【系统设置】组织-模版的接口:/organization/template/enable/config/100001?_t=1723022622529返回信息错误 https://www.tapd.cn/55049933/s/1561263
This commit is contained in:
parent
82769d360a
commit
d99bde8ba9
|
@ -400,7 +400,7 @@ public class ProjectTemplateService extends BaseTemplateService {
|
||||||
ProjectService.checkResourceExist(projectId);
|
ProjectService.checkResourceExist(projectId);
|
||||||
ProjectDTO project = projectService.getProjectById(projectId);
|
ProjectDTO project = projectService.getProjectById(projectId);
|
||||||
HashMap<String, Boolean> templateEnableConfig = new HashMap<>();
|
HashMap<String, Boolean> templateEnableConfig = new HashMap<>();
|
||||||
Arrays.stream(TemplateScene.values())
|
List.of(TemplateScene.FUNCTIONAL, TemplateScene.BUG)
|
||||||
.forEach(scene ->
|
.forEach(scene ->
|
||||||
templateEnableConfig.put(scene.name(), !isOrganizationTemplateEnable(project.getOrganizationId(), scene.name())));
|
templateEnableConfig.put(scene.name(), !isOrganizationTemplateEnable(project.getOrganizationId(), scene.name())));
|
||||||
return templateEnableConfig;
|
return templateEnableConfig;
|
||||||
|
|
|
@ -493,7 +493,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
||||||
// @@请求成功
|
// @@请求成功
|
||||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID);
|
MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID);
|
||||||
Map resultData = getResultData(mvcResult, Map.class);
|
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()));
|
Assertions.assertFalse((Boolean) resultData.get(TemplateScene.FUNCTIONAL.name()));
|
||||||
changeOrgTemplateEnable(false);
|
changeOrgTemplateEnable(false);
|
||||||
mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID);
|
mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_PROJECT_ID);
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class OrganizationTemplateService extends BaseTemplateService {
|
||||||
public Map<String, Boolean> getOrganizationTemplateEnableConfig(String organizationId) {
|
public Map<String, Boolean> getOrganizationTemplateEnableConfig(String organizationId) {
|
||||||
OrganizationService.checkResourceExist(organizationId);
|
OrganizationService.checkResourceExist(organizationId);
|
||||||
HashMap<String, Boolean> templateEnableConfig = new HashMap<>();
|
HashMap<String, Boolean> templateEnableConfig = new HashMap<>();
|
||||||
Arrays.stream(TemplateScene.values())
|
List.of(TemplateScene.FUNCTIONAL, TemplateScene.BUG)
|
||||||
.forEach(scene ->
|
.forEach(scene ->
|
||||||
templateEnableConfig.put(scene.name(), isOrganizationTemplateEnable(organizationId, scene.name())));
|
templateEnableConfig.put(scene.name(), isOrganizationTemplateEnable(organizationId, scene.name())));
|
||||||
return templateEnableConfig;
|
return templateEnableConfig;
|
||||||
|
|
|
@ -521,7 +521,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
|
||||||
// @@请求成功
|
// @@请求成功
|
||||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);
|
MvcResult mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);
|
||||||
Map resultData = getResultData(mvcResult, Map.class);
|
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()));
|
Assertions.assertTrue((Boolean) resultData.get(TemplateScene.FUNCTIONAL.name()));
|
||||||
changeOrgTemplateEnable(false);
|
changeOrgTemplateEnable(false);
|
||||||
mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);
|
mvcResult = this.requestGetWithOkAndReturn(ENABLE_CONFIG, DEFAULT_ORGANIZATION_ID);
|
||||||
|
|
Loading…
Reference in New Issue