@@ -4,8 +4,9 @@ import com.google.gson.Gson
4
4
import io.appwrite.exceptions.AppwriteException
5
5
import io.appwrite.extensions.fromJson
6
6
import io.appwrite.extensions.toJson
7
- import io.appwrite.models.Mock
8
7
import io.appwrite.models.Error
8
+ import io.appwrite.models.InputFile
9
+ import io.appwrite.models.Mock
9
10
import io.appwrite.services.Bar
10
11
import io.appwrite.services.Foo
11
12
import io.appwrite.services.General
@@ -68,11 +69,32 @@ class ServiceTest {
68
69
val result = general.redirect()
69
70
writeToFile((result as Map <String , Any >)[" result" ] as String )
70
71
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
+ }
76
98
77
99
try {
78
100
general.error400()
0 commit comments