stage 2 of oauth removal, switch to sanctum pat tokens completed, docs updated
This commit is contained in:
@@ -120,7 +120,7 @@ class LoginTest extends TestCase
|
||||
'email_verified_at' => now(),
|
||||
]);
|
||||
|
||||
$intended = 'http://localhost/api/v1/oauth/authorize?client_id=tenant-admin-app&response_type=code';
|
||||
$intended = 'http://localhost/event-admin/dashboard?from=intended-test';
|
||||
$returnTarget = '/event-admin/dashboard';
|
||||
$encodedReturn = rtrim(strtr(base64_encode($returnTarget), '+/', '-_'), '=');
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class TenantAdminGoogleControllerTest extends TestCase
|
||||
Socialite::shouldReceive('driver')->once()->with('google')->andReturn($driver);
|
||||
$driver->shouldReceive('user')->once()->andReturn($socialiteUser);
|
||||
|
||||
$targetUrl = 'http://localhost:8000/api/v1/oauth/authorize?foo=bar';
|
||||
$targetUrl = 'http://localhost:8000/event-admin/dashboard?foo=bar';
|
||||
$encodedReturn = rtrim(strtr(base64_encode($targetUrl), '+/', '-_'), '=');
|
||||
|
||||
$this->withSession([
|
||||
|
||||
@@ -27,6 +27,8 @@ class TenantProfileApiTest extends TestCase
|
||||
'password' => Hash::make('secret-password'),
|
||||
'email' => 'tenant@example.com',
|
||||
'name' => 'Max Mustermann',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Mustermann',
|
||||
]);
|
||||
|
||||
$login = $this->postJson('/api/v1/tenant-auth/login', [
|
||||
@@ -57,6 +59,34 @@ class TenantProfileApiTest extends TestCase
|
||||
$data = $me->json();
|
||||
$this->assertEquals('Max Mustermann', data_get($data, 'user.name'));
|
||||
$this->assertContains('tenant-admin', $data['abilities']);
|
||||
|
||||
$legacy = $this
|
||||
->withHeader('Authorization', 'Bearer '.$token)
|
||||
->getJson('/api/v1/tenant/me');
|
||||
|
||||
$legacy->assertOk();
|
||||
$legacy->assertJsonFragment([
|
||||
'id' => $tenant->id,
|
||||
'tenant_id' => $tenant->id,
|
||||
'name' => 'Test Tenant GmbH',
|
||||
'event_credits_balance' => 12,
|
||||
'fullName' => 'Max Mustermann',
|
||||
]);
|
||||
$legacy->assertJsonStructure([
|
||||
'id',
|
||||
'tenant_id',
|
||||
'name',
|
||||
'slug',
|
||||
'email',
|
||||
'fullName',
|
||||
'event_credits_balance',
|
||||
'active_reseller_package_id',
|
||||
'remaining_events',
|
||||
'package_expires_at',
|
||||
'features',
|
||||
'scopes',
|
||||
]);
|
||||
$this->assertContains('tenant-admin', $legacy->json('scopes'));
|
||||
}
|
||||
|
||||
public function test_me_requires_valid_token(): void
|
||||
|
||||
Reference in New Issue
Block a user