1
0
Fork 0
mirror of synced 2024-06-28 19:20:25 +12:00

Add get route test

This commit is contained in:
Jake Barnby 2022-07-19 13:31:14 +12:00
parent 4cf5797827
commit d3565b673e
3 changed files with 5 additions and 11 deletions

View file

@ -16,7 +16,7 @@ use Utopia\Validator\JSON;
App::get('/v1/graphql')
->desc('GraphQL Endpoint')
->groups(['grapgql'])
->groups(['graphql'])
->label('scope', 'graphql')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'graphql')
@ -30,16 +30,13 @@ App::get('/v1/graphql')
->param('query', '', new JSON(), 'The query or queries to execute.', fullBody: true)
->inject('request')
->inject('response')
->inject('utopia')
->inject('register')
->inject('dbForProject')
->inject('promiseAdapter')
->inject('schema')
->action(Closure::fromCallable('graphqlRequest'));
App::post('/v1/graphql')
->desc('GraphQL Endpoint')
->groups(['grapgql'])
->groups(['graphql'])
->label('scope', 'graphql')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'graphql')

View file

@ -17,14 +17,11 @@ class GraphQLLocalizationTest extends Scope
{
$projectId = $this->getProject()['$id'];
$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',
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $graphQLPayload);
], $this->getHeaders()));
$this->assertIsArray($locale['body']['data']);
$this->assertArrayNotHasKey('errors', $locale['body']);

View file

@ -67,7 +67,7 @@ class GraphQLStorageServerTest extends Scope
'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',
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $gqlPayload);