feat(测试计划): 批量导出获取报告ID集合参数

This commit is contained in:
song-cc-rock 2024-09-13 15:25:41 +08:00 committed by Craftsman
parent 560a251a48
commit d7b94fea51
4 changed files with 24 additions and 2 deletions

View File

@ -78,6 +78,14 @@ public class ApiReportController {
apiReportService.batchDelete(request, SessionUtils.getUserId()); apiReportService.batchDelete(request, SessionUtils.getUserId());
} }
@PostMapping("/batch-param")
@Operation(summary = "接口测试-接口报告-获取用例报告批量参数")
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
@RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_READ)
public List<String> batchParam(@Validated @RequestBody ApiReportBatchRequest request) {
return apiReportService.doSelectIds(request);
}
@GetMapping("/get/{id}") @GetMapping("/get/{id}")
@Operation(summary = "接口测试-接口报告-报告获取") @Operation(summary = "接口测试-接口报告-报告获取")
@CheckOwner(resourceId = "#id", resourceType = "api_report") @CheckOwner(resourceId = "#id", resourceType = "api_report")

View File

@ -78,6 +78,14 @@ public class ApiScenarioReportController {
apiScenarioReportService.batchDelete(request, SessionUtils.getUserId()); apiScenarioReportService.batchDelete(request, SessionUtils.getUserId());
} }
@PostMapping("/batch-param")
@Operation(summary = "接口测试-接口报告-获取场景报告批量参数")
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
@RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_READ)
public List<String> batchParam(@Validated @RequestBody ApiReportBatchRequest request) {
return apiScenarioReportService.doSelectIds(request);
}
@GetMapping("/get/{id}") @GetMapping("/get/{id}")
@Operation(summary = "接口测试-接口报告-报告获取") @Operation(summary = "接口测试-接口报告-报告获取")
@CheckOwner(resourceId = "#id", resourceType = "api_scenario_report") @CheckOwner(resourceId = "#id", resourceType = "api_scenario_report")

View File

@ -79,6 +79,7 @@ public class ApiReportControllerTests extends BaseTest {
private static final String DELETE = BASIC + "/delete/"; private static final String DELETE = BASIC + "/delete/";
private static final String GET = BASIC + "/get/"; private static final String GET = BASIC + "/get/";
private static final String BATCH_DELETE = BASIC + "/batch/delete"; private static final String BATCH_DELETE = BASIC + "/batch/delete";
private static final String BATCH_PARAM = BASIC + "/batch-param";
private static final String DETAIL = BASIC + "/get/detail/"; private static final String DETAIL = BASIC + "/get/detail/";
private static final String EXPORT_REPORT = BASIC + "/export/{0}"; private static final String EXPORT_REPORT = BASIC + "/export/{0}";
private static final String BATCH_EXPORT_REPORT = BASIC + "/batch-export"; private static final String BATCH_EXPORT_REPORT = BASIC + "/batch-export";
@ -189,7 +190,8 @@ public class ApiReportControllerTests extends BaseTest {
requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_READ, PAGE, request); requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_READ, PAGE, request);
} }
protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception { @Override
protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception {
return mockMvc.perform(getRequestBuilder(url, uriVariables)) return mockMvc.perform(getRequestBuilder(url, uriVariables))
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()); .andExpect(status().isOk());
@ -242,6 +244,7 @@ public class ApiReportControllerTests extends BaseTest {
Assertions.assertTrue(apiReport.getDeleted()); Assertions.assertTrue(apiReport.getDeleted());
request.setSelectAll(true); request.setSelectAll(true);
responsePost(BATCH_DELETE, request); responsePost(BATCH_DELETE, request);
responsePost(BATCH_PARAM, request);
// @@校验权限 // @@校验权限
requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_DELETE, BATCH_DELETE, request); requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_DELETE, BATCH_DELETE, request);
} }

View File

@ -86,6 +86,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
private static final String DELETE = BASIC + "/delete/"; private static final String DELETE = BASIC + "/delete/";
private static final String GET = BASIC + "/get/"; private static final String GET = BASIC + "/get/";
private static final String BATCH_DELETE = BASIC + "/batch/delete"; private static final String BATCH_DELETE = BASIC + "/batch/delete";
private static final String BATCH_PARAM = BASIC + "/batch-param";
private static final String DETAIL = BASIC + "/get/detail/"; private static final String DETAIL = BASIC + "/get/detail/";
private static final String EXPORT_REPORT = BASIC + "/export/{0}"; private static final String EXPORT_REPORT = BASIC + "/export/{0}";
private static final String BATCH_EXPORT_REPORT = BASIC + "/batch-export"; private static final String BATCH_EXPORT_REPORT = BASIC + "/batch-export";
@ -189,7 +190,8 @@ public class ApiScenarioReportControllerTests extends BaseTest {
requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_READ, PAGE, request); requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_READ, PAGE, request);
} }
protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception { @Override
protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception {
return mockMvc.perform(getRequestBuilder(url, uriVariables)) return mockMvc.perform(getRequestBuilder(url, uriVariables))
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()); .andExpect(status().isOk());
@ -242,6 +244,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
Assertions.assertTrue(apiReport.getDeleted()); Assertions.assertTrue(apiReport.getDeleted());
request.setSelectAll(true); request.setSelectAll(true);
responsePost(BATCH_DELETE, request); responsePost(BATCH_DELETE, request);
responsePost(BATCH_PARAM, request);
// @@校验权限 // @@校验权限
requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_DELETE, BATCH_DELETE, request); requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_DELETE, BATCH_DELETE, request);
} }