refactor(接口测试): 分享报告的url加入白名单
This commit is contained in:
parent
5dbb2ed5fe
commit
fde19736dd
|
@ -79,6 +79,11 @@ public class FilterChainUtils {
|
|||
filterChainDefinitionMap.put("/templates/user_import_en.xlsx", "anon");
|
||||
filterChainDefinitionMap.put("/templates/user_import_cn.xlsx", "anon");
|
||||
|
||||
//分享报告接口
|
||||
filterChainDefinitionMap.put("/api/report/case/share/**", "anon");
|
||||
filterChainDefinitionMap.put("/api/report/scenario/share/**", "anon");
|
||||
filterChainDefinitionMap.put("/api/report/share/get/**", "anon");
|
||||
|
||||
return filterChainDefinitionMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ApiReportController {
|
|||
return apiReportService.get(id);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{shareId}/{reportId}")
|
||||
@GetMapping("/share/{shareId}/{reportId}")
|
||||
@Operation(summary = "接口测试-接口报告-分享报告获取")
|
||||
public ApiReportDTO get(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
ShareInfo shareInfo = apiReportShareService.checkResource(shareId);
|
||||
|
@ -99,7 +99,7 @@ public class ApiReportController {
|
|||
return apiReportService.getDetail(stepId, reportId);
|
||||
}
|
||||
|
||||
@GetMapping("/get/detail/{shareId}/{reportId}/{stepId}")
|
||||
@GetMapping("/share/detail/{shareId}/{reportId}/{stepId}")
|
||||
public List<ApiReportDetailDTO> selectReportContent(@PathVariable String shareId,
|
||||
@PathVariable String reportId,
|
||||
@PathVariable String stepId) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ApiScenarioReportController {
|
|||
return apiScenarioReportService.get(id);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{shareId}/{reportId}")
|
||||
@GetMapping("/share/{shareId}/{reportId}")
|
||||
@Operation(summary = "接口测试-接口报告-分享报告获取")
|
||||
public ApiScenarioReportDTO get(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
ShareInfo shareInfo = apiReportShareService.checkResource(shareId);
|
||||
|
@ -99,7 +99,7 @@ public class ApiScenarioReportController {
|
|||
return apiScenarioReportService.getDetail(reportId, stepId);
|
||||
}
|
||||
|
||||
@GetMapping("/get/detail/{shareId}/{reportId}/{stepId}")
|
||||
@GetMapping("/share/detail/{shareId}/{reportId}/{stepId}")
|
||||
public List<ApiScenarioReportDetailDTO> selectReportContent(@PathVariable String shareId,
|
||||
@PathVariable String reportId,
|
||||
@PathVariable String stepId) {
|
||||
|
|
|
@ -427,7 +427,7 @@ public class ApiReportControllerTests extends BaseTest {
|
|||
Assertions.assertNotNull(shareInfoDTO.getShareUrl());
|
||||
Assertions.assertNotNull(shareInfoDTO.getId());
|
||||
String shareId = shareInfoDTO.getId();
|
||||
MvcResult mvcResult1 = this.requestGetWithOk(GET + shareId + "/" + "test-report-id")
|
||||
MvcResult mvcResult1 = this.requestGetWithOk(BASIC+ "/share/" + shareId + "/" + "test-report-id")
|
||||
.andReturn();
|
||||
ApiReportDTO apiReportDTO = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResult1).get("data")), ApiReportDTO.class);
|
||||
Assertions.assertNotNull(apiReportDTO);
|
||||
|
@ -440,7 +440,7 @@ public class ApiReportControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
mvcResult = this.requestGetWithOk(DETAIL + shareId + "/" + "test-report-id" + "/" + "test-report-step-id1")
|
||||
mvcResult = this.requestGetWithOk(BASIC+ "/share/detail/" + shareId + "/" + "test-report-id" + "/" + "test-report-step-id1")
|
||||
.andReturn();
|
||||
List<ApiReportDetailDTO> data = ApiDataUtils.parseArray(JSON.toJSONString(parseResponse(mvcResult).get("data")), ApiReportDetailDTO.class);
|
||||
Assertions.assertNotNull(data);
|
||||
|
@ -449,7 +449,7 @@ public class ApiReportControllerTests extends BaseTest {
|
|||
shareInfo1.setUpdateTime(1702950953000L);
|
||||
shareInfoMapper.updateByPrimaryKey(shareInfo1);
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET + shareId + "/" + "test-report-id"))
|
||||
mockMvc.perform(getRequestBuilder(BASIC+ "/share/" + shareId + "/" + "test-report-id"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
|
@ -478,7 +478,7 @@ public class ApiReportControllerTests extends BaseTest {
|
|||
projectApplicationMapper.insert(projectApplication);
|
||||
}
|
||||
|
||||
mvcResult1 = this.requestGetWithOk(GET + shareId + "/" + "test-report-id")
|
||||
mvcResult1 = this.requestGetWithOk(BASIC+ "/share/" + shareId + "/" + "test-report-id")
|
||||
.andReturn();
|
||||
apiReportDTO = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResult1).get("data")), ApiReportDTO.class);
|
||||
Assertions.assertNotNull(apiReportDTO);
|
||||
|
@ -489,7 +489,7 @@ public class ApiReportControllerTests extends BaseTest {
|
|||
shareInfo1.setUpdateTime(1702950953000L);
|
||||
shareInfoMapper.updateByPrimaryKey(shareInfo1);
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET + shareId + "/" + "test-report-id"))
|
||||
mockMvc.perform(getRequestBuilder(BASIC+ "/share/" + shareId + "/" + "test-report-id"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
|
|||
Assertions.assertNotNull(shareInfoDTO.getShareUrl());
|
||||
Assertions.assertNotNull(shareInfoDTO.getId());
|
||||
String shareId = shareInfoDTO.getId();
|
||||
MvcResult mvcResult1 = this.requestGetWithOk(GET + shareId + "/" + "test-scenario-report-id")
|
||||
MvcResult mvcResult1 = this.requestGetWithOk(BASIC+ "/share/" + shareId + "/" + "test-scenario-report-id")
|
||||
.andReturn();
|
||||
ApiScenarioReportDTO apiReportDTO = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResult1).get("data")), ApiScenarioReportDTO.class);
|
||||
Assertions.assertNotNull(apiReportDTO);
|
||||
|
@ -400,7 +400,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
mvcResult = this.requestGetWithOk(DETAIL + shareId + "/" + "test-scenario-report-id" + "/" + "test-scenario-report-step-id1")
|
||||
mvcResult = this.requestGetWithOk(BASIC+ "/share/detail/" + shareId + "/" + "test-scenario-report-id" + "/" + "test-scenario-report-step-id1")
|
||||
.andReturn();
|
||||
List<ApiScenarioReportDetailDTO> data = ApiDataUtils.parseArray(JSON.toJSONString(parseResponse(mvcResult).get("data")), ApiScenarioReportDetailDTO.class);
|
||||
Assertions.assertNotNull(data);
|
||||
|
@ -409,7 +409,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
|
|||
shareInfo1.setUpdateTime(1702950953000L);
|
||||
shareInfoMapper.updateByPrimaryKey(shareInfo1);
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET + shareId + "/" + "test-scenario-report-id"))
|
||||
mockMvc.perform(getRequestBuilder(BASIC+ "/share/" + shareId + "/" + "test-scenario-report-id"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
|
@ -436,7 +436,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
|
|||
projectApplicationMapper.insert(projectApplication);
|
||||
}
|
||||
|
||||
mvcResult1 = this.requestGetWithOk(GET + shareId + "/" + "test-scenario-report-id")
|
||||
mvcResult1 = this.requestGetWithOk(BASIC+ "/share/" + shareId + "/" + "test-scenario-report-id")
|
||||
.andReturn();
|
||||
apiReportDTO = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResult1).get("data")), ApiScenarioReportDTO.class);
|
||||
Assertions.assertNotNull(apiReportDTO);
|
||||
|
@ -447,7 +447,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
|
|||
shareInfo1.setUpdateTime(1702950953000L);
|
||||
shareInfoMapper.updateByPrimaryKey(shareInfo1);
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET + shareId + "/" + "test-scenario-report-id"))
|
||||
mockMvc.perform(getRequestBuilder(BASIC+ "/share/" + shareId + "/" + "test-scenario-report-id"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue