fix(接口测试): 修复场景步骤另存用例问题

--bug=1024018 --user=赵勇 [接口测试]github#22473接口自动化中复制的API另存为CASE后,在新场景中引用该CASE,保存场景再次进入编辑,显示“原始API不存在” https://www.tapd.cn/55049933/s/1345838

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-03-07 10:25:58 +08:00 committed by fit2-zhao
parent cbe63d6828
commit d05fbea7e8
1 changed files with 4 additions and 0 deletions

View File

@ -438,6 +438,10 @@ public class ApiTestCaseService {
private ApiTestCase createTest(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
checkNameExist(request);
ApiFileUtil.createBodyFiles(request.getId(), bodyFiles);
if (request.getRequest() != null) {
request.getRequest().setRefType(MsHashTreeConstants.CASE);
request.getRequest().setEnable(true);
}
request.setRequest(tcpApiParamService.parseMsTestElement(request.getRequest()));
if (StringUtils.isNotBlank(request.getSourceIdByCopy())) {
ApiFileUtil.copyBdyFile(request.getSourceIdByCopy(), request.getId());