Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24f55ee0 authored by cketti's avatar cketti
Browse files

Add test for RetrieveMessageOperations.getHeaders()

parent e7608256
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
package com.fsck.k9

fun String.crlf() = replace("\n", "\r\n")
+1 −1
Original line number Diff line number Diff line
package com.fsck.k9.autocrypt

import com.fsck.k9.crlf
import com.fsck.k9.mail.crlf
import com.fsck.k9.mail.filter.Base64
import com.fsck.k9.mailstore.MimePartStreamParser
import org.junit.Assert.assertArrayEquals
+1 −1
Original line number Diff line number Diff line
package com.fsck.k9.mailstore

import com.fsck.k9.crlf
import com.fsck.k9.mail.crlf
import com.fsck.k9.mail.internet.MimeBodyPart
import com.fsck.k9.mail.internet.MimeMessage
import com.fsck.k9.mail.internet.MimeMultipart
+1 −1
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@ package com.fsck.k9.message.quote
import com.fsck.k9.Account.QuoteStyle
import com.fsck.k9.RobolectricTest
import com.fsck.k9.TestCoreResourceProvider
import com.fsck.k9.crlf
import com.fsck.k9.mail.Address
import com.fsck.k9.mail.Message
import com.fsck.k9.mail.Message.RecipientType
import com.fsck.k9.mail.crlf
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.eq
+42 −0
Original line number Diff line number Diff line
@@ -158,3 +158,45 @@ data class MessageEntry(
    val messagePartId: Long?,
    val encryptionType: String?
)

fun SQLiteDatabase.createMessagePart(
    type: Int = 0,
    root: Int? = null,
    parent: Int = -1,
    seq: Int = 0,
    mimeType: String = "text/plain",
    decodedBodySize: Int = 0,
    displayName: String? = null,
    header: String? = null,
    encoding: String = "7bit",
    charset: String? = null,
    dataLocation: Int = 0,
    data: ByteArray? = null,
    preamble: String? = null,
    epilogue: String? = null,
    boundary: String? = null,
    contentId: String? = null,
    serverExtra: String? = null
): Long {
    val values = ContentValues().apply {
        put("type", type)
        put("root", root)
        put("parent", parent)
        put("seq", seq)
        put("mime_type", mimeType)
        put("decoded_body_size", decodedBodySize)
        put("display_name", displayName)
        put("header", header)
        put("encoding", encoding)
        put("charset", charset)
        put("data_location", dataLocation)
        put("data", data)
        put("preamble", preamble)
        put("epilogue", epilogue)
        put("boundary", boundary)
        put("content_id", contentId)
        put("server_extra", serverExtra)
    }

    return insert("message_parts", null, values)
}
Loading