1
0
Fork 0
mirror of synced 2024-06-03 11:24:48 +12:00

Added request filter tests

This commit is contained in:
Matej Baco 2022-01-02 16:23:37 +01:00
parent a762fe7b3e
commit f9994d8021

View file

@ -187,6 +187,54 @@ class HTTPTest extends Scope
$this->assertEquals($body['continents']['AS'], 'Asia');
}
public function testRequestHeader() {
/**
* Test without header
*/
$response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console'
], $this->getHeaders()), [
'name' => 'Latest version Team',
'teamId' => 'unique()'
]);
$this->assertEquals(201, $response['headers']['status-code']);
$team1Id = $response['body']['$id'];
/**
* Test with header
*/
$response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
'x-appwrite-response-format' => '0.11.0'
], $this->getHeaders()), [
'name' => 'Latest version Team'
// Notice "teamId' is not defined
]);
$this->assertEquals(201, $response['headers']['status-code']);
$team2Id = $response['body']['$id'];
/**
* Cleanup, so I don't invalidate some listTeams requests by mistake
*/
$response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $team1Id, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
], $this->getHeaders()));
$this->assertEquals(204, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $team2Id, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => 'console',
], $this->getHeaders()));
$this->assertEquals(204, $response['headers']['status-code']);
}
public function testVersions() {
/**