fix(接口测试): 修复拖拽请求没有成功的缺陷

--bug=1037018 --user=王孝刚 【接口测试】接口调试模块树,移动请求没有成功
https://www.tapd.cn/55049933/s/1473198
This commit is contained in:
wxg0103 2024-03-12 12:22:45 +08:00 committed by 刘瑞斌
parent 8ac2f5ad5d
commit 8065a5ac90
8 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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());

View File

@ -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());

View File

@ -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();

View File

@ -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());

View File

@ -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");

View File

@ -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, // APIidid
});
}

View File

@ -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, // APIidid
});
}