Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/Android11Java11Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Android11Java11Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Android11Java8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Android11Java8Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Android12Java11Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Android12Java11Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Android12Java8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Android12Java8Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Android5Java11Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Android5Java11Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Android5Java8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Android5Java8Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/AppleSwift55Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AppleSwift55Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
8 changes: 8 additions & 0 deletions tests/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ abstract class Base extends TestCase
'GET:/v1/mock/tests/general/download:passed',
];

Comment on lines 41 to 43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename EXTENDED_GENERAL_RESPONSES to may be DOWNLOAD_RESPONSES ?

protected const DOWNLOAD_URL_CLIENT_RESPONSES = [
'https://stage.appwrite.io/v1/mock/tests/general/download?project=console',
];

protected const DOWNLOAD_URL_SERVER_RESPONSES = [
'https://stage.appwrite.io/v1/mock/tests/general/download?project=',
];

protected const COOKIE_RESPONSES = [
'GET:/v1/mock/tests/general/set-cookie:passed',
'GET:/v1/mock/tests/general/get-cookie:passed',
Expand Down
5 changes: 3 additions & 2 deletions tests/CLINode14Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CLINode14Test extends Base
protected string $language = 'cli';
protected string $class = 'Appwrite\SDK\Language\CLI';
protected array $build = [
'docker run --rm -v $(pwd):/app -w /app/tests/sdks/cli node:16-alpine npm install',
'docker run --rm -v $(pwd):/app -w /app/tests/sdks/cli node:14-alpine npm install',
'cp tests/languages/cli/test.js tests/sdks/cli/test.js'
];
protected string $command =
Expand All @@ -25,7 +25,8 @@ class CLINode14Test extends Base
...Base::FOO_RESPONSES,
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
'POST:/v1/mock/tests/general/upload:passed', //large file
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
];

public function getLanguage(): Language
Expand Down
3 changes: 2 additions & 1 deletion tests/CLINode16Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class CLINode16Test extends Base
...Base::FOO_RESPONSES,
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
'POST:/v1/mock/tests/general/upload:passed', //large file
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
];

public function getLanguage(): Language
Expand Down
1 change: 1 addition & 0 deletions tests/DartBetaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class DartBetaTest extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/DartStableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class DartStableTest extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Deno1193Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Deno1193Test extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/FlutterBetaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class FlutterBetaTest extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
//...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/FlutterStableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class FlutterStableTest extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
//...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/KotlinJava11Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class KotlinJava11Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/KotlinJava17Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class KotlinJava17Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/KotlinJava8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class KotlinJava8Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Node12Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Node12Test extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Node14Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Node14Test extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Node16Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Node16Test extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/PHP74Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PHP74Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/PHP80Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PHP80Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Python310Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Python310Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Python38Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Python38Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Python39Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Python39Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Ruby27Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Ruby27Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Ruby30Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Ruby30Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Ruby31Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Ruby31Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/Swift55Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Swift55Test extends Base
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
...Base::PERMISSION_HELPER_RESPONSES,
Expand Down
26 changes: 26 additions & 0 deletions tests/SwiftClient56Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Tests;

class SwiftClient56Test extends Base
{
protected string $language = 'swift-client';
protected string $class = 'Appwrite\SDK\Language\SwiftClient';
protected array $build = [
'mkdir -p tests/sdks/swift-client/Tests/AppwriteTests',
'cp tests/languages/swift-client/Tests.swift tests/sdks/swift-client/Tests/AppwriteTests/Tests.swift',
];
protected string $command =
'docker run --rm -v $(pwd):/app -w /app/tests/sdks/swift-client swift:5.6.1-focal swift test';

protected array $expectedOutput = [
...Base::FOO_RESPONSES,
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::COOKIE_RESPONSES,
];
}
24 changes: 24 additions & 0 deletions tests/SwiftServer56Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Tests;

class SwiftServer56Test extends Base
{
protected string $language = 'swift-server';
protected string $class = 'Appwrite\SDK\Language\Swift';
protected array $build = [
'mkdir -p tests/sdks/swift-server/Tests/AppwriteTests',
'cp tests/languages/swift-server/Tests.swift tests/sdks/swift-server/Tests/AppwriteTests/Tests.swift',
];
protected string $command =
'docker run --rm -v $(pwd):/app -w /app/tests/sdks/swift-server swift:5.6.1-focal swift test';

protected array $expectedOutput = [
...Base::FOO_RESPONSES,
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::EXTENDED_GENERAL_RESPONSES,
...Base::EXCEPTION_RESPONSES,
];
}
1 change: 1 addition & 0 deletions tests/WebChromiumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class WebChromiumTest extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::DOWNLOAD_URL_CLIENT_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
Expand Down
1 change: 1 addition & 0 deletions tests/WebNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class WebNodeTest extends Base
...Base::BAR_RESPONSES,
...Base::GENERAL_RESPONSES,
...Base::LARGE_FILE_RESPONSES,
...Base::DOWNLOAD_URL_SERVER_RESPONSES,
...Base::EXCEPTION_RESPONSES,
...Base::REALTIME_RESPONSES,
...Base::QUERY_HELPER_RESPONSES,
Expand Down
3 changes: 3 additions & 0 deletions tests/languages/android/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ class ServiceTest {
writeToFile(ex.toString())
}

val res = general.download()
writeToFile(String(res, Charsets.UTF_8))

try {
general.error400()
} catch (e: AppwriteException) {
Expand Down
3 changes: 3 additions & 0 deletions tests/languages/apple/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ class Tests: XCTestCase {
print(error.localizedDescription)
}

var res = try await general.download()
print(res.readString(length: res.readableBytes)!)

do {
try await general.error400()
} catch {
Expand Down
5 changes: 4 additions & 1 deletion tests/languages/cli/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ console.log(output.split('\n')[0].split(" : ")[1]);
output = execSync("node index general upload --x string --y 123 --z string in array --file ../../resources/large_file.mp4", { stdio: 'pipe'}).toString();
console.log(output.split('\n')[0].split(" : ")[1]);

output = execSync("node index general download --destination download.txt >/dev/null && cat download.txt", { stdio: 'pipe'}).toString();
console.log(output);

execSync("node index general empty", { stdio: 'pipe'});

output = execSync("node index general headers", { stdio: 'pipe'}).toString();
console.log(output.split('\n')[0].split(" : ")[1]);
console.log(output.split('\n')[0].split(" : ")[1]);
3 changes: 3 additions & 0 deletions tests/languages/dart/tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ void main() async {
x: 'string', y: 123, z: ['string in array'], file: file);
print(response.result);

final download = await general.download();
print(new String.fromCharCodes(download));

try {
await general.error400();
} on AppwriteException catch (e) {
Expand Down
4 changes: 4 additions & 0 deletions tests/languages/deno/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ async function start() {
// @ts-ignore
console.log(response.result)

response = await general.download()
// @ts-ignore
console.log(await response.text())

try {
response = await general.error400();
}catch(error){
Expand Down
3 changes: 3 additions & 0 deletions tests/languages/flutter/tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ void main() async {
x: 'string', y: 123, z: ['string in array'], file: file);
print(response.result);

final download = await general.download();
print(new String.fromCharCodes(download));

try {
await general.error400();
} on AppwriteException catch (e) {
Expand Down
Loading