mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-16 16:41:03 +02:00
Set SettingService behind a Facade
This commit is contained in:
@ -4,12 +4,12 @@ namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Group;
|
||||
use App\Facades\Settings;
|
||||
use Tests\FeatureTestCase;
|
||||
use Tests\Classes\OtpTestData;
|
||||
use App\Models\TwoFAccount;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
|
||||
|
||||
/**
|
||||
@ -393,8 +393,7 @@ class TwoFAccountControllerTest extends FeatureTestCase
|
||||
public function test_store_assigns_created_account_when_default_group_is_a_specific_one()
|
||||
{
|
||||
// Set the default group to a specific one
|
||||
$settingService = resolve('App\Services\SettingService');
|
||||
$settingService->set('defaultGroup', $this->group->id);
|
||||
Settings::set('defaultGroup', $this->group->id);
|
||||
|
||||
$response = $this->actingAs($this->user, 'api-guard')
|
||||
->json('POST', '/api/v1/twofaccounts', [
|
||||
@ -411,12 +410,10 @@ class TwoFAccountControllerTest extends FeatureTestCase
|
||||
*/
|
||||
public function test_store_assigns_created_account_when_default_group_is_the_active_one()
|
||||
{
|
||||
$settingService = resolve('App\Services\SettingService');
|
||||
|
||||
// Set the default group to be the active one
|
||||
$settingService->set('defaultGroup', -1);
|
||||
Settings::set('defaultGroup', -1);
|
||||
// Set the active group
|
||||
$settingService->set('activeGroup', $this->group->id);
|
||||
Settings::set('activeGroup', $this->group->id);
|
||||
|
||||
$response = $this->actingAs($this->user, 'api-guard')
|
||||
->json('POST', '/api/v1/twofaccounts', [
|
||||
@ -433,10 +430,8 @@ class TwoFAccountControllerTest extends FeatureTestCase
|
||||
*/
|
||||
public function test_store_assigns_created_account_when_default_group_is_no_group()
|
||||
{
|
||||
$settingService = resolve('App\Services\SettingService');
|
||||
|
||||
// Set the default group to No group
|
||||
$settingService->set('defaultGroup', 0);
|
||||
Settings::set('defaultGroup', 0);
|
||||
|
||||
$response = $this->actingAs($this->user, 'api-guard')
|
||||
->json('POST', '/api/v1/twofaccounts', [
|
||||
@ -453,10 +448,8 @@ class TwoFAccountControllerTest extends FeatureTestCase
|
||||
*/
|
||||
public function test_store_assigns_created_account_when_default_group_does_not_exist()
|
||||
{
|
||||
$settingService = resolve('App\Services\SettingService');
|
||||
|
||||
// Set the default group to a non-existing one
|
||||
$settingService->set('defaultGroup', 1000);
|
||||
Settings::set('defaultGroup', 1000);
|
||||
|
||||
$response = $this->actingAs($this->user, 'api-guard')
|
||||
->json('POST', '/api/v1/twofaccounts', [
|
||||
@ -836,8 +829,7 @@ class TwoFAccountControllerTest extends FeatureTestCase
|
||||
*/
|
||||
public function test_get_otp_using_indecipherable_twofaccount_id_returns_bad_request()
|
||||
{
|
||||
$settingService = resolve('App\Services\SettingService');
|
||||
$settingService->set('useEncryption', true);
|
||||
Settings::set('useEncryption', true);
|
||||
|
||||
$twofaccount = TwoFAccount::factory()->create();
|
||||
|
||||
|
Reference in New Issue
Block a user