Fix tests
This commit is contained in:
parent
2ccfd89681
commit
675dec48b3
2 changed files with 11 additions and 13 deletions
|
@ -291,7 +291,7 @@ class AccountCustomClientTest extends Scope
|
|||
$this->assertNotEmpty($response['body']['logs']);
|
||||
$this->assertCount(3, $response['body']['logs']);
|
||||
$this->assertIsNumeric($response['body']['total']);
|
||||
$this->assertEquals("session.create", $response['body']['logs'][2]['event']);
|
||||
$this->assertEquals("user.create", $response['body']['logs'][2]['event']);
|
||||
$this->assertEquals(filter_var($response['body']['logs'][2]['ip'], FILTER_VALIDATE_IP), $response['body']['logs'][2]['ip']);
|
||||
$this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['logs'][2]['time']));
|
||||
|
||||
|
@ -313,10 +313,6 @@ class AccountCustomClientTest extends Scope
|
|||
$this->assertEquals('--', $response['body']['logs'][1]['countryCode']);
|
||||
$this->assertEquals('Unknown', $response['body']['logs'][1]['countryName']);
|
||||
|
||||
$this->assertEquals("user.create", $response['body']['logs'][3]['event']);
|
||||
$this->assertEquals(filter_var($response['body']['logs'][3]['ip'], FILTER_VALIDATE_IP), $response['body']['logs'][3]['ip']);
|
||||
$this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['logs'][2]['time']));
|
||||
|
||||
$this->assertEquals('Windows', $response['body']['logs'][2]['osName']);
|
||||
$this->assertEquals('WIN', $response['body']['logs'][2]['osCode']);
|
||||
$this->assertEquals('10', $response['body']['logs'][2]['osVersion']);
|
||||
|
@ -368,7 +364,7 @@ class AccountCustomClientTest extends Scope
|
|||
$this->assertEquals($responseOffset['headers']['status-code'], 200);
|
||||
$this->assertIsArray($responseOffset['body']['logs']);
|
||||
$this->assertNotEmpty($responseOffset['body']['logs']);
|
||||
$this->assertCount(3, $responseOffset['body']['logs']);
|
||||
$this->assertCount(2, $responseOffset['body']['logs']);
|
||||
$this->assertIsNumeric($responseOffset['body']['total']);
|
||||
|
||||
$this->assertEquals($response['body']['logs'][1], $responseOffset['body']['logs'][0]);
|
||||
|
@ -2242,12 +2238,15 @@ class AccountCustomClientTest extends Scope
|
|||
$this->assertEmpty($response['body']['secret']);
|
||||
$this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['expire']));
|
||||
|
||||
\sleep(15);
|
||||
\sleep(5);
|
||||
|
||||
$smsRequest = $this->getLastRequest();
|
||||
|
||||
$message = $smsRequest['data']['message'];
|
||||
$token = substr($message, 0, 6);
|
||||
|
||||
return \array_merge($data, [
|
||||
'token' => $smsRequest['data']['secret']
|
||||
'token' => $token
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,9 @@ class AccountCustomServerTest extends Scope
|
|||
$this->assertNotEmpty($response['body']['secret']);
|
||||
$this->assertNotFalse(\DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $response['body']['expire']));
|
||||
|
||||
// already logged in
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
@ -72,11 +74,8 @@ class AccountCustomServerTest extends Scope
|
|||
'password' => $password,
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertEquals(401, $response['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
$response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
|
|
Loading…
Reference in a new issue