mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Добавлен роут и логика для обновления access_token по refresh_token'у
This commit is contained in:
32
tests/codeception/api/functional/RefreshTokenCest.php
Normal file
32
tests/codeception/api/functional/RefreshTokenCest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace codeception\api\functional;
|
||||
|
||||
use tests\codeception\api\_pages\AuthenticationRoute;
|
||||
use tests\codeception\api\FunctionalTester;
|
||||
|
||||
class RefreshTokenCest {
|
||||
|
||||
public function testRefreshInvalidToken(FunctionalTester $I) {
|
||||
$route = new AuthenticationRoute($I);
|
||||
|
||||
$I->wantTo('get error.refresh_token_not_exist if passed token is invalid');
|
||||
$route->refreshToken('invalid-token');
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'refresh_token' => 'error.refresh_token_not_exist',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testRefreshToken(FunctionalTester $I) {
|
||||
$route = new AuthenticationRoute($I);
|
||||
|
||||
$I->wantTo('get new access_token by my refresh_token');
|
||||
$route->refreshToken('SOutIr6Seeaii3uqMVy3Wan8sKFVFrNz');
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeAuthCredentials(false);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user