1
0
Fork 0
mirror of synced 2024-06-28 11:10:46 +12:00

Updated test values

This commit is contained in:
Eldad Fux 2020-08-09 18:03:52 +03:00
parent 49e24b726d
commit 5e5035bd2e
5 changed files with 37 additions and 37 deletions

View file

@ -566,15 +566,15 @@ trait AccountBase
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([
$response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [
'prefs' => [
'key1' => 'value1',
'key2' => 'value2',
'prefKey1' => 'prefValue1',
'prefKey2' => 'prefValue2',
]
]);
@ -582,13 +582,13 @@ trait AccountBase
$this->assertIsArray($response['body']);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']);
$this->assertEquals('value1', $response['body']['key1']);
$this->assertEquals('value2', $response['body']['key2']);
$this->assertEquals('prefValue1', $response['body']['prefKey1']);
$this->assertEquals('prefValue2', $response['body']['prefKey2']);
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([
$response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@ -596,7 +596,7 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 401);
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([
$response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@ -608,7 +608,7 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 400);
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([
$response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@ -619,7 +619,7 @@ trait AccountBase
$this->assertEquals($response['headers']['status-code'], 400);
$response = $this->client->call(Client::METHOD_PUT, '/account/prefs', array_merge([
$response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],

View file

@ -24,9 +24,9 @@ class FunctionsConsoleClientTest extends Scope
], $this->getHeaders()), [
'name' => 'Test',
'vars' => [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
'funcKey3' => 'funcValue3',
],
'events' => [
'account.create',

View file

@ -26,9 +26,9 @@ class FunctionsConsoleServerTest extends Scope
'name' => 'Test',
'env' => 'php-7.4',
'vars' => [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
'funcKey3' => 'funcValue3',
],
'events' => [
'account.create',
@ -48,9 +48,9 @@ class FunctionsConsoleServerTest extends Scope
$this->assertIsInt($response1['body']['dateUpdated']);
$this->assertEquals('', $response1['body']['tag']);
$this->assertEquals([
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
'funcKey3' => 'funcValue3',
], $response1['body']['vars']);
$this->assertEquals([
'account.create',

View file

@ -132,24 +132,24 @@ trait UsersBase
/**
* Test for SUCCESS
*/
$user = $this->client->call(Client::METHOD_PUT, '/users/' . $data['userId'] . '/prefs', array_merge([
$user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'prefs' => [
'key1' => 'value1',
'key2' => 'value2',
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
],
]);
$this->assertEquals($user['headers']['status-code'], 200);
$this->assertEquals($user['body']['key1'], 'value1');
$this->assertEquals($user['body']['key2'], 'value2');
$this->assertEquals($user['body']['funcKey1'], 'funcValue1');
$this->assertEquals($user['body']['funcKey2'], 'funcValue2');
/**
* Test for FAILURE
*/
$user = $this->client->call(Client::METHOD_PUT, '/users/' . $data['userId'] . '/prefs', array_merge([
$user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
@ -158,7 +158,7 @@ trait UsersBase
$this->assertEquals($user['headers']['status-code'], 400);
$user = $this->client->call(Client::METHOD_PUT, '/users/' . $data['userId'] . '/prefs', array_merge([
$user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));

View file

@ -35,32 +35,32 @@ class EventTest extends TestCase
public function testParams()
{
$this->object
->setParam('key1', 'value1')
->setParam('key2', 'value2')
->setParam('eventKey1', 'eventValue1')
->setParam('eventKey2', 'eventValue2')
;
$this->object->trigger();
$this->assertEquals(null, $this->object->getParam('key1'));
$this->assertEquals(null, $this->object->getParam('key2'));
$this->assertEquals(null, $this->object->getParam('key3'));
$this->assertEquals(null, $this->object->getParam('eventKey1'));
$this->assertEquals(null, $this->object->getParam('eventKey2'));
$this->assertEquals(null, $this->object->getParam('eventKey3'));
$this->assertEquals(\Resque::size($this->queue), 1);
}
public function testReset()
{
$this->object
->setParam('key1', 'value1')
->setParam('key2', 'value2')
->setParam('eventKey1', 'eventValue1')
->setParam('eventKey2', 'eventValue2')
;
$this->assertEquals('value1', $this->object->getParam('key1'));
$this->assertEquals('value2', $this->object->getParam('key2'));
$this->assertEquals('eventValue1', $this->object->getParam('eventKey1'));
$this->assertEquals('eventValue2', $this->object->getParam('eventKey2'));
$this->object->reset();
$this->assertEquals(null, $this->object->getParam('key1'));
$this->assertEquals(null, $this->object->getParam('key2'));
$this->assertEquals(null, $this->object->getParam('key3'));
$this->assertEquals(null, $this->object->getParam('eventKey1'));
$this->assertEquals(null, $this->object->getParam('eventKey2'));
$this->assertEquals(null, $this->object->getParam('eventKey3'));
}
}