adding separate image for encrypted image test and re-enabling clear image test
This commit is contained in:
parent
e70ed9f6e5
commit
5472b41d73
|
@ -66,7 +66,6 @@ internal class SendMessageUseCase(
|
|||
true -> {
|
||||
val result = mediaEncrypter.encrypt(imageContent.inputStream())
|
||||
val bytes = File(result.uri).readBytes()
|
||||
println("!!! ${bytes.size}")
|
||||
|
||||
val uri = httpClient.execute(uploadRequest(bytes, imageContent.fileName, "application/octet-stream")).contentUri
|
||||
|
||||
|
@ -114,9 +113,7 @@ internal class SendMessageUseCase(
|
|||
}
|
||||
|
||||
false -> {
|
||||
val bytes = ByteArrayOutputStream().also {
|
||||
it.writeTo(imageContent.outputStream())
|
||||
}.toByteArray()
|
||||
val bytes = File(imageContent.uri).readBytes()
|
||||
|
||||
val uri = httpClient.execute(uploadRequest(bytes, imageContent.fileName, imageContent.mimeType)).contentUri
|
||||
sendRequest(
|
||||
|
|
|
@ -71,18 +71,18 @@ class SmokeTest {
|
|||
@Order(5)
|
||||
fun `can send and receive encrypted text messages`() = testTextMessaging(isEncrypted = true)
|
||||
|
||||
// @Test
|
||||
// @Order(6)
|
||||
// fun `can send and receive clear image messages`() = testAfterInitialSync { alice, bob ->
|
||||
// val testImage = loadResourceFile("test-image.png")
|
||||
// alice.sendImageMessage(SharedState.sharedRoom, testImage, isEncrypted = false)
|
||||
// bob.expectImageMessage(SharedState.sharedRoom, testImage, SharedState.alice.roomMember, isEncrypted = false)
|
||||
// }
|
||||
@Test
|
||||
@Order(6)
|
||||
fun `can send and receive clear image messages`() = testAfterInitialSync { alice, bob ->
|
||||
val testImage = loadResourceFile("test-image.png")
|
||||
alice.sendImageMessage(SharedState.sharedRoom, testImage, isEncrypted = false)
|
||||
bob.expectImageMessage(SharedState.sharedRoom, testImage, SharedState.alice.roomMember)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(7)
|
||||
fun `can send and receive encrypted image messages`() = testAfterInitialSync { alice, bob ->
|
||||
val testImage = loadResourceFile("test-image.png")
|
||||
val testImage = loadResourceFile("test-image2.png")
|
||||
alice.sendImageMessage(SharedState.sharedRoom, testImage, isEncrypted = true)
|
||||
bob.expectImageMessage(SharedState.sharedRoom, testImage, SharedState.alice.roomMember)
|
||||
}
|
||||
|
|
|
@ -147,7 +147,6 @@ class MatrixTestScope(private val testScope: TestScope) {
|
|||
this.client.syncService().room(roomId)
|
||||
.map {
|
||||
it.events.filterIsInstance<RoomEvent.Image>().map {
|
||||
println("found: ${it}")
|
||||
val output = File(image.parentFile.absolutePath, "output.png")
|
||||
HttpClient().request(it.imageMeta.url).bodyAsChannel().copyAndClose(output.writeChannel())
|
||||
val md5Hash = when (val keys = it.imageMeta.keys) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Loading…
Reference in New Issue