Удалена зависимость от yiisoft/yii2-codeception в пользу интегрированного в Codeception генератора REST адресов

Реорганизованы объекты Pages для Functional тестов
Исправлены не переименованные тесты, оставшиеся после последнего рефакторинга
This commit is contained in:
ErickSkrauch
2017-10-01 03:24:23 +03:00
parent f51bfcb20d
commit 0dbbb2e0de
20 changed files with 101 additions and 205 deletions

View File

@ -6,7 +6,7 @@ use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
class AccountBanCest {
class AccountsBanCest {
/**
* @var AccountsRoute

View File

@ -2,24 +2,24 @@
namespace tests\codeception\api\functional;
use OTPHP\TOTP;
use tests\codeception\api\_pages\TwoFactorAuthRoute;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
class TwoFactorAuthDisableCest {
class AccountsDisableTwoFactorAuthCest {
/**
* @var TwoFactorAuthRoute
* @var AccountsRoute
*/
private $route;
public function _before(FunctionalTester $I) {
$this->route = new TwoFactorAuthRoute($I);
$this->route = new AccountsRoute($I);
}
public function testFails(FunctionalTester $I) {
$accountId = $I->amAuthenticated('AccountWithEnabledOtp');
$this->route->disable($accountId);
$this->route->disableTwoFactorAuth($accountId);
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@ -28,7 +28,7 @@ class TwoFactorAuthDisableCest {
],
]);
$this->route->disable($accountId, '123456', 'invalid_password');
$this->route->disableTwoFactorAuth($accountId, '123456', 'invalid_password');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@ -38,7 +38,7 @@ class TwoFactorAuthDisableCest {
]);
$accountId = $I->amAuthenticated('AccountWithOtpSecret');
$this->route->disable($accountId, '123456', 'invalid_password');
$this->route->disableTwoFactorAuth($accountId, '123456', 'invalid_password');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@ -50,7 +50,7 @@ class TwoFactorAuthDisableCest {
public function testSuccessEnable(FunctionalTester $I) {
$accountId = $I->amAuthenticated('AccountWithEnabledOtp');
$totp = TOTP::create('BBBB');
$this->route->disable($accountId, $totp->now(), 'password_0');
$this->route->disableTwoFactorAuth($accountId, $totp->now(), 'password_0');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([

View File

@ -2,24 +2,24 @@
namespace tests\codeception\api\functional;
use OTPHP\TOTP;
use tests\codeception\api\_pages\TwoFactorAuthRoute;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
class TwoFactorAuthEnableCest {
class AccountsEnableTwoFactorAuthCest {
/**
* @var TwoFactorAuthRoute
* @var AccountsRoute
*/
private $route;
public function _before(FunctionalTester $I) {
$this->route = new TwoFactorAuthRoute($I);
$this->route = new AccountsRoute($I);
}
public function testFails(FunctionalTester $I) {
$accountId = $I->amAuthenticated('AccountWithOtpSecret');
$this->route->enable($accountId);
$this->route->enableTwoFactorAuth($accountId);
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@ -28,7 +28,7 @@ class TwoFactorAuthEnableCest {
],
]);
$this->route->enable($accountId, '123456', 'invalid_password');
$this->route->enableTwoFactorAuth($accountId, '123456', 'invalid_password');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@ -38,7 +38,7 @@ class TwoFactorAuthEnableCest {
]);
$accountId = $I->amAuthenticated('AccountWithEnabledOtp');
$this->route->enable($accountId, '123456', 'invalid_password');
$this->route->enableTwoFactorAuth($accountId, '123456', 'invalid_password');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@ -50,7 +50,7 @@ class TwoFactorAuthEnableCest {
public function testSuccessEnable(FunctionalTester $I) {
$accountId = $I->amAuthenticated('AccountWithOtpSecret');
$totp = TOTP::create('AAAA');
$this->route->enable($accountId, $totp->now(), 'password_0');
$this->route->enableTwoFactorAuth($accountId, $totp->now(), 'password_0');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([

View File

@ -6,7 +6,7 @@ use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\functional\_steps\OauthSteps;
use tests\codeception\api\FunctionalTester;
class AccountPardonCest {
class AccountsPardonCest {
/**
* @var AccountsRoute

View File

@ -1,23 +1,23 @@
<?php
namespace tests\codeception\api\functional;
use tests\codeception\api\_pages\TwoFactorAuthRoute;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
class TwoFactorAuthCredentialsCest {
class AccountsTwoFactorAuthCredentialsCest {
/**
* @var TwoFactorAuthRoute
* @var AccountsRoute
*/
private $route;
public function _before(FunctionalTester $I) {
$this->route = new TwoFactorAuthRoute($I);
$this->route = new AccountsRoute($I);
}
public function testGetCredentials(FunctionalTester $I) {
$accountId = $I->amAuthenticated();
$this->route->credentials($accountId);
$this->route->getTwoFactorAuthCredentials($accountId);
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseJsonMatchesJsonPath('$.secret');