Basic tests

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-10-09 19:30:42 +01:00
parent 3a77b83e9c
commit 9c4191ae0a
3 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,22 @@
<?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 LabelSettingTest extends TestCase
{
public function testPermissionRequiredToViewLabelSettings()
{
$this->actingAs(User::factory()->create())
->get(route('settings.labels.index'))
->assertForbidden();
}
}

View file

@ -0,0 +1,33 @@
<?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 LdapSettingsTests extends TestCase
{
public function testPermissionRequiredToViewLdapSettings()
{
$this->actingAs(User::factory()->create())
->get(route('settings.ldap.index'))
->assertForbidden();
}
public function testLdapSettingsCanBeSaved()
{
$response = $this->actingAs(User::factory()->superuser()->create())
->post(route('settings.alerts.save', ['ldap_enabled' => 1]))
->assertStatus(302)
->assertValid('alert_email')
->assertRedirect(route('settings.index'))
->assertSessionHasNoErrors();
$this->followRedirects($response)->assertSee('alert-success');
}
}

View file

@ -0,0 +1,22 @@
<?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 SecuritySettingTest extends TestCase
{
public function testPermissionRequiredToViewSecuritySettings()
{
$this->actingAs(User::factory()->create())
->get(route('settings.security.index'))
->assertForbidden();
}
}