From d3565b673ea4e7d279a090dfe39c7a8978e6b199 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 19 Jul 2022 13:31:14 +1200 Subject: [PATCH] Add get route test --- app/controllers/api/graphql.php | 7 ++----- tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php | 7 ++----- tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/graphql.php b/app/controllers/api/graphql.php index 496fa3e0f..5ff033623 100644 --- a/app/controllers/api/graphql.php +++ b/app/controllers/api/graphql.php @@ -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') diff --git a/tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php b/tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php index 937361b78..f81528ede 100644 --- a/tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php +++ b/tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php @@ -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']); diff --git a/tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php b/tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php index beb0ac3b6..e41245bba 100644 --- a/tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php +++ b/tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php @@ -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);