@@ -6,8 +6,9 @@ import com.google.gson.Gson
66import io.appwrite.exceptions.AppwriteException
77import io.appwrite.extensions.fromJson
88import io.appwrite.extensions.toJson
9- import io.appwrite.models.Mock
109import io.appwrite.models.Error
10+ import io.appwrite.models.InputFile
11+ import io.appwrite.models.Mock
1112import io.appwrite.services.Bar
1213import io.appwrite.services.Foo
1314import io.appwrite.services.General
@@ -99,11 +100,32 @@ class ServiceTest {
99100 val result = general.redirect()
100101 writeToFile((result as Map <String , Any >)[" result" ] as String )
101102
102- mock = general.upload(" string" , 123 , listOf (" string in array" ), File (" ../../../resources/file.png" ))
103- writeToFile(mock.result)
104-
105- mock = general.upload(" string" , 123 , listOf (" string in array" ), File (" ../../../resources/large_file.mp4" ))
106- writeToFile(mock.result)
103+ try {
104+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromPath(" ../../../resources/file.png" ))
105+ writeToFile(mock.result)
106+ } catch (ex: Exception ) {
107+ writeToFile(ex.toString())
108+ }
109+ try {
110+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromPath(" ../../../resources/large_file.mp4" ))
111+ writeToFile(mock.result)
112+ } catch (ex: Exception ) {
113+ writeToFile(ex.toString())
114+ }
115+ try {
116+ var bytes = File (" ../../../resources/file.png" ).readBytes()
117+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromBytes(bytes, " file.png" , " image/png" ))
118+ writeToFile(mock.result)
119+ } catch (ex: Exception ) {
120+ writeToFile(ex.toString())
121+ }
122+ try {
123+ var bytes = File (" ../../../resources/large_file.mp4" ).readBytes()
124+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromBytes(bytes, " large_file.mp4" , " video/mp4" ))
125+ writeToFile(mock.result)
126+ } catch (ex: Exception ) {
127+ writeToFile(ex.toString())
128+ }
107129
108130 try {
109131 general.error400()
0 commit comments