Added request filter tests
This commit is contained in:
parent
a762fe7b3e
commit
f9994d8021
|
@ -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() {
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue