This commit is contained in:
2026-08-03 14:16:10 +08:00
parent 595a51ab79
commit fe5e3de9b1
20 changed files with 331 additions and 44 deletions
@@ -27,4 +27,16 @@ class QualificationFileContractTest {
assertTrue(hasMultipartPost, "企业资质真实上传入口必须保持 multipart/form-data 契约");
}
@Test
void platformControllerExposesMultipartUploadForCustomerDrafts() {
RequestMapping mapping = PlatformQualificationFileController.class.getAnnotation(RequestMapping.class);
assertTrue(Arrays.asList(mapping.value()).contains("/api/platform/v1/files/qualifications"));
boolean hasMultipartPost = Arrays.stream(PlatformQualificationFileController.class.getDeclaredMethods())
.map(method -> method.getAnnotation(PostMapping.class))
.filter(java.util.Objects::nonNull)
.flatMap(post -> Arrays.stream(post.consumes()))
.anyMatch(MediaType.MULTIPART_FORM_DATA_VALUE::equals);
assertTrue(hasMultipartPost);
}
}
@@ -50,6 +50,19 @@ class LocalQualificationStorageTest {
assertThrows(BizException.class, () -> storage.load(10002L, stored.fileName()));
}
@Test
void storesPdfQualificationAfterVerifyingItsSignature() throws Exception {
var storage = new LocalQualificationStorage(storageRoot.toString());
storage.initialize();
var upload = new MockMultipartFile("file", "license.pdf", "application/pdf", "%PDF-1.4\ncontent".getBytes());
var stored = storage.store(10001L, upload);
assertTrue(stored.fileName().endsWith(".pdf"));
assertEquals(stored.path().toAbsolutePath(),
storage.load(10001L, stored.fileName()).getFile().toPath().toAbsolutePath());
}
@Test
void legacySeedPathCannotBePretendedToBeAStoredFile() {
var storage = new LocalQualificationStorage(storageRoot.toString());