updates for active directory now with docs
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\ActiveDirectory;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\ActiveDirectory\Services\ActiveDirectory;
|
||||
|
||||
beforeEach(function () {
|
||||
$this->admin = User::factory()->create();
|
||||
@@ -26,10 +26,10 @@ it('restricts the directory status and actions to the configured local administr
|
||||
|
||||
it('displays live success, counts, and failures and flags stale success', function () {
|
||||
adminDirectorySnapshot();
|
||||
$this->artisan('ad:sync')->assertSuccessful();
|
||||
$this->artisan('ad:sync --create-missing')->assertSuccessful();
|
||||
$this->assertDatabaseHas('ad_sync_runs', ['status' => 'completed', 'dry_run' => false]);
|
||||
$this->mock(ActiveDirectory::class)->shouldReceive('users')->once()->andReturn([]);
|
||||
$this->artisan('ad:sync')->assertFailed();
|
||||
$this->artisan('ad:sync --create-missing')->assertFailed();
|
||||
$this->actingAs($this->admin)->get(route('admin.directory-sync'))->assertOk()
|
||||
->assertSee('Scheduled every 10 minutes')
|
||||
->assertSee('Directory snapshot is empty.');
|
||||
@@ -40,7 +40,7 @@ it('displays live success, counts, and failures and flags stale success', functi
|
||||
|
||||
it('previews missing users and applies only the reviewed deactivations', function () {
|
||||
adminDirectorySnapshot();
|
||||
$this->artisan('ad:sync')->assertSuccessful();
|
||||
$this->artisan('ad:sync --create-missing')->assertSuccessful();
|
||||
|
||||
adminDirectorySnapshot(includeSecond: false);
|
||||
$this->actingAs($this->admin)->post(route('admin.directory-sync.preview'))->assertRedirect(route('admin.directory-sync'));
|
||||
@@ -59,7 +59,7 @@ it('previews missing users and applies only the reviewed deactivations', functio
|
||||
|
||||
it('rejects a review when the directory membership changes before apply', function () {
|
||||
adminDirectorySnapshot();
|
||||
$this->artisan('ad:sync')->assertSuccessful();
|
||||
$this->artisan('ad:sync --create-missing')->assertSuccessful();
|
||||
adminDirectorySnapshot(includeSecond: false);
|
||||
$this->actingAs($this->admin)->post(route('admin.directory-sync.preview'))->assertRedirect();
|
||||
|
||||
@@ -72,7 +72,7 @@ it('rejects a review when the directory membership changes before apply', functi
|
||||
|
||||
it('keeps the current review when an old browser tab submits its token', function () {
|
||||
adminDirectorySnapshot();
|
||||
$this->artisan('ad:sync')->assertSuccessful();
|
||||
$this->artisan('ad:sync --create-missing')->assertSuccessful();
|
||||
$this->actingAs($this->admin);
|
||||
|
||||
adminDirectorySnapshot(includeSecond: false);
|
||||
@@ -91,7 +91,7 @@ it('keeps the current review when an old browser tab submits its token', functio
|
||||
|
||||
it('expires reviews and leaves all users unchanged', function () {
|
||||
adminDirectorySnapshot();
|
||||
$this->artisan('ad:sync')->assertSuccessful();
|
||||
$this->artisan('ad:sync --create-missing')->assertSuccessful();
|
||||
adminDirectorySnapshot(includeSecond: false);
|
||||
$this->actingAs($this->admin)->post(route('admin.directory-sync.preview'))->assertRedirect();
|
||||
$token = session('directory-sync-review.token');
|
||||
@@ -105,7 +105,7 @@ it('expires reviews and leaves all users unchanged', function () {
|
||||
|
||||
it('reports an empty candidate list and ignores successful dry runs for health', function () {
|
||||
adminDirectorySnapshot();
|
||||
$this->artisan('ad:sync --dry-run')->assertSuccessful();
|
||||
$this->artisan('ad:sync --create-missing --dry-run')->assertSuccessful();
|
||||
$this->assertDatabaseHas('ad_sync_runs', ['status' => 'completed', 'dry_run' => true]);
|
||||
adminDirectorySnapshot();
|
||||
$this->actingAs($this->admin)->post(route('admin.directory-sync.preview'))->assertRedirect();
|
||||
|
||||
Reference in New Issue
Block a user