mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Fixes #17. Simplify redirect_uri validation rules to allow localhost
This commit is contained in:
@@ -6,43 +6,14 @@ namespace api\tests\functional\dev\applications;
|
||||
use api\tests\_pages\OauthRoute;
|
||||
use api\tests\FunctionalTester;
|
||||
|
||||
class CreateClientCest {
|
||||
final class CreateClientCest {
|
||||
|
||||
/**
|
||||
* @var OauthRoute
|
||||
*/
|
||||
private $route;
|
||||
private OauthRoute $route;
|
||||
|
||||
public function _before(FunctionalTester $I) {
|
||||
$this->route = new OauthRoute($I);
|
||||
}
|
||||
|
||||
public function testCreateApplicationWithWrongParams(FunctionalTester $I) {
|
||||
$I->amAuthenticated('admin');
|
||||
|
||||
$this->route->createClient('application', []);
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'name' => 'error.name_required',
|
||||
'redirectUri' => 'error.redirectUri_required',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->route->createClient('application', [
|
||||
'name' => 'my test oauth client',
|
||||
'redirectUri' => 'localhost',
|
||||
]);
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'redirectUri' => 'error.redirectUri_invalid',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testCreateApplication(FunctionalTester $I) {
|
||||
$I->amAuthenticated('admin');
|
||||
$this->route->createClient('application', [
|
||||
@@ -109,4 +80,18 @@ class CreateClientCest {
|
||||
]);
|
||||
}
|
||||
|
||||
public function testCreateApplicationWithWrongParams(FunctionalTester $I): void {
|
||||
$I->amAuthenticated('admin');
|
||||
|
||||
$this->route->createClient('application', []);
|
||||
$I->canSeeResponseCodeIs(200);
|
||||
$I->canSeeResponseContainsJson([
|
||||
'success' => false,
|
||||
'errors' => [
|
||||
'name' => 'error.name_required',
|
||||
'redirectUri' => 'error.redirectUri_required',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user