fix(修复:创建场景出现空白气泡弹窗、从mock复制出来的环境 会导致执行测试时默认带上mock的路径):

修复:创建场景出现空白气泡弹窗、从mock复制出来的环境 会导致执行测试时默认带上mock的路径
This commit is contained in:
song-tianyang 2021-05-26 13:42:14 +08:00 committed by 刘瑞斌
parent bfca311bfd
commit 27fac113c9
3 changed files with 20 additions and 1 deletions

View File

@ -86,10 +86,27 @@ public class ApiTestEnvironmentService {
request.setCreateUser(SessionUtils.getUserId());
checkEnvironmentExist(request);
FileUtils.createFiles(request.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");
//检查Config判断isMock参数是否给True
request = this.updateConfig(request,false);
apiTestEnvironmentMapper.insert(request);
return request.getId();
}
private ApiTestEnvironmentDTO updateConfig(ApiTestEnvironmentDTO request, boolean isMock) {
if(StringUtils.isNotEmpty(request.getConfig())){
try{
JSONObject configObj = JSONObject.parseObject(request.getConfig());
if(configObj.containsKey("httpConfig")){
JSONObject httpObj = configObj.getJSONObject("httpConfig");
httpObj.put("isMock",isMock);
}
request.setConfig(configObj.toJSONString());
}catch (Exception e){
}
}
return request;
}
public void update(ApiTestEnvironmentDTO apiTestEnvironment,List<MultipartFile> sslFiles) {
checkEnvironmentExist(apiTestEnvironment);
FileUtils.createFiles(apiTestEnvironment.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");

View File

@ -110,7 +110,7 @@
<el-col :span="6" class="ms-col-one ms-font">
<el-tooltip placement="top" effect="light">
<template v-slot:content>
<div>{{ currentScenario.name }}</div>
<div>{{ currentScenario.name === undefined || '' ? $t('api_test.scenario.name') : currentScenario.name }}</div>
</template>
<span class="scenario-name">
{{ currentScenario.name === undefined || '' ? $t('api_test.scenario.name') : currentScenario.name }}

View File

@ -70,6 +70,8 @@
}
},
copyEnvironment(environment) {
//
this.environmentSelected(environment);
this.currentEnvironment = environment;
if (!environment.id) {
this.$warning(this.$t('commons.please_save'));