forked from eatvio/eatvio-infra
04 10 2023 snapshot
This commit is contained in:
@@ -14,10 +14,12 @@ class ApiTokenPermissionsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_api_token_permissions_can_be_updated()
|
||||
public function test_api_token_permissions_can_be_updated(): void
|
||||
{
|
||||
if (! Features::hasApiFeatures()) {
|
||||
return $this->markTestSkipped('API support is not enabled.');
|
||||
$this->markTestSkipped('API support is not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->actingAs($user = User::factory()->withPersonalTeam()->create());
|
||||
@@ -29,14 +31,14 @@ class ApiTokenPermissionsTest extends TestCase
|
||||
]);
|
||||
|
||||
Livewire::test(ApiTokenManager::class)
|
||||
->set(['managingPermissionsFor' => $token])
|
||||
->set(['updateApiTokenForm' => [
|
||||
'permissions' => [
|
||||
'delete',
|
||||
'missing-permission',
|
||||
],
|
||||
]])
|
||||
->call('updateApiToken');
|
||||
->set(['managingPermissionsFor' => $token])
|
||||
->set(['updateApiTokenForm' => [
|
||||
'permissions' => [
|
||||
'delete',
|
||||
'missing-permission',
|
||||
],
|
||||
]])
|
||||
->call('updateApiToken');
|
||||
|
||||
$this->assertTrue($user->fresh()->tokens->first()->can('delete'));
|
||||
$this->assertFalse($user->fresh()->tokens->first()->can('read'));
|
||||
|
||||
Reference in New Issue
Block a user