refactor(功能用例): 校验覆盖率

This commit is contained in:
guoyuqi 2024-01-12 14:46:25 +08:00 committed by 刘瑞斌
parent 2b695f6e1e
commit 09cb3f254b
2 changed files with 4 additions and 4 deletions

View File

@ -481,7 +481,7 @@ public class FunctionalCaseAttachmentService {
//图片文件自动生成预览图
byte[] file = defaultRepository.getFile(fileCopyRequest);
byte[] previewImg = TempFileUtils.compressPic(file);
fileCopyRequest.setFolder(DefaultRepositoryDir.getFunctionalCasePreviewDir(projectId,caseId));
fileCopyRequest.setFolder(DefaultRepositoryDir.getFunctionalCasePreviewDir(projectId,caseId)+ "/" + fileId);
fileCopyRequest.setStorage(StorageType.MINIO.toString());
fileService.upload(previewImg, fileCopyRequest);
}

View File

@ -247,16 +247,16 @@ public class FunctionalCaseAttachmentControllerTests extends BaseTest {
Assertions.assertTrue(StringUtils.isNotBlank(fileId));
file = getNoNameMockMultipartFile();
doUploadTempFileFalse(file);
functionalCaseAttachmentService.uploadMinioFile("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID_1","WX_TEST_PROJECT_ID", List.of(fileId),"admin", CaseFileSourceType.CASE_COMMENT.toString());
functionalCaseAttachmentService.uploadMinioFile("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID_1","WX_TEST_PROJECT_ID", List.of(fileId),"admin", CaseFileSourceType.CASE_DETAIL.toString());
FunctionalCaseFileRequest request = new FunctionalCaseFileRequest();
request.setProjectId("WX_TEST_PROJECT_ID");
request.setLocal(true);
request.setFileId("fileId");
request.setFileId(fileId);
request.setCaseId("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID_1");
MvcResult mvcResult = this.downloadFile(ATTACHMENT_PREVIEW_COMPRESSED_URL, request);
Assertions.assertNotNull(mvcResult);
FunctionalCaseAttachmentExample functionalCaseAttachmentExample = new FunctionalCaseAttachmentExample();
functionalCaseAttachmentExample.createCriteria().andCaseIdEqualTo("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID_1").andFileIdEqualTo(fileId).andFileSourceEqualTo(CaseFileSourceType.CASE_COMMENT.toString());
functionalCaseAttachmentExample.createCriteria().andCaseIdEqualTo("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID_1").andFileIdEqualTo(fileId).andFileSourceEqualTo(CaseFileSourceType.CASE_DETAIL.toString());
List<FunctionalCaseAttachment> functionalCaseAttachments = functionalCaseAttachmentMapper.selectByExample(functionalCaseAttachmentExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseAttachments));
functionalCaseAttachmentService.uploadMinioFile("TEST_FUNCTIONAL_CASE_ATTACHMENT_ID_1","WX_TEST_PROJECT_ID",new ArrayList<>(),"admin", CaseFileSourceType.CASE_COMMENT.toString());