mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 03:45:53 -05:00
scope node configure flow
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Pterodactyl\Tests\Integration\Http\Controllers\Admin;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Tests\Integration\Http\HttpTestCase;
|
||||
|
||||
class NodeAutoDeployControllerTest extends HttpTestCase
|
||||
{
|
||||
public function testGeneratedTokenIsScopedToNodeConfiguration(): void
|
||||
{
|
||||
$node = Node::factory()->for(Location::factory())->create();
|
||||
|
||||
$response = $this->actingAs(User::factory()->admin()->create())
|
||||
->postJson(route('admin.nodes.view.configuration.token', ['node' => $node]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('node', $node->id);
|
||||
|
||||
$key = ApiKey::query()
|
||||
->where('identifier', substr($response->json('token'), 0, ApiKey::IDENTIFIER_LENGTH))
|
||||
->firstOrFail();
|
||||
|
||||
$this->assertSame($node->id, $key->node_id);
|
||||
$this->assertSame(AdminAcl::READ_CONFIGURATION, $key->r_nodes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user