1
0
Fork 0
mirror of synced 2024-07-01 04:30:59 +12:00

Add malformed request body tests

This commit is contained in:
Jake Barnby 2022-07-14 15:58:17 +12:00
parent 4f5c7ddada
commit 13ff5ca45e

View file

@ -118,4 +118,26 @@ class GraphQLContentTypeTest extends Scope
$this->assertArrayNotHasKey('errors', $file['body']);
$this->assertIsArray($file['body']['data']['storageCreateFile']);
}
public function testEmptyBody()
{
$projectId = $this->getProject()['$id'];
$response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
], $this->getHeaders()));
$this->assertEquals('No query supplied.', $response['body']['message']);
}
public function testRandomBody()
{
$projectId = $this->getProject()['$id'];
$response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
], $this->getHeaders()), ['foo' => 'bar']);
$this->assertEquals('Invalid query.', $response['body']['message']);
}
}