remove "twoFactorAuthEnabled" from preferences. Kill switches for all code that references them (easier for refactor)

This commit is contained in:
James Cole
2019-08-03 19:46:12 +02:00
parent f8d2292fa8
commit 7f1bd19e45
13 changed files with 25 additions and 2 deletions

View File

@@ -102,6 +102,7 @@ class UserControllerTest extends TestCase
*/
public function testIndex(): void
{
die('this test references old 2FA code.');
$repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->times(3)->andReturn(true);
$user = $this->user();

View File

@@ -47,6 +47,7 @@ class TwoFactorControllerTest extends TestCase
*/
public function testIndex(): void
{
die('this test references old 2FA code.');
$this->mockDefaultConfiguration();
$this->be($this->user());
@@ -72,6 +73,7 @@ class TwoFactorControllerTest extends TestCase
*/
public function testIndexNo2FA(): void
{
die('this test references old 2FA code.');
$this->be($this->user());
$falsePreference = new Preference;
@@ -94,6 +96,7 @@ class TwoFactorControllerTest extends TestCase
*/
public function testIndexNoSecret(): void
{
die('this test references old 2FA code.');
$this->be($this->user());
$truePref = new Preference;
@@ -117,6 +120,7 @@ class TwoFactorControllerTest extends TestCase
*/
public function testLostTwoFactor(): void
{
die('this test references old 2FA code.');
$this->be($this->user());
$truePreference = new Preference;

View File

@@ -170,6 +170,7 @@ class ProfileControllerTest extends TestCase
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->atLeast()->once()->andReturn(false);
die('the references in this test to 2FA preferences must be refactored.');
Preferences::shouldReceive('delete')->withArgs(['twoFactorAuthEnabled'])->atLeast()->once();
Preferences::shouldReceive('delete')->withArgs(['twoFactorAuthSecret'])->atLeast()->once();
@@ -212,6 +213,7 @@ class ProfileControllerTest extends TestCase
Preferences::shouldReceive('set')->once()->withArgs(['twoFactorAuthEnabled', 1]);
//Preferences::shouldReceive('lastActivity')->once();
die('the references in this test to 2FA preferences must be refactored.');
$pref = new Preference;
$pref->data = false;
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->atLeast()->once()->andReturn($pref);
@@ -220,6 +222,7 @@ class ProfileControllerTest extends TestCase
$pref->data = 'super-secret';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->atLeast()->once()->andReturn($pref);
$view = new Preference;
$view->data = '1M';
Preferences::shouldReceive('get')->withArgs(['viewRange', Mockery::any()])->andReturn($view)->atLeast()->once();
@@ -446,6 +449,7 @@ class ProfileControllerTest extends TestCase
$this->withoutMiddleware();
$this->session(['two-factor-secret' => $secret]);
die('the references in this test to 2FA preferences must be refactored.');
Preferences::shouldReceive('set')->withArgs(['twoFactorAuthEnabled', 1])->once();
Preferences::shouldReceive('set')->withArgs(['twoFactorAuthSecret', $secret])->once();
Preferences::shouldReceive('mark')->once();

View File

@@ -451,6 +451,7 @@ abstract class TestCase extends BaseTestCase
$list = new Preference;
$list->data = 50;
die('the references in this test to 2FA preferences must be refactored.');
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($false);
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturnNull();
Preferences::shouldReceive('get')->withArgs(['viewRange', Mockery::any()])->andReturn($view);

View File

@@ -73,6 +73,7 @@ class AuthenticateTwoFactorTest extends TestCase
*/
public function testMiddlewareNoTwoFA(): void
{
die('this test references old 2FA code.');
$this->withoutExceptionHandling();
$user = $this->user();
$user->blocked = 0;
@@ -104,6 +105,7 @@ class AuthenticateTwoFactorTest extends TestCase
*/
public function testMiddlewareTwoFAAuthed(): void
{
die('this test references old 2FA code.');
$this->withoutExceptionHandling();
$user = $this->user();
$user->blocked = 0;
@@ -137,6 +139,7 @@ class AuthenticateTwoFactorTest extends TestCase
*/
public function testMiddlewareTwoFANoSecret(): void
{
die('this test references old 2FA code.');
$this->withoutExceptionHandling();
$user = $this->user();
$user->blocked = 0;
@@ -168,6 +171,7 @@ class AuthenticateTwoFactorTest extends TestCase
*/
public function testMiddlewareTwoFASecret(): void
{
die('this test references old 2FA code.');
$this->withoutExceptionHandling();
$user = $this->user();
$user->blocked = 0;

View File

@@ -64,6 +64,7 @@ class RedirectIf2FAAuthenticatedTest extends TestCase
*/
public function testMiddlewareAuthenticated(): void
{
die('this test references old 2FA code.');
// pref for has 2fa is true
$preference = new Preference;
$preference->data = true;