Created
July 28, 2022 05:23
-
-
Save stella6767/649de28af6fa2aa60f3528eb6f047be5 to your computer and use it in GitHub Desktop.
kotiln + junit5 with MockmultipartTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@DisplayName("s3파일 업로드 테스트") | |
fun s3FileUploadTest(){ | |
val imgPath = "src/main/resources/static/img" | |
val mockFile:MultipartFile = MockMultipartFile( | |
"test1", | |
"test1.png", | |
"image/png", | |
FileInputStream("$imgPath/test1.png") | |
) | |
// log.info { "mockFile $mockFile" } | |
// val convert = s3FileUploader.convert(mockFile) | |
// log.info { "convert $convert" } | |
// val upload = s3FileUploader.upload(convert.get(), S3FileUploader.songRawDirName) | |
// log.info { "upload $upload" } | |
//s3FileUploader.removeNewFile() | |
this.mockMvc.perform(multipart("/song") | |
.file("songFile",mockFile.bytes) | |
.param("name","song1")) | |
.andExpect(MockMvcResultMatchers.status().isOk) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment