mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 07:38:29 +00:00
Fix unit tests
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Helpers;
|
||||
namespace Tests\Unit\Middleware;
|
||||
|
||||
use FireflyIII\Http\Middleware\AuthenticateTwoFactor;
|
||||
use FireflyIII\Models\Preference;
|
||||
@@ -46,32 +46,6 @@ class AuthenticateTwoFactorTest extends TestCase
|
||||
$response->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Middleware\AuthenticateTwoFactor::handle
|
||||
*/
|
||||
public function testMiddlewareAjax()
|
||||
{
|
||||
$server = ['HTTP_X-Requested-With' => 'XMLHttpRequest'];
|
||||
$this->withoutExceptionHandling();
|
||||
$response = $this->get('/_test/authenticate', $server);
|
||||
$this->assertEquals(Response::HTTP_UNAUTHORIZED, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Middleware\AuthenticateTwoFactor::handle
|
||||
*/
|
||||
public function testMiddlewareBlockedUser()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$user = $this->user();
|
||||
$user->blocked = 1;
|
||||
$this->be($user);
|
||||
$response = $this->get('/_test/authenticate');
|
||||
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
|
||||
$response->assertSessionHas('logoutMessage', strval(trans('firefly.block_account_logout')));
|
||||
$response->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
/**
|
||||
* tests for user with no 2FA, should just go to requested page.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user