mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
fix(接口测试): 接口定义不传版本参数保存失败
This commit is contained in:
parent
fc4e678645
commit
1665206b38
@ -186,6 +186,7 @@ public class ApiDefinitionService {
|
||||
ProjectService.checkResourceExist(request.getProjectId());
|
||||
ApiDefinition apiDefinition = new ApiDefinition();
|
||||
BeanUtils.copyBean(apiDefinition, request);
|
||||
apiDefinition.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId())));
|
||||
checkAddExist(apiDefinition);
|
||||
checkResponseNameCode(request.getResponse());
|
||||
apiDefinition.setId(IDGenerator.nextStr());
|
||||
@ -197,7 +198,6 @@ public class ApiDefinitionService {
|
||||
apiDefinition.setUpdateUser(userId);
|
||||
apiDefinition.setCreateTime(System.currentTimeMillis());
|
||||
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
||||
apiDefinition.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId())));
|
||||
apiDefinition.setRefId(apiDefinition.getId());
|
||||
if (CollectionUtils.isNotEmpty(request.getTags())) {
|
||||
apiDefinition.setTags(request.getTags());
|
||||
|
@ -248,8 +248,11 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||
request.setPath("/api/admin/posts");
|
||||
request.setUploadFileIds(null);
|
||||
request.setLinkFileIds(null);
|
||||
String versionId = request.getVersionId();
|
||||
request.setVersionId(null);
|
||||
mvcResult = this.requestPostWithOkAndReturn(ADD, request);
|
||||
resultData = getResultData(mvcResult, ApiDefinition.class);
|
||||
request.setVersionId(versionId);
|
||||
assertAddApiDefinition(request, msHttpElement, resultData.getId());
|
||||
|
||||
testHandleFileAssociationUpgrade();
|
||||
|
Loading…
Reference in New Issue
Block a user