fix(接口测试): 未规划模块下的接口详情没有展示模块名称
--bug=1045008 --user=陈建星 【接口测试】定义-预览-基本信息-所属模块显示错误,一直显示- https://www.tapd.cn/55049933/s/1564079
This commit is contained in:
parent
cbbe0c9bdc
commit
ed115767c3
|
@ -921,6 +921,8 @@ public class ApiDefinitionService extends MoveNodeService {
|
|||
ApiDefinitionModule apiDefinitionModule = apiDefinitionModuleMapper.selectByPrimaryKey(apiDefinitionDTO.getModuleId());
|
||||
if (apiDefinitionModule != null) {
|
||||
apiDefinitionDTO.setModuleName(apiDefinitionModule.getName());
|
||||
} else {
|
||||
apiDefinitionDTO.setModuleName(Translator.get("api_unplanned_request"));
|
||||
}
|
||||
return apiDefinitionDTO;
|
||||
}
|
||||
|
|
|
@ -450,6 +450,9 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
Assertions.assertEquals(msHTTPElement.getModuleId(), apiDefinition.getModuleId());
|
||||
Assertions.assertEquals(msHTTPElement.getNum(), apiDefinition.getNum());
|
||||
|
||||
assertionModuleName(apiDefinitionDTO);
|
||||
copyApiDefinitionDTO.setModuleName(apiDefinitionDTO.getModuleName());
|
||||
|
||||
Assertions.assertEquals(apiDefinitionDTO, copyApiDefinitionDTO);
|
||||
|
||||
assertErrorCode(this.requestGet(GET + "111"), ApiResultCode.API_DEFINITION_NOT_EXIST);
|
||||
|
@ -458,6 +461,16 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_READ, GET + apiDefinition.getId());
|
||||
}
|
||||
|
||||
private void assertionModuleName(ApiDefinitionDTO apiDefinitionDTO) {
|
||||
// 判断模块名是否正确
|
||||
ApiDefinitionModule apiDefinitionModule = apiDefinitionModuleMapper.selectByPrimaryKey(apiDefinitionDTO.getModuleId());
|
||||
if (apiDefinitionModule == null) {
|
||||
Assertions.assertEquals(apiDefinitionDTO.getModuleName(), Translator.get("api_unplanned_request"));
|
||||
} else {
|
||||
Assertions.assertEquals(apiDefinitionDTO.getModuleName(), apiDefinitionModule.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@Sql(scripts = {"/dml/init_api_definition.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED))
|
||||
|
@ -924,12 +937,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
|
||||
Assertions.assertEquals(apiDefinitionDTO.getCaseTotal(), apiTestCases.size());
|
||||
// 判断模块名是否正确
|
||||
ApiDefinitionModule apiDefinitionModule = apiDefinitionModuleMapper.selectByPrimaryKey(apiDefinitionDTO.getModuleId());
|
||||
if (apiDefinitionModule == null) {
|
||||
Assertions.assertEquals(apiDefinitionDTO.getModuleName(), Translator.get("api_unplanned_request"));
|
||||
} else {
|
||||
Assertions.assertEquals(apiDefinitionDTO.getModuleName(), apiDefinitionModule.getName());
|
||||
}
|
||||
assertionModuleName(apiDefinitionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue