mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 12:39:12 +08:00
fix(接口测试): 修复拖拽请求没有成功的缺陷
--bug=1037018 --user=王孝刚 【接口测试】接口调试模块树,移动请求没有成功 https://www.tapd.cn/55049933/s/1473198
This commit is contained in:
parent
8ac2f5ad5d
commit
8065a5ac90
@ -29,7 +29,7 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements
|
||||
private boolean appendTag = false;
|
||||
@Schema(description = "环境id")
|
||||
@Size(max = 50, message = "{api_test_case.env_id.length_range}")
|
||||
private String envId;
|
||||
private String environmentId;
|
||||
@Schema(description = "用例状态")
|
||||
@Size(max = 20, message = "{api_test_case.status.length_range}")
|
||||
private String status;
|
||||
|
@ -238,7 +238,7 @@ public class ApiDebugService extends MoveNodeService {
|
||||
}
|
||||
|
||||
public void editPos(ApiEditPosRequest request, String userId) {
|
||||
ApiDebug apiDebug = checkResourceExist(request.getTargetId());
|
||||
ApiDebug apiDebug = checkResourceExist(request.getMoveId());
|
||||
if (!StringUtils.equals(request.getModuleId(), apiDebug.getModuleId())) {
|
||||
checkModuleExist(request.getModuleId());
|
||||
apiDebug.setModuleId(request.getModuleId());
|
||||
|
@ -1057,7 +1057,7 @@ public class ApiDefinitionService extends MoveNodeService {
|
||||
}
|
||||
|
||||
public void editPos(ApiEditPosRequest request, String userId) {
|
||||
ApiDefinition apiDefinition = checkApiDefinition(request.getTargetId());
|
||||
ApiDefinition apiDefinition = checkApiDefinition(request.getMoveId());
|
||||
if (!StringUtils.equals(request.getModuleId(), apiDefinition.getModuleId())) {
|
||||
checkModuleExist(request.getModuleId());
|
||||
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -454,7 +454,7 @@ public class ApiTestCaseService extends MoveNodeService {
|
||||
case PRIORITY -> batchUpdatePriority(example, updateCase, request.getPriority(), mapper);
|
||||
case STATUS -> batchUpdateStatus(example, updateCase, request.getStatus(), mapper);
|
||||
case TAGS -> batchUpdateTags(example, updateCase, request, ids, mapper);
|
||||
case ENVIRONMENT -> batchUpdateEnvironment(example, updateCase, request.getEnvId(), mapper);
|
||||
case ENVIRONMENT -> batchUpdateEnvironment(example, updateCase, request.getEnvironmentId(), mapper);
|
||||
default -> throw new MSException(Translator.get("batch_edit_type_error"));
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
|
@ -419,7 +419,7 @@ public class ApiDebugControllerTests extends BaseTest {
|
||||
request.setMoveMode("AFTER");
|
||||
requestPost("edit/pos", request).andExpect(status().isOk());
|
||||
// @@请求成功
|
||||
request.setMoveId(anotherAddApiDebug.getId());
|
||||
request.setTargetId(anotherAddApiDebug.getId());
|
||||
this.requestPostWithOk("edit/pos", request);
|
||||
// 校验请求成功数据
|
||||
ApiDebug apiDebug = apiDebugMapper.selectByPrimaryKey(addApiDebug.getId());
|
||||
|
@ -882,16 +882,16 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||
EnvironmentExample environmentExample = new EnvironmentExample();
|
||||
environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true);
|
||||
List<Environment> environments = environmentMapper.selectByExample(environmentExample);
|
||||
request.setEnvId(environments.get(0).getId());
|
||||
request.setEnvironmentId(environments.get(0).getId());
|
||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||
//判断数据的环境是不是environments.get(0).getId()
|
||||
caseList = apiTestCaseMapper.selectByExample(example);
|
||||
caseList.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.get(0).getId()));
|
||||
//环境数据为空
|
||||
request.setEnvId(null);
|
||||
request.setEnvironmentId(null);
|
||||
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
||||
//环境不存在
|
||||
request.setEnvId("111");
|
||||
request.setEnvironmentId("111");
|
||||
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
||||
//类型错误
|
||||
request.setType("111");
|
||||
|
@ -416,7 +416,7 @@
|
||||
projectId: appStore.currentProjectId,
|
||||
moveMode: dropPositionMap[dropPosition],
|
||||
moveId: dragNode.id,
|
||||
targetId: dropNode.id,
|
||||
targetId: dropNode.type === 'MODULE' ? dragNode.id : dropNode.id,
|
||||
moduleId: dropNode.type === 'API' ? dropNode.parentId : dropNode.id, // 释放节点是 API,则传入它所属模块id;模块的话直接是模块id
|
||||
});
|
||||
}
|
||||
|
@ -555,7 +555,7 @@
|
||||
projectId: appStore.currentProjectId,
|
||||
moveMode: dropPositionMap[dropPosition],
|
||||
moveId: dragNode.id,
|
||||
targetId: dropNode.id,
|
||||
targetId: dropNode.type === 'MODULE' ? dragNode.id : dropNode.id,
|
||||
moduleId: dropNode.type === 'API' ? dropNode.parentId : dropNode.id, // 释放节点是 API,则传入它所属模块id;模块的话直接是模块id
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user