Multi-user OSINT investigation tool with owner-controlled per-user and per-group access grants. Includes Sherlock, theHarvester, crt.sh, WHOIS, and ip-api.com collectors wired through a pluggable Runner/queue pipeline, investigation search, and printable/CSV/JSON reporting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Investigation;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class InvestigationDeletionTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_owner_can_delete_investigation_and_its_targets_cascade(): void
|
|
{
|
|
$owner = User::factory()->create();
|
|
$investigation = Investigation::factory()->for($owner, 'owner')->create();
|
|
$target = $investigation->targets()->create([
|
|
'type' => 'username',
|
|
'value' => 'someone',
|
|
'created_by' => $owner->id,
|
|
]);
|
|
|
|
$this->actingAs($owner)
|
|
->delete(route('investigations.destroy', $investigation))
|
|
->assertRedirect(route('investigations.index'));
|
|
|
|
$this->assertDatabaseMissing('investigations', ['id' => $investigation->id]);
|
|
$this->assertDatabaseMissing('targets', ['id' => $target->id]);
|
|
}
|
|
|
|
public function test_editor_cannot_delete_investigation(): void
|
|
{
|
|
$owner = User::factory()->create();
|
|
$editor = User::factory()->create();
|
|
$investigation = Investigation::factory()->for($owner, 'owner')->create();
|
|
$investigation->users()->attach($editor, ['role' => 'editor']);
|
|
|
|
$this->actingAs($editor)
|
|
->delete(route('investigations.destroy', $investigation))
|
|
->assertForbidden();
|
|
|
|
$this->assertDatabaseHas('investigations', ['id' => $investigation->id]);
|
|
}
|
|
}
|