@@ -4,8 +4,9 @@ import com.google.gson.Gson
44import io.appwrite.exceptions.AppwriteException
55import io.appwrite.extensions.fromJson
66import io.appwrite.extensions.toJson
7- import io.appwrite.models.Mock
87import io.appwrite.models.Error
8+ import io.appwrite.models.InputFile
9+ import io.appwrite.models.Mock
910import io.appwrite.services.Bar
1011import io.appwrite.services.Foo
1112import io.appwrite.services.General
@@ -68,11 +69,32 @@ class ServiceTest {
6869 val result = general.redirect()
6970 writeToFile((result as Map <String , Any >)[" result" ] as String )
7071
71- mock = general.upload(" string" , 123 , listOf (" string in array" ), File (" ../../resources/file.png" ))
72- writeToFile(mock.result)
73-
74- mock = general.upload(" string" , 123 , listOf (" string in array" ), File (" ../../resources/large_file.mp4" ))
75- writeToFile(mock.result)
72+ try {
73+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromPath(" ../../resources/file.png" ))
74+ writeToFile(mock.result)
75+ } catch (ex: Exception ) {
76+ writeToFile(ex.toString())
77+ }
78+ try {
79+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromPath(" ../../resources/large_file.mp4" ))
80+ writeToFile(mock.result)
81+ } catch (ex: Exception ) {
82+ writeToFile(ex.toString())
83+ }
84+ try {
85+ var bytes = File (" ../../resources/file.png" ).readBytes()
86+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromBytes(bytes, " file.png" , " image/png" ))
87+ writeToFile(mock.result)
88+ } catch (ex: Exception ) {
89+ writeToFile(ex.toString())
90+ }
91+ try {
92+ var bytes = File (" ../../resources/large_file.mp4" ).readBytes()
93+ mock = general.upload(" string" , 123 , listOf (" string in array" ), InputFile .fromBytes(bytes, " large_file.mp4" , " video/mp4" ))
94+ writeToFile(mock.result)
95+ } catch (ex: Exception ) {
96+ writeToFile(ex.toString())
97+ }
7698
7799 try {
78100 general.error400()
0 commit comments