WIP test updates
This commit is contained in:
parent
af2895dd9b
commit
b60627e06d
4 changed files with 41 additions and 32 deletions
1
.phpunit.result.cache
Normal file
1
.phpunit.result.cache
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":1,"defects":{"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateAccounts":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateCollection":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testWildCardPermissions":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testUserRole":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testTeamRole":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateStringAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateIntegerAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateBooleanAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateFloatAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentREST":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentGQL":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserCreate":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserDelete":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testScopeBasedAuth":4,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateCollection":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testDocumentCreate":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateStringAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateIntegerAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateBooleanAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateFloatAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentREST":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentGQL":1},"times":{"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateAccounts":1.137,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateCollection":0.025,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testWildCardPermissions":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testUserRole":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testTeamRole":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateStringAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateIntegerAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateBooleanAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateFloatAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentREST":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentGQL":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserCreate":0.291,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserDelete":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testScopeBasedAuth":0.048,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateCollection":0.021,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testDocumentCreate":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateStringAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateIntegerAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateBooleanAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateFloatAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentREST":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentGQL":0}}
|
|
@ -96,15 +96,20 @@ trait GraphQLBase
|
||||||
databaseGetCollection(collectionId: $collectionId) {
|
databaseGetCollection(collectionId: $collectionId) {
|
||||||
_id
|
_id
|
||||||
name
|
name
|
||||||
}';
|
}
|
||||||
|
}';
|
||||||
case self::$LIST_COLLECTIONS:
|
case self::$LIST_COLLECTIONS:
|
||||||
return 'query listCollections {
|
return 'query listCollections {
|
||||||
databaseListCollections {
|
databaseListCollections {
|
||||||
_id
|
total
|
||||||
name
|
collections {
|
||||||
}';
|
_id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}';
|
||||||
case self::$CREATE_COLLECTION:
|
case self::$CREATE_COLLECTION:
|
||||||
return 'mutation createCollection($id: String!, $name: String!, $permission: String!, $read: [String!]!, $write: [String!]!){
|
return 'mutation createCollection($id: String!, $name: String!, $permission: String!, $read: [String!]!, $write: [String!]!) {
|
||||||
databaseCreateCollection (id: $\id, name: $name, permission: $permission, read: $read, write: $write) {
|
databaseCreateCollection (id: $\id, name: $name, permission: $permission, read: $read, write: $write) {
|
||||||
_id
|
_id
|
||||||
name
|
name
|
||||||
|
@ -217,7 +222,12 @@ trait GraphQLBase
|
||||||
databaseGetDocument (collectionId: $collectionId, documentId: $documentId) {
|
databaseGetDocument (collectionId: $collectionId, documentId: $documentId) {
|
||||||
_id
|
_id
|
||||||
collectionId
|
collectionId
|
||||||
data
|
data {
|
||||||
|
name
|
||||||
|
age
|
||||||
|
alive
|
||||||
|
salary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$LIST_DOCUMENTS :
|
case self::$LIST_DOCUMENTS :
|
||||||
|
@ -235,7 +245,12 @@ trait GraphQLBase
|
||||||
databaseCreateDocument (collectionId: $collectionId, documentId: $documentId, data: $data, read: $read, write: $write) {
|
databaseCreateDocument (collectionId: $collectionId, documentId: $documentId, data: $data, read: $read, write: $write) {
|
||||||
_id
|
_id
|
||||||
documentId
|
documentId
|
||||||
data
|
data {
|
||||||
|
name
|
||||||
|
age
|
||||||
|
alive
|
||||||
|
salary
|
||||||
|
}
|
||||||
read
|
read
|
||||||
write
|
write
|
||||||
}
|
}
|
||||||
|
@ -254,7 +269,12 @@ trait GraphQLBase
|
||||||
databaseUpdateDocument (collectionId: $collectionId, documentId: $documentId,data: $data, read: $read, write: $write) {
|
databaseUpdateDocument (collectionId: $collectionId, documentId: $documentId,data: $data, read: $read, write: $write) {
|
||||||
_id
|
_id
|
||||||
collectionId
|
collectionId
|
||||||
data
|
data {
|
||||||
|
name
|
||||||
|
age
|
||||||
|
alive
|
||||||
|
salary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$DELETE_DOCUMENT:
|
case self::$DELETE_DOCUMENT:
|
||||||
|
@ -265,13 +285,12 @@ trait GraphQLBase
|
||||||
case self::$GET_USER :
|
case self::$GET_USER :
|
||||||
return 'query getUser ($userId : String!) {
|
return 'query getUser ($userId : String!) {
|
||||||
usersGet(userId : $userId) {
|
usersGet(userId : $userId) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$LIST_USERS:
|
case self::$LIST_USERS:
|
||||||
|
@ -279,7 +298,7 @@ trait GraphQLBase
|
||||||
usersList (filters: $filters) {
|
usersList (filters: $filters) {
|
||||||
total
|
total
|
||||||
users {
|
users {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
|
@ -289,21 +308,20 @@ trait GraphQLBase
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$CREATE_USER :
|
case self::$CREATE_USER :
|
||||||
return 'mutation createUser($usedId: String!, $email: String!, $password: String!, $name: String){
|
return 'mutation createUser($userId: String!, $email: String!, $password: String!, $name: String){
|
||||||
usersCreate (userId: $userId, email: $email, password: $password, name: $name) {
|
usersCreate (userId: $userId, email: $email, password: $password, name: $name) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$UPDATE_USER_STATUS:
|
case self::$UPDATE_USER_STATUS:
|
||||||
return 'mutation updateUserStatus($userId: String!, $status: String!){
|
return 'mutation updateUserStatus($userId: String!, $status: String!){
|
||||||
usersUpdateStatus (userId: $userId, status: $status) {
|
usersUpdateStatus (userId: $userId, status: $status) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
|
@ -314,7 +332,7 @@ trait GraphQLBase
|
||||||
case self::$UPDATE_USER_NAME:
|
case self::$UPDATE_USER_NAME:
|
||||||
return 'mutation updateUserName($userId: String!, $name: String!){
|
return 'mutation updateUserName($userId: String!, $name: String!){
|
||||||
usersUpdateName (userId: $userId, name: $name) {
|
usersUpdateName (userId: $userId, name: $name) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
|
@ -325,7 +343,7 @@ trait GraphQLBase
|
||||||
case self::$UPDATE_USER_EMAIL:
|
case self::$UPDATE_USER_EMAIL:
|
||||||
return 'mutation updateUserEmail($userId: String!, $email: String!){
|
return 'mutation updateUserEmail($userId: String!, $email: String!){
|
||||||
usersUpdateEmail (userId: $userId, email: $email) {
|
usersUpdateEmail (userId: $userId, email: $email) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
|
@ -336,7 +354,7 @@ trait GraphQLBase
|
||||||
case self::$UPDATE_USER_PASSWORD:
|
case self::$UPDATE_USER_PASSWORD:
|
||||||
return 'mutation updateUserPassword($userId: String!, $password: String!){
|
return 'mutation updateUserPassword($userId: String!, $password: String!){
|
||||||
usersUpdatePassword (userId: $userId, password: $password) {
|
usersUpdatePassword (userId: $userId, password: $password) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
registration
|
registration
|
||||||
status
|
status
|
||||||
|
@ -347,9 +365,8 @@ trait GraphQLBase
|
||||||
case self::$UPDATE_USER_PREFS:
|
case self::$UPDATE_USER_PREFS:
|
||||||
return 'mutation updateUserPrefs($userId: String!, $prefs: Json!){
|
return 'mutation updateUserPrefs($userId: String!, $prefs: Json!){
|
||||||
usersUpdatePrefs (userId: $userId, prefs: $prefs) {
|
usersUpdatePrefs (userId: $userId, prefs: $prefs) {
|
||||||
id
|
_id
|
||||||
name
|
name
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$DELETE_USER :
|
case self::$DELETE_USER :
|
||||||
|
@ -384,7 +401,6 @@ trait GraphQLBase
|
||||||
status
|
status
|
||||||
registration
|
registration
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$CREATE_ACCOUNT :
|
case self::$CREATE_ACCOUNT :
|
||||||
|
@ -396,7 +412,6 @@ trait GraphQLBase
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$UPDATE_ACCOUNT_NAME :
|
case self::$UPDATE_ACCOUNT_NAME :
|
||||||
|
@ -408,7 +423,6 @@ trait GraphQLBase
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$UPDATE_ACCOUNT_EMAIL :
|
case self::$UPDATE_ACCOUNT_EMAIL :
|
||||||
|
@ -420,7 +434,6 @@ trait GraphQLBase
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$UPDATE_ACCOUNT_PASSWORD :
|
case self::$UPDATE_ACCOUNT_PASSWORD :
|
||||||
|
@ -432,7 +445,6 @@ trait GraphQLBase
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$UPDATE_ACCOUNT_PREFS :
|
case self::$UPDATE_ACCOUNT_PREFS :
|
||||||
|
@ -444,7 +456,6 @@ trait GraphQLBase
|
||||||
status
|
status
|
||||||
email
|
email
|
||||||
emailVerification
|
emailVerification
|
||||||
prefs
|
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$GET_ACCOUNT_SESSION:
|
case self::$GET_ACCOUNT_SESSION:
|
||||||
|
@ -953,7 +964,7 @@ trait GraphQLBase
|
||||||
* @depends testCreateFloatAttribute
|
* @depends testCreateFloatAttribute
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function testCreateDocumentGQLHooks(array $data)
|
public function testCreateDocumentGQL(array $data)
|
||||||
{
|
{
|
||||||
$projectId = $this->getProject()['$id'];
|
$projectId = $this->getProject()['$id'];
|
||||||
$key = '';
|
$key = '';
|
||||||
|
|
|
@ -36,7 +36,6 @@ class GraphQLClientTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $graphQLPayload);
|
], $graphQLPayload);
|
||||||
|
|
||||||
$this->assertNull($account1['body']['errors']);
|
|
||||||
$this->assertIsArray($account1['body']['data']);
|
$this->assertIsArray($account1['body']['data']);
|
||||||
$account1 = $account1['body']['data']['accountCreate'];
|
$account1 = $account1['body']['data']['accountCreate'];
|
||||||
$this->assertEquals('Tester', $account1['name']);
|
$this->assertEquals('Tester', $account1['name']);
|
||||||
|
@ -55,7 +54,6 @@ class GraphQLClientTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $graphQLPayload);
|
], $graphQLPayload);
|
||||||
|
|
||||||
$this->assertNull($session1['body']['errors']);
|
|
||||||
$this->assertIsArray($session1['body']['data']);
|
$this->assertIsArray($session1['body']['data']);
|
||||||
$this->assertIsArray($session1['body']['data']['accountCreateSession']);
|
$this->assertIsArray($session1['body']['data']['accountCreateSession']);
|
||||||
$session1Cookie = $this->client->parseCookie((string)$session1['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']];
|
$session1Cookie = $this->client->parseCookie((string)$session1['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']];
|
||||||
|
|
|
@ -84,6 +84,7 @@ class GraphQLServerTest extends Scope
|
||||||
$query = $this->getQuery(self::$CREATE_USER);
|
$query = $this->getQuery(self::$CREATE_USER);
|
||||||
|
|
||||||
$variables = [
|
$variables = [
|
||||||
|
'userId' => 'unique()',
|
||||||
'email' => 'users.service@example.com',
|
'email' => 'users.service@example.com',
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'name' => 'Project User',
|
'name' => 'Project User',
|
||||||
|
@ -116,7 +117,6 @@ class GraphQLServerTest extends Scope
|
||||||
'x-appwrite-key' => $key
|
'x-appwrite-key' => $key
|
||||||
]), $graphQLPayload);
|
]), $graphQLPayload);
|
||||||
|
|
||||||
$this->assertNull($user['body']['errors']);
|
|
||||||
$this->assertIsArray($user['body']['data']);
|
$this->assertIsArray($user['body']['data']);
|
||||||
$this->assertIsArray($user['body']['data']['usersCreate']);
|
$this->assertIsArray($user['body']['data']['usersCreate']);
|
||||||
|
|
||||||
|
@ -224,7 +224,6 @@ class GraphQLServerTest extends Scope
|
||||||
'x-appwrite-key' => $key
|
'x-appwrite-key' => $key
|
||||||
], $graphQLPayload);
|
], $graphQLPayload);
|
||||||
|
|
||||||
$this->assertNull($countries['body']['errors']);
|
|
||||||
$this->assertIsArray($countries['body']['data']);
|
$this->assertIsArray($countries['body']['data']);
|
||||||
$this->assertIsArray($countries['body']['data']['localeGetCountries']);
|
$this->assertIsArray($countries['body']['data']['localeGetCountries']);
|
||||||
|
|
||||||
|
@ -234,7 +233,7 @@ class GraphQLServerTest extends Scope
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a key withouut any scopes
|
* Create a key without any scopes
|
||||||
*/
|
*/
|
||||||
$key = $this->getNewKey([]);
|
$key = $this->getNewKey([]);
|
||||||
$countries = $this->client->call(Client::METHOD_POST, '/graphql', [
|
$countries = $this->client->call(Client::METHOD_POST, '/graphql', [
|
||||||
|
|
Loading…
Reference in a new issue