mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Update permission tests
This commit is contained in:
parent
a20e03fce9
commit
dd97e4ea82
|
@ -4,11 +4,12 @@ namespace Tests\Feature\ReportTemplates;
|
|||
|
||||
use App\Models\ReportTemplate;
|
||||
use App\Models\User;
|
||||
use Tests\Concerns\TestsPermissionsRequirement;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CreateReportTemplateTest extends TestCase
|
||||
class CreateReportTemplateTest extends TestCase implements TestsPermissionsRequirement
|
||||
{
|
||||
public function testSavingReportTemplateRequiresCorrectPermission()
|
||||
public function testRequiresPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('report-templates.store'))
|
||||
|
|
|
@ -4,11 +4,12 @@ namespace Tests\Feature\ReportTemplates;
|
|||
|
||||
use App\Models\ReportTemplate;
|
||||
use App\Models\User;
|
||||
use Tests\Concerns\TestsPermissionsRequirement;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DeleteReportTemplateTest extends TestCase
|
||||
class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequirement
|
||||
{
|
||||
public function testDeletingReportTemplateRequiresCorrectPermission()
|
||||
public function testRequiresPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('report-templates.destroy', 1))
|
||||
|
|
|
@ -4,10 +4,18 @@ namespace Tests\Feature\ReportTemplates;
|
|||
|
||||
use App\Models\ReportTemplate;
|
||||
use App\Models\User;
|
||||
use Tests\Concerns\TestsPermissionsRequirement;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ShowReportTemplateTest extends TestCase
|
||||
class ShowReportTemplateTest extends TestCase implements TestsPermissionsRequirement
|
||||
{
|
||||
public function testRequiresPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get(route('reports/custom'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testCanLoadCustomReportPage()
|
||||
{
|
||||
$this->actingAs(User::factory()->canViewReports()->create())
|
||||
|
|
|
@ -4,11 +4,12 @@ namespace Tests\Feature\ReportTemplates;
|
|||
|
||||
use App\Models\ReportTemplate;
|
||||
use App\Models\User;
|
||||
use Tests\Concerns\TestsPermissionsRequirement;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UpdateReportTemplateTest extends TestCase
|
||||
class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequirement
|
||||
{
|
||||
public function testUpdatingReportTemplateRequiresCorrectPermission()
|
||||
public function testRequiresPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('report-templates.update', 1))
|
||||
|
|
Loading…
Reference in a new issue