attempt to fix failing integration tests

This commit is contained in:
Matthew Penner
2021-01-16 11:28:46 -07:00
parent 4f83a894a3
commit 1b05ca10e4
8 changed files with 422 additions and 416 deletions

View File

@@ -5,6 +5,7 @@ namespace Pterodactyl\Tests\Integration\Api\Client\Server;
use Carbon\Carbon;
use Lcobucci\JWT\Parser;
use Carbon\CarbonImmutable;
use Lcobucci\JWT\Signer\Key;
use Illuminate\Http\Response;
use Pterodactyl\Models\Permission;
use Lcobucci\JWT\Signer\Hmac\Sha256;
@@ -54,7 +55,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
$token = (new Parser)->parse($response->json('data.token'));
$this->assertTrue(
$token->verify(new Sha256, $server->node->getDecryptedKey()),
$token->verify(new Sha256, new Key($server->node->getDecryptedKey())),
'Failed to validate that the JWT data returned was signed using the Node\'s secret key.'
);
@@ -88,7 +89,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
$token = (new Parser)->parse($response->json('data.token'));
$this->assertTrue(
$token->verify(new Sha256, $server->node->getDecryptedKey()),
$token->verify(new Sha256, new Key($server->node->getDecryptedKey())),
'Failed to validate that the JWT data returned was signed using the Node\'s secret key.'
);

View File

@@ -167,7 +167,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
$this->assertInstanceOf(Database::class, $response);
$this->assertSame($response->server_id, $server->id);
$this->assertRegExp('/^(u[\d]+_)(\w){10}$/', $username);
$this->assertMatchesRegularExpression('/^(u[\d]+_)(\w){10}$/', $username);
$this->assertSame($username, $secondUsername);
$this->assertSame(24, strlen($password));

View File

@@ -158,9 +158,12 @@ class ServerCreationServiceTest extends IntegrationTestCase
/** @var \Pterodactyl\Models\User $user */
$user = User::factory()->create();
/** @var \Pterodactyl\Models\Location $location */
$location = Location::factory()->create();
/** @var \Pterodactyl\Models\Node $node */
$node = Node::factory()->create([
'location_id' => Location::factory()->create()->id,
'location_id' => $location->id,
]);
/** @var \Pterodactyl\Models\Allocation $allocation */