fix(接口测试): 接口导入swagger导入不增加case

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-09-06 11:09:25 +08:00 committed by xiaomeinvG
parent 321350f17a
commit 7e1c31e429

View File

@ -932,7 +932,10 @@ public class ApiDefinitionService {
} else { } else {
apiDefinition.setVersionId(apiTestImportRequest.getDefaultVersion()); apiDefinition.setVersionId(apiTestImportRequest.getDefaultVersion());
} }
caseList = setRequestAndAddNewCase(apiDefinition, caseList, true);
boolean newCreate = !StringUtils.equals(ApiImportPlatform.Swagger2.name(), apiDefinitionImportParamDTO.getApiTestImportRequest().getPlatform())
&& !StringUtils.isNotBlank(apiDefinitionImportParamDTO.getApiTestImportRequest().getSwaggerUrl());
caseList = setRequestAndAddNewCase(apiDefinition, caseList, newCreate);
reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum()); reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum());
batchMapper.insert(apiDefinition); batchMapper.insert(apiDefinition);
List<ApiTestCaseDTO> apiTestCaseDTOS = importCase(apiDefinition, apiTestCaseMapper, caseList); List<ApiTestCaseDTO> apiTestCaseDTOS = importCase(apiDefinition, apiTestCaseMapper, caseList);
@ -1067,7 +1070,9 @@ public class ApiDefinitionService {
} }
reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum()); reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum());
caseList = setRequestAndAddNewCase(apiDefinition, caseList, true); boolean newCreate = !StringUtils.equals(ApiImportPlatform.Swagger2.name(), apiDefinitionImportParamDTO.getApiTestImportRequest().getPlatform())
&& !StringUtils.isNotBlank(apiDefinitionImportParamDTO.getApiTestImportRequest().getSwaggerUrl());
caseList = setRequestAndAddNewCase(apiDefinition, caseList, newCreate);
batchMapper.insert(apiDefinition); batchMapper.insert(apiDefinition);
ApiDefinitionResult apiDefinitionResult = getApiDefinitionResult(apiDefinition, false); ApiDefinitionResult apiDefinitionResult = getApiDefinitionResult(apiDefinition, false);
apiImportSendNoticeDTO.setApiDefinitionResult(apiDefinitionResult); apiImportSendNoticeDTO.setApiDefinitionResult(apiDefinitionResult);