1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

Update get -> list usages

This commit is contained in:
Jake Barnby 2022-09-21 19:03:28 +12:00
parent 6c9ac29f37
commit 378d02f269
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
8 changed files with 81 additions and 80 deletions

View file

@ -260,7 +260,7 @@ class GraphQLAccountTest extends Scope
$this->assertArrayNotHasKey('errors', $sessions['body']);
$this->assertIsArray($sessions['body']['data']);
$this->assertIsArray($sessions['body']['data']['accountGetSessions']);
$this->assertIsArray($sessions['body']['data']['accountListSessions']);
return $sessions;
}
@ -304,7 +304,7 @@ class GraphQLAccountTest extends Scope
$this->assertArrayNotHasKey('errors', $logs['body']);
$this->assertIsArray($logs['body']['data']);
$this->assertIsArray($logs['body']['data']['accountGetLogs']);
$this->assertIsArray($logs['body']['data']['accountListLogs']);
return $logs;
}

View file

@ -187,7 +187,7 @@ trait GraphQLBase
}
}';
case self::$GET_DATABASES:
return 'query getDatabases {
return 'query listDatabases {
databasesList {
total
databases {
@ -343,7 +343,7 @@ trait GraphQLBase
}
}';
case self::$GET_INDEXES:
return 'query getIndexes($databaseId: String!, $collectionId: String!) {
return 'query listIndexes($databaseId: String!, $collectionId: String!) {
databasesListIndexes(databaseId: $databaseId, collectionId: $collectionId) {
total
indexes {
@ -366,7 +366,7 @@ trait GraphQLBase
databasesDeleteIndex(databaseId: $databaseId, collectionId: $collectionId, key: $key)
}';
case self::$GET_ATTRIBUTES:
return 'query getAttributes($databaseId: String!, $collectionId: String!) {
return 'query listAttributes($databaseId: String!, $collectionId: String!) {
databasesListAttributes(databaseId: $databaseId, collectionId: $collectionId) {
total
attributes {
@ -509,8 +509,8 @@ trait GraphQLBase
}
}';
case self::$GET_USER_SESSIONS:
return 'query getUserSessions($userId : String!) {
usersGetSessions(userId : $userId) {
return 'query listUserSessions($userId : String!) {
usersListSessions(userId : $userId) {
total
sessions {
_id
@ -519,8 +519,8 @@ trait GraphQLBase
}
}';
case self::$GET_USER_MEMBERSHIPS:
return 'query getUserMemberships($userId : String!) {
usersGetMemberships(userId : $userId) {
return 'query listUserMemberships($userId : String!) {
usersListMemberships(userId : $userId) {
total
memberships {
_id
@ -530,8 +530,8 @@ trait GraphQLBase
}
}';
case self::$GET_USER_LOGS:
return 'query getUserLogs($userId : String!) {
usersGetLogs(userId : $userId) {
return 'query listUserLogs($userId : String!) {
usersListLogs(userId : $userId) {
total
logs {
event
@ -657,7 +657,7 @@ trait GraphQLBase
}';
case self::$LIST_COUNTRIES:
return 'query listCountries {
localeGetCountries{
localeListCountries{
total
countries {
name
@ -667,7 +667,7 @@ trait GraphQLBase
}';
case self::$LIST_EU_COUNTRIES:
return 'query listEuCountries {
localeGetCountriesEU{
localeListCountriesEU{
total
countries {
name
@ -677,7 +677,7 @@ trait GraphQLBase
}';
case self::$LIST_COUNTRY_PHONE_CODES:
return 'query listCountryPhoneCodes {
localeGetCountriesPhones {
localeListCountriesPhones {
total
phones {
code
@ -687,7 +687,7 @@ trait GraphQLBase
}';
case self::$LIST_CONTINENTS:
return 'query listContinents {
localeGetContinents{
localeListContinents{
total
continents {
name
@ -697,7 +697,7 @@ trait GraphQLBase
}';
case self::$LIST_CURRENCIES:
return 'query listCurrencies {
localeGetCurrencies{
localeListCurrencies{
total
currencies {
name
@ -708,7 +708,7 @@ trait GraphQLBase
}';
case self::$LIST_LANGUAGES:
return 'query listLanguages {
localeGetLanguages{
localeListLanguages{
total
languages {
name
@ -883,8 +883,8 @@ trait GraphQLBase
}
}';
case self::$GET_ACCOUNT_SESSIONS:
return 'query getAccountSessions {
accountGetSessions {
return 'query listAccountSessions {
accountListSessions {
total
sessions {
_id
@ -895,7 +895,7 @@ trait GraphQLBase
}';
case self::$GET_ACCOUNT_LOGS:
return 'query getAccountLogs {
accountGetLogs {
accountListLogs {
total
logs {
event
@ -1004,12 +1004,13 @@ trait GraphQLBase
}
}';
case self::$GET_TEAM_MEMBERSHIPS:
return 'query getTeamMemberships($teamId: String!){
teamsGetMemberships(teamId: $teamId) {
return 'query listTeamMemberships($teamId: String!){
teamsListMemberships(teamId: $teamId) {
total
memberships {
_id
teamId
userId
userName
userEmail
}

View file

@ -15,8 +15,8 @@ class GraphQLBatchTest extends Scope
public function testArrayBatchedQueries()
{
$projectId = $this->getProject()['$id'];
$query1 = 'query { localeGetCountries { total countries { code } } }';
$query2 = 'query { localeGetContinents { total continents { code } } }';
$query1 = 'query { localeListCountries { total countries { code } } }';
$query2 = 'query { localeListContinents { total continents { code } } }';
$graphQLPayload = [
['query' => $query1],
['query' => $query2],
@ -28,16 +28,16 @@ class GraphQLBatchTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertArrayHasKey('localeGetContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeGetContinents']['total']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertArrayHasKey('localeListContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeListContinents']['total']);
}
public function testArrayBatchedQueriesOfSameType()
{
$projectId = $this->getProject()['$id'];
$query = 'query { localeGetCountries { total countries { code } } }';
$query = 'query { localeListCountries { total countries { code } } }';
$graphQLPayload = [
['query' => $query],
['query' => $query],
@ -49,10 +49,10 @@ class GraphQLBatchTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total'][0]);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total'][1]);
$this->assertEquals(388, \count($response['body']['data']['localeGetCountries']['countries']));
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total'][0]);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total'][1]);
$this->assertEquals(388, \count($response['body']['data']['localeListCountries']['countries']));
}
public function testArrayBatchedMutations()
@ -145,8 +145,8 @@ class GraphQLBatchTest extends Scope
$projectId = $this->getProject()['$id'];
$email = 'tester' . \uniqid() . '@example.com';
$graphQLPayload = [
['query' => 'query { localeGetCountries { total countries { code } } }'],
['query' => 'query { localeGetContinents { total continents { code } } }'],
['query' => 'query { localeListCountries { total countries { code } } }'],
['query' => 'query { localeListContinents { total continents { code } } }'],
[
'query' => 'mutation CreateAccount($userId: String!, $email: String!, $password: String!, $name: String) {
accountCreate(userId: $userId, email: $email, password: $password, name: $name) {
@ -168,11 +168,11 @@ class GraphQLBatchTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertArrayHasKey('localeGetContinents', $response['body']['data']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertArrayHasKey('localeListContinents', $response['body']['data']);
$this->assertArrayHasKey('accountCreate', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeGetContinents']['total']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeListContinents']['total']);
$this->assertEquals('Tester 1', $response['body']['data']['accountCreate']['name']);
}
@ -180,7 +180,7 @@ class GraphQLBatchTest extends Scope
{
$projectId = $this->getProject()['$id'];
$email = 'tester' . \uniqid() . '@example.com';
$query = 'query { localeGetCountries { total countries { code } } }';
$query = 'query { localeListCountries { total countries { code } } }';
$graphQLPayload = [
['query' => $query],
['query' => $query],
@ -205,10 +205,10 @@ class GraphQLBatchTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertArrayHasKey('accountCreate', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total'][0]);
$this->assertEquals(388, \count($response['body']['data']['localeGetCountries']['countries']));
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total'][0]);
$this->assertEquals(388, \count($response['body']['data']['localeListCountries']['countries']));
$this->assertArrayHasKey('_id', $response['body']['data']['accountCreate']);
}
@ -217,8 +217,8 @@ class GraphQLBatchTest extends Scope
$projectId = $this->getProject()['$id'];
$query = '
query {
localeGetCountries { total countries { code } }
localeGetContinents { total continents { code } }
localeListCountries { total countries { code } }
localeListContinents { total continents { code } }
}
';
$graphQLPayload = [
@ -231,10 +231,10 @@ class GraphQLBatchTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertArrayHasKey('localeGetContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeGetContinents']['total']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertArrayHasKey('localeListContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeListContinents']['total']);
}
public function testQueryBatchedQueriesOfSameType()
@ -242,8 +242,8 @@ class GraphQLBatchTest extends Scope
$projectId = $this->getProject()['$id'];
$query = '
query {
localeGetCountries { total countries { code } }
localeGetCountries { total countries { code } }
localeListCountries { total countries { code } }
localeListCountries { total countries { code } }
}
';
$graphQLPayload = [
@ -256,8 +256,8 @@ class GraphQLBatchTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total']);
}
public function testQueryBatchedMutations()

View file

@ -17,7 +17,7 @@ class GraphQLContentTypeTest extends Scope
public function testGraphQLContentType()
{
$projectId = $this->getProject()['$id'];
$query = 'query { localeGetCountries { total countries { code } } }';
$query = 'query { localeListCountries { total countries { code } } }';
$graphQLPayload = [$query]; // Needs to be an array because the test client expects it
$response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/graphql',
@ -26,14 +26,14 @@ class GraphQLContentTypeTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$response = $response['body']['data']['localeGetCountries'];
$response = $response['body']['data']['localeListCountries'];
$this->assertEquals(194, $response['total']);
}
public function testSingleQueryJSONContentType()
{
$projectId = $this->getProject()['$id'];
$query = 'query { localeGetCountries { total countries { code } } }';
$query = 'query { localeListCountries { total countries { code } } }';
$graphQLPayload = ['query' => $query];
$response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/json',
@ -42,15 +42,15 @@ class GraphQLContentTypeTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$response = $response['body']['data']['localeGetCountries'];
$response = $response['body']['data']['localeListCountries'];
$this->assertEquals(194, $response['total']);
}
public function testArrayBatchedJSONContentType()
{
$projectId = $this->getProject()['$id'];
$query1 = 'query { localeGetCountries { total countries { code } } }';
$query2 = 'query { localeGetContinents { total continents { code } } }';
$query1 = 'query { localeListCountries { total countries { code } } }';
$query2 = 'query { localeListContinents { total continents { code } } }';
$graphQLPayload = [
['query' => $query1],
['query' => $query2],
@ -62,10 +62,10 @@ class GraphQLContentTypeTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertArrayHasKey('localeGetContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeGetContinents']['total']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertArrayHasKey('localeListContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeListContinents']['total']);
}
public function testQueryBatchedJSONContentType()
@ -73,8 +73,8 @@ class GraphQLContentTypeTest extends Scope
$projectId = $this->getProject()['$id'];
$query = '
query {
localeGetCountries { total countries { code } }
localeGetContinents { total continents { code } }
localeListCountries { total countries { code } }
localeListContinents { total continents { code } }
}
';
$graphQLPayload = [
@ -87,10 +87,10 @@ class GraphQLContentTypeTest extends Scope
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('localeGetCountries', $response['body']['data']);
$this->assertArrayHasKey('localeGetContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeGetCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeGetContinents']['total']);
$this->assertArrayHasKey('localeListCountries', $response['body']['data']);
$this->assertArrayHasKey('localeListContinents', $response['body']['data']);
$this->assertEquals(194, $response['body']['data']['localeListCountries']['total']);
$this->assertEquals(7, $response['body']['data']['localeListContinents']['total']);
}
public function testMultipartFormDataContentType()

View file

@ -46,7 +46,7 @@ class GraphQLLocalizationTest extends Scope
$this->assertIsArray($countries['body']['data']);
$this->assertArrayNotHasKey('errors', $countries['body']);
$countries = $countries['body']['data']['localeGetCountries'];
$countries = $countries['body']['data']['localeListCountries'];
$this->assertIsArray($countries);
$this->assertGreaterThan(0, \count($countries));
@ -68,7 +68,7 @@ class GraphQLLocalizationTest extends Scope
$this->assertIsArray($countries['body']['data']);
$this->assertArrayNotHasKey('errors', $countries['body']);
$countries = $countries['body']['data']['localeGetCountriesEU'];
$countries = $countries['body']['data']['localeListCountriesEU'];
$this->assertIsArray($countries);
$this->assertGreaterThan(0, \count($countries));
@ -90,7 +90,7 @@ class GraphQLLocalizationTest extends Scope
$this->assertIsArray($countries['body']['data']);
$this->assertArrayNotHasKey('errors', $countries['body']);
$countries = $countries['body']['data']['localeGetCountriesPhones'];
$countries = $countries['body']['data']['localeListCountriesPhones'];
$this->assertIsArray($countries);
$this->assertGreaterThan(0, \count($countries));
@ -112,7 +112,7 @@ class GraphQLLocalizationTest extends Scope
$this->assertIsArray($continents['body']['data']);
$this->assertArrayNotHasKey('errors', $continents['body']);
$continents = $continents['body']['data']['localeGetContinents'];
$continents = $continents['body']['data']['localeListContinents'];
$this->assertIsArray($continents);
$this->assertGreaterThan(0, \count($continents));
@ -134,7 +134,7 @@ class GraphQLLocalizationTest extends Scope
$this->assertIsArray($currencies['body']['data']);
$this->assertArrayNotHasKey('errors', $currencies['body']);
$currencies = $currencies['body']['data']['localeGetCurrencies'];
$currencies = $currencies['body']['data']['localeListCurrencies'];
$this->assertIsArray($currencies);
$this->assertGreaterThan(0, \count($currencies));
@ -156,7 +156,7 @@ class GraphQLLocalizationTest extends Scope
$this->assertIsArray($languages['body']['data']);
$this->assertArrayNotHasKey('errors', $languages['body']);
$languages = $languages['body']['data']['localeGetLanguages'];
$languages = $languages['body']['data']['localeListLanguages'];
$this->assertIsArray($languages);
$this->assertGreaterThan(0, \count($languages));

View file

@ -134,7 +134,7 @@ class GraphQLTeamsClientTest extends Scope
$this->assertIsArray($memberships['body']['data']);
$this->assertArrayNotHasKey('errors', $memberships['body']);
$this->assertIsArray($memberships['body']['data']['teamsGetMemberships']);
$this->assertIsArray($memberships['body']['data']['teamsListMemberships']);
}
/**
@ -158,7 +158,7 @@ class GraphQLTeamsClientTest extends Scope
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $graphQLPayload);
$this->assertIsArray($membership['body']['data']['teamsGetMembership']);
$this->assertIsArray($membership['body']['data']['teamsListMembership']);
$this->assertArrayNotHasKey('errors', $membership['body']);
}

View file

@ -133,7 +133,7 @@ class GraphQLTeamsServerTest extends Scope
$this->assertIsArray($memberships['body']['data']);
$this->assertArrayNotHasKey('errors', $memberships['body']);
$this->assertIsArray($memberships['body']['data']['teamsGetMemberships']);
$this->assertIsArray($memberships['body']['data']['teamsListMemberships']);
}
/**
@ -157,7 +157,7 @@ class GraphQLTeamsServerTest extends Scope
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $graphQLPayload);
$this->assertIsArray($membership['body']['data']['teamsGetMembership']);
$this->assertIsArray($membership['body']['data']['teamsListMembership']);
$this->assertArrayNotHasKey('errors', $membership['body']);
}

View file

@ -169,7 +169,7 @@ class GraphQLUsersTest extends Scope
$this->assertIsArray($user['body']['data']);
$this->assertArrayNotHasKey('errors', $user['body']);
$this->assertIsArray($user['body']['data']['usersGetLogs']);
$this->assertIsArray($user['body']['data']['usersListLogs']);
}
public function testUpdateUserStatus()