fix(修复:创建场景出现空白气泡弹窗、从mock复制出来的环境 会导致执行测试时默认带上mock的路径):
修复:创建场景出现空白气泡弹窗、从mock复制出来的环境 会导致执行测试时默认带上mock的路径
This commit is contained in:
parent
bfca311bfd
commit
27fac113c9
|
@ -86,10 +86,27 @@ public class ApiTestEnvironmentService {
|
||||||
request.setCreateUser(SessionUtils.getUserId());
|
request.setCreateUser(SessionUtils.getUserId());
|
||||||
checkEnvironmentExist(request);
|
checkEnvironmentExist(request);
|
||||||
FileUtils.createFiles(request.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");
|
FileUtils.createFiles(request.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");
|
||||||
|
//检查Config,判断isMock参数是否给True
|
||||||
|
request = this.updateConfig(request,false);
|
||||||
apiTestEnvironmentMapper.insert(request);
|
apiTestEnvironmentMapper.insert(request);
|
||||||
return request.getId();
|
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) {
|
public void update(ApiTestEnvironmentDTO apiTestEnvironment,List<MultipartFile> sslFiles) {
|
||||||
checkEnvironmentExist(apiTestEnvironment);
|
checkEnvironmentExist(apiTestEnvironment);
|
||||||
FileUtils.createFiles(apiTestEnvironment.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");
|
FileUtils.createFiles(apiTestEnvironment.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
<el-col :span="6" class="ms-col-one ms-font">
|
<el-col :span="6" class="ms-col-one ms-font">
|
||||||
<el-tooltip placement="top" effect="light">
|
<el-tooltip placement="top" effect="light">
|
||||||
<template v-slot:content>
|
<template v-slot:content>
|
||||||
<div>{{ currentScenario.name }}</div>
|
<div>{{ currentScenario.name === undefined || '' ? $t('api_test.scenario.name') : currentScenario.name }}</div>
|
||||||
</template>
|
</template>
|
||||||
<span class="scenario-name">
|
<span class="scenario-name">
|
||||||
{{ currentScenario.name === undefined || '' ? $t('api_test.scenario.name') : currentScenario.name }}
|
{{ currentScenario.name === undefined || '' ? $t('api_test.scenario.name') : currentScenario.name }}
|
||||||
|
|
|
@ -70,6 +70,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copyEnvironment(environment) {
|
copyEnvironment(environment) {
|
||||||
|
//点击复制的时候先选择改行,否则会出现解析错误
|
||||||
|
this.environmentSelected(environment);
|
||||||
this.currentEnvironment = environment;
|
this.currentEnvironment = environment;
|
||||||
if (!environment.id) {
|
if (!environment.id) {
|
||||||
this.$warning(this.$t('commons.please_save'));
|
this.$warning(this.$t('commons.please_save'));
|
||||||
|
|
Loading…
Reference in New Issue