Skip to main content
Glama
HttpUtilsTest.kt1.75 kB
package maestro.utils import com.google.common.truth.Truth.assertThat import maestro.utils.HttpUtils.toMultipartBody import okhttp3.MultipartBody import org.junit.jupiter.api.Test internal class HttpUtilsTest { @Test internal fun `toMultipartBody should successfully parse a map containing a filePath along with mediaType`() { // Given val map = mapOf( "uploadType" to "import", "data" to (listOf( "filePath" to "testFilePath", "mediaType" to "text/csv" )) ) // When val multipartBody = map.toMultipartBody() // Then assertThat(multipartBody.size).isEqualTo(2) assertThat(multipartBody.type).isEqualTo(MultipartBody.FORM) } @Test internal fun `toMultipartBody should successfully parse a map containing a filePath without mediaType`() { // Given val map = mapOf( "uploadType" to "import", "data" to (listOf( "filePath" to "testFilePath" )) ) // When val multipartBody = map.toMultipartBody() // Then assertThat(multipartBody.size).isEqualTo(2) assertThat(multipartBody.type).isEqualTo(MultipartBody.FORM) } @Test internal fun `toMultipartBody should successfully parse a map without a filePath`() { // Given val map = mapOf( "data1" to "test1", "data2" to "test2", "data3" to "test3", ) // When val multipartBody = map.toMultipartBody() // Then assertThat(multipartBody.size).isEqualTo(3) assertThat(multipartBody.type).isEqualTo(MultipartBody.FORM) } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mobile-dev-inc/Maestro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server