Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/Admin/SkusTest.php
Show All 9 Lines | class SkusTest extends TestCase | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
self::useAdminUrl(); | self::useAdminUrl(); | ||||
Sku::where('title', 'test')->delete(); | |||||
$this->clearBetaEntitlements(); | $this->clearBetaEntitlements(); | ||||
$this->clearMeetEntitlements(); | $this->clearMeetEntitlements(); | ||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
Sku::where('title', 'test')->delete(); | |||||
$this->clearBetaEntitlements(); | $this->clearBetaEntitlements(); | ||||
$this->clearMeetEntitlements(); | $this->clearMeetEntitlements(); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test fetching SKUs list | * Test fetching SKUs list | ||||
*/ | */ | ||||
public function testIndex(): void | public function testIndex(): void | ||||
{ | { | ||||
$admin = $this->getTestUser('jeroen@jeroen.jeroen'); | $admin = $this->getTestUser('jeroen@jeroen.jeroen'); | ||||
$user = $this->getTestUser('john@kolab.org'); | $user = $this->getTestUser('john@kolab.org'); | ||||
$sku = Sku::where('title', 'mailbox')->first(); | $sku = Sku::withEnvTenantContext()->where('title', 'mailbox')->first(); | ||||
// Unauth access not allowed | // Unauth access not allowed | ||||
$response = $this->get("api/v4/skus"); | $response = $this->get("api/v4/skus"); | ||||
$response->assertStatus(401); | $response->assertStatus(401); | ||||
// User access not allowed on admin API | // User access not allowed on admin API | ||||
$response = $this->actingAs($user)->get("api/v4/skus"); | $response = $this->actingAs($user)->get("api/v4/skus"); | ||||
$response->assertStatus(403); | $response->assertStatus(403); | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |