Add get route test
This commit is contained in:
parent
4cf5797827
commit
d3565b673e
3 changed files with 5 additions and 11 deletions
|
@ -16,7 +16,7 @@ use Utopia\Validator\JSON;
|
||||||
|
|
||||||
App::get('/v1/graphql')
|
App::get('/v1/graphql')
|
||||||
->desc('GraphQL Endpoint')
|
->desc('GraphQL Endpoint')
|
||||||
->groups(['grapgql'])
|
->groups(['graphql'])
|
||||||
->label('scope', 'graphql')
|
->label('scope', 'graphql')
|
||||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
|
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
|
||||||
->label('sdk.namespace', 'graphql')
|
->label('sdk.namespace', 'graphql')
|
||||||
|
@ -30,16 +30,13 @@ App::get('/v1/graphql')
|
||||||
->param('query', '', new JSON(), 'The query or queries to execute.', fullBody: true)
|
->param('query', '', new JSON(), 'The query or queries to execute.', fullBody: true)
|
||||||
->inject('request')
|
->inject('request')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('utopia')
|
|
||||||
->inject('register')
|
|
||||||
->inject('dbForProject')
|
|
||||||
->inject('promiseAdapter')
|
->inject('promiseAdapter')
|
||||||
->inject('schema')
|
->inject('schema')
|
||||||
->action(Closure::fromCallable('graphqlRequest'));
|
->action(Closure::fromCallable('graphqlRequest'));
|
||||||
|
|
||||||
App::post('/v1/graphql')
|
App::post('/v1/graphql')
|
||||||
->desc('GraphQL Endpoint')
|
->desc('GraphQL Endpoint')
|
||||||
->groups(['grapgql'])
|
->groups(['graphql'])
|
||||||
->label('scope', 'graphql')
|
->label('scope', 'graphql')
|
||||||
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
|
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
|
||||||
->label('sdk.namespace', 'graphql')
|
->label('sdk.namespace', 'graphql')
|
||||||
|
|
|
@ -17,14 +17,11 @@ class GraphQLLocalizationTest extends Scope
|
||||||
{
|
{
|
||||||
$projectId = $this->getProject()['$id'];
|
$projectId = $this->getProject()['$id'];
|
||||||
$query = $this->getQuery(self::$GET_LOCALE);
|
$query = $this->getQuery(self::$GET_LOCALE);
|
||||||
$graphQLPayload = [
|
|
||||||
'query' => $query,
|
|
||||||
];
|
|
||||||
|
|
||||||
$locale = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
$locale = $this->client->call(Client::METHOD_GET, '/graphql?query=' . $query, \array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()), $graphQLPayload);
|
], $this->getHeaders()));
|
||||||
|
|
||||||
$this->assertIsArray($locale['body']['data']);
|
$this->assertIsArray($locale['body']['data']);
|
||||||
$this->assertArrayNotHasKey('errors', $locale['body']);
|
$this->assertArrayNotHasKey('errors', $locale['body']);
|
||||||
|
|
|
@ -67,7 +67,7 @@ class GraphQLStorageServerTest extends Scope
|
||||||
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'),
|
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$file = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
$file = $this->client->call(Client::METHOD_POST, '/graphql/upload', \array_merge([
|
||||||
'content-type' => 'multipart/form-data',
|
'content-type' => 'multipart/form-data',
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()), $gqlPayload);
|
], $this->getHeaders()), $gqlPayload);
|
||||||
|
|
Loading…
Reference in a new issue