Skip to content

Commit 8346c7e

Browse files
committed
Update android upload tests for input files
1 parent d894ee7 commit 8346c7e

File tree

7 files changed

+40
-6
lines changed

7 files changed

+40
-6
lines changed

tests/Android11Java11Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Android11Java11Test extends Base
1919
...Base::BAR_RESPONSES,
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
22+
...Base::LARGE_FILE_RESPONSES,
23+
...Base::LARGE_FILE_RESPONSES,
2224
...Base::EXCEPTION_RESPONSES,
2325
...Base::REALTIME_RESPONSES,
2426
...Base::COOKIE_RESPONSES,

tests/Android11Java8Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Android11Java8Test extends Base
1919
...Base::BAR_RESPONSES,
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
22+
...Base::LARGE_FILE_RESPONSES,
23+
...Base::LARGE_FILE_RESPONSES,
2224
...Base::EXCEPTION_RESPONSES,
2325
...Base::REALTIME_RESPONSES,
2426
...Base::COOKIE_RESPONSES,

tests/Android12Java11Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Android12Java11Test extends Base
1919
...Base::BAR_RESPONSES,
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
22+
...Base::LARGE_FILE_RESPONSES,
23+
...Base::LARGE_FILE_RESPONSES,
2224
...Base::EXCEPTION_RESPONSES,
2325
...Base::REALTIME_RESPONSES,
2426
...Base::COOKIE_RESPONSES,

tests/Android12Java8Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Android12Java8Test extends Base
1919
...Base::BAR_RESPONSES,
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
22+
...Base::LARGE_FILE_RESPONSES,
23+
...Base::LARGE_FILE_RESPONSES,
2224
...Base::EXCEPTION_RESPONSES,
2325
...Base::REALTIME_RESPONSES,
2426
...Base::COOKIE_RESPONSES,

tests/Android5Java11Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Android5Java11Test extends Base
1919
...Base::BAR_RESPONSES,
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
22+
...Base::LARGE_FILE_RESPONSES,
23+
...Base::LARGE_FILE_RESPONSES,
2224
...Base::EXCEPTION_RESPONSES,
2325
...Base::REALTIME_RESPONSES,
2426
...Base::COOKIE_RESPONSES,

tests/Android5Java8Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Android5Java8Test extends Base
1919
...Base::BAR_RESPONSES,
2020
...Base::GENERAL_RESPONSES,
2121
...Base::LARGE_FILE_RESPONSES,
22+
...Base::LARGE_FILE_RESPONSES,
23+
...Base::LARGE_FILE_RESPONSES,
2224
...Base::EXCEPTION_RESPONSES,
2325
...Base::REALTIME_RESPONSES,
2426
...Base::COOKIE_RESPONSES,

tests/languages/android/ServiceTest.kt

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import com.google.gson.Gson
66
import io.appwrite.exceptions.AppwriteException
77
import io.appwrite.extensions.fromJson
88
import io.appwrite.extensions.toJson
9-
import io.appwrite.models.Mock
109
import io.appwrite.models.Error
10+
import io.appwrite.models.InputFile
11+
import io.appwrite.models.Mock
1112
import io.appwrite.services.Bar
1213
import io.appwrite.services.Foo
1314
import 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

Comments
 (0)