Skip to content

Commit a7ddcc8

Browse files
committed
Upload python upload tests for input files
1 parent ce1e2c8 commit a7ddcc8

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

tests/Python310Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Python310Test 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
];
2426
}

tests/Python38Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Python38Test 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
];
2426
}

tests/Python39Test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Python39Test 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
];
2426
}

tests/languages/python/tests.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from appwrite.services.bar import Bar
44
from appwrite.services.general import General
55
from appwrite.exception import AppwriteException
6+
from appwrite.input_file import InputFile
67
import os.path
78

89

@@ -55,10 +56,18 @@
5556
response = general.redirect()
5657
print(response['result'])
5758

58-
response = general.upload('string', 123, ['string in array'], './tests/resources/file.png')
59+
response = general.upload('string', 123, ['string in array'], InputFile.from_path('./tests/resources/file.png'))
5960
print(response['result'])
6061

61-
response = general.upload('string', 123, ['string in array'], './tests/resources/large_file.mp4')
62+
response = general.upload('string', 123, ['string in array'], InputFile.from_path('./tests/resources/large_file.mp4'))
63+
print(response['result'])
64+
65+
data = open('./tests/resources/file.png', 'rb').read()
66+
response = general.upload('string', 123, ['string in array'], InputFile.from_bytes(data, 'file.png', 'image/png'))
67+
print(response['result'])
68+
69+
data = open('./tests/resources/large_file.mp4', 'rb').read()
70+
response = general.upload('string', 123, ['string in array'], InputFile.from_bytes(data, 'large_file.mp4','video/mp4'))
6271
print(response['result'])
6372

6473
try:

0 commit comments

Comments
 (0)