fix(接口测试): 修复导入用例前后置SQL仍使用旧环境的缺陷

--bug=1026602 --user=王孝刚
【接口测试】github#24678,如果接口用例中有前后置sql,当从A项目迁移到B项目,在B项目中查看,用例关联的前后置sql环境没有发生变化,还是老得环境。
https://www.tapd.cn/55049933/s/1387267
This commit is contained in:
wxg0103 2023-06-27 20:07:05 +08:00 committed by fit2-zhao
parent 8fd4702145
commit 3d6e6c0b52
3 changed files with 6 additions and 0 deletions

View File

@ -231,6 +231,8 @@ export default {
}); });
if (environmentId) { if (environmentId) {
this.request.environmentId = environmentId; this.request.environmentId = environmentId;
} else {
this.request.environmentId = null;
} }
this.initDataSource(undefined, undefined, targetDataSourceName); this.initDataSource(undefined, undefined, targetDataSourceName);
}); });

View File

@ -259,6 +259,7 @@ export default {
if (stepArray[i] && stepArray[i].authManager && !stepArray[i].authManager.clazzName) { if (stepArray[i] && stepArray[i].authManager && !stepArray[i].authManager.clazzName) {
stepArray[i].authManager.clazzName = TYPE_TO_C.get(stepArray[i].authManager.type); stepArray[i].authManager.clazzName = TYPE_TO_C.get(stepArray[i].authManager.type);
} }
stepArray[i].projectId = this.currentApi.projectId;
if (stepArray[i].type === 'Assertions' && !stepArray[i].document) { if (stepArray[i].type === 'Assertions' && !stepArray[i].document) {
stepArray[i].document = { stepArray[i].document = {
type: 'JSON', type: 'JSON',

View File

@ -405,6 +405,9 @@ export default {
this.apiCase.request.hashTree[index].document.nodeType = 'Case'; this.apiCase.request.hashTree[index].document.nodeType = 'Case';
this.apiCase.request.hashTree[index].document.apiDefinitionId = this.apiCase.apiDefinitionId; this.apiCase.request.hashTree[index].document.apiDefinitionId = this.apiCase.apiDefinitionId;
} }
this.apiCase.request.hashTree.forEach(item =>{
item.projectId = this.apiCase.projectId;
})
} }
this.readonly = !hasPermissions('PROJECT_API_DEFINITION:READ+EDIT_CASE', 'PROJECT_API_DEFINITION:READ+CREATE_CASE', 'PROJECT_API_DEFINITION:READ+COPY_CASE'); this.readonly = !hasPermissions('PROJECT_API_DEFINITION:READ+EDIT_CASE', 'PROJECT_API_DEFINITION:READ+CREATE_CASE', 'PROJECT_API_DEFINITION:READ+COPY_CASE');
if (this.apiCase && this.apiCase.id) { if (this.apiCase && this.apiCase.id) {