Added a setting test and validation on settings

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-16 10:51:49 +01:00
parent e8f1190628
commit 3167ee91d1
2 changed files with 26 additions and 0 deletions

View file

@ -74,7 +74,10 @@ class Setting extends Model
'login_remote_user_header_name' => 'string|nullable',
'thumbnail_max_h' => 'numeric|max:500|min:25',
'pwd_secure_min' => 'numeric|required|min:8',
'alert_threshold' => 'numeric|nullable',
'alert_interval' => 'numeric|nullable',
'audit_warning_days' => 'numeric|nullable',
'due_checkin_days' => 'numeric|nullable',
'audit_interval' => 'numeric|nullable',
'custom_forgot_pass_url' => 'url|nullable',
'privacy_policy_link' => 'nullable|url',

View file

@ -0,0 +1,23 @@
<?php
namespace Tests\Feature\Settings;
use App\Models\Asset;
use Tests\TestCase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use App\Models\User;
use App\Models\Setting;
class AlertsSettingTest extends TestCase
{
public function testPermissionRequiredToViewAlertSettings()
{
$asset = Asset::factory()->create();
$this->actingAs(User::factory()->create())
->get(route('settings.alerts.index'))
->assertForbidden();
}
}