Merge remote-tracking branch 'origin/1.6.x' into 1.6.1

This commit is contained in:
Jake Barnby
2024-09-06 22:26:01 +12:00
10 changed files with 58 additions and 7 deletions
+13
View File
@@ -216,4 +216,17 @@ class HTTPTest extends Scope
$this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin']);
}
public function testConsoleRedirect()
{
/**
* Test for SUCCESS
*/
$endpoint = '/invite?membershipId=123&userId=asdf';
$response = $this->client->call(Client::METHOD_GET, $endpoint);
$this->assertEquals('/console' . $endpoint, $response['headers']['location']);
}
}
@@ -1593,6 +1593,7 @@ trait DatabasesBase
$this->assertEquals($response['body']['$permissions'], $document['$permissions']);
$this->assertEquals($response['body']['birthDay'], $document['birthDay']);
$this->assertFalse(array_key_exists('$internalId', $response['body']));
$this->assertFalse(array_key_exists('$tenant', $response['body']));
}
}
@@ -568,6 +568,36 @@ class FunctionsCustomServerTest extends Scope
$this->assertStringContainsString("Total users: " . $totalusers, $execution['body']['logs']);
// Execute function again but async
$execution = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/executions', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'path' => '/ping',
'async' => true
]);
$this->assertEquals(202, $execution['headers']['status-code']);
$this->assertNotEmpty($execution['body']['$id']);
$this->assertEquals('waiting', $execution['body']['status']);
$executionId = $execution['body']['$id'];
// Wait for async execuntion to finish
sleep(5);
// Ensure execution was successful
$execution = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/executions/' . $executionId, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $execution['headers']['status-code']);
$this->assertEquals("completed", $execution['body']['status']);
$this->assertEquals(200, $execution['body']['responseStatusCode']);
$this->assertEmpty($execution['body']['responseBody']);
$this->assertEmpty($execution['body']['errors']);
$this->assertStringContainsString("Total users: " . $totalusers, $execution['body']['logs']);
// Cleanup : Delete function
$response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [
'content-type' => 'application/json',