S4: legacy:seed-api-testdata — API-Testkunde nach connektar-Muster
Idempotenter Command (nur local/staging): aktiver Legacy-API-User mit Grandfathering, importiertem X-ApiKey, api:immediate-publication, Firma + Pressekontakt; gibt Key + curl-Sammlung des /service-Flows aus. Live gegen die lokale App verifiziert (Firma -> Kontakt -> PM sofort published -> GET 200 im Alt-Format). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
6a45ebf607
commit
d9f25aecaf
3 changed files with 240 additions and 1 deletions
26
tests/Feature/LegacySeedApiTestdataCommandTest.php
Normal file
26
tests/Feature/LegacySeedApiTestdataCommandTest.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Tests\TestCase;
|
||||
|
||||
test('the testdata command creates a working legacy api customer', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
|
||||
$this->artisan('legacy:seed-api-testdata')
|
||||
->assertExitCode(0)
|
||||
->expectsOutputToContain('API-Testkunde bereit.');
|
||||
|
||||
$user = User::query()->where('email', 'api-test@pressekonto.test')->firstOrFail();
|
||||
|
||||
expect($user->is_active)->toBeTrue()
|
||||
->and($user->can('api:immediate-publication'))->toBeTrue()
|
||||
->and($user->hasActiveBooking())->toBeTrue()
|
||||
->and($user->tokens()->count())->toBe(1);
|
||||
|
||||
// Idempotent: zweiter Lauf erneuert nur den Key.
|
||||
$this->artisan('legacy:seed-api-testdata')->assertExitCode(0);
|
||||
expect(User::query()->where('email', 'api-test@pressekonto.test')->count())->toBe(1)
|
||||
->and($user->tokens()->count())->toBe(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue