Add tests for filtering and pagination
This commit is contained in:
parent
0369e8913f
commit
df9f4ffb04
2 changed files with 39 additions and 14 deletions
|
@ -963,4 +963,43 @@ class FunctionsCustomClientTest extends Scope
|
|||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function testGetFunctionTemplates()
|
||||
{
|
||||
$templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $templates['headers']['status-code']);
|
||||
$this->assertGreaterThan(0, $templates['body']['total']);
|
||||
$this->assertIsArray($templates['body']['templates']);
|
||||
$this->assertArrayHasKey('runtimes', $templates['body']['templates'][0]);
|
||||
|
||||
$templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'usecases' => ['starter', 'ai'],
|
||||
'runtimes' => ['bun-1.0', 'dart-2.16']
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $templates['headers']['status-code']);
|
||||
$this->assertEquals(3, $templates['body']['total']);
|
||||
$this->assertIsArray($templates['body']['templates']);
|
||||
$this->assertArrayHasKey('runtimes', $templates['body']['templates'][0]);
|
||||
|
||||
$templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'limit' => 10,
|
||||
'offset' => 2,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $templates['headers']['status-code']);
|
||||
$this->assertEquals(10, $templates['body']['total']);
|
||||
$this->assertIsArray($templates['body']['templates']);
|
||||
$this->assertArrayHasKey('runtimes', $templates['body']['templates'][0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2097,18 +2097,4 @@ class FunctionsCustomServerTest extends Scope
|
|||
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
}
|
||||
|
||||
public function testGetFunctionTemplates()
|
||||
{
|
||||
$templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $templates['headers']['status-code']);
|
||||
$this->assertGreaterThan(0, $templates['body']['total']);
|
||||
$this->assertIsArray($templates['body']['templates']);
|
||||
$this->assertArrayHasKey('runtimes', $templates['body']['templates'][0]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue