Fix some failing test cases
This commit is contained in:
parent
625fd92130
commit
f99ac0ecde
3 changed files with 12 additions and 4 deletions
|
@ -163,7 +163,7 @@ class SubuserController extends ClientApiController
|
|||
$this->repository->delete($subuser->id);
|
||||
|
||||
try {
|
||||
$this->serverRepository->revokeJTIs([md5($subuser->user_id . $server->uuid)]);
|
||||
$this->serverRepository->setServer($server)->revokeJTIs([md5($subuser->user_id . $server->uuid)]);
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
// Don't block this request if we can't connect to the Wings instance.
|
||||
Log::warning($exception, ['user_id' => $subuser->user_id, 'server_id' => $server->id]);
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
namespace Pterodactyl\Tests\Integration\Api\Client\Server\Subuser;
|
||||
|
||||
use Mockery;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Pterodactyl\Models\Permission;
|
||||
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
||||
use Pterodactyl\Tests\Integration\Api\Client\ClientApiIntegrationTestCase;
|
||||
|
||||
class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
||||
|
@ -23,6 +25,8 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
|||
*/
|
||||
public function testCorrectSubuserIsDeletedFromServer()
|
||||
{
|
||||
$this->swap(DaemonServerRepository::class, $mock = Mockery::mock(DaemonServerRepository::class));
|
||||
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
/** @var \Pterodactyl\Models\User $differentUser */
|
||||
|
@ -40,6 +44,8 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
|||
'permissions' => [Permission::ACTION_WEBSOCKET_CONNECT],
|
||||
]);
|
||||
|
||||
$mock->expects('setServer->revokeJTIs')->with([md5($subuser->id . $server->uuid)])->andReturnUndefined();
|
||||
|
||||
$this->actingAs($user)->deleteJson($this->link($server) . "/users/{$subuser->uuid}")->assertNoContent();
|
||||
|
||||
// Try the same test, but this time with a UUID that if cast to an int (shouldn't) line up with
|
||||
|
@ -54,6 +60,8 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
|||
'permissions' => [Permission::ACTION_WEBSOCKET_CONNECT],
|
||||
]);
|
||||
|
||||
$mock->expects('setServer->revokeJTIs')->with([md5($subuser->id . $server->uuid)])->andReturnUndefined();
|
||||
|
||||
$this->actingAs($user)->deleteJson($this->link($server) . "/users/{$subuser->uuid}")->assertNoContent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
|
|||
$this->assertSame($server->node->getConnectionAddress(), $token->getClaim('aud'));
|
||||
$this->assertSame(CarbonImmutable::now()->getTimestamp(), $token->getClaim('iat'));
|
||||
$this->assertSame(CarbonImmutable::now()->subMinutes(5)->getTimestamp(), $token->getClaim('nbf'));
|
||||
$this->assertSame(CarbonImmutable::now()->addMinutes(15)->getTimestamp(), $token->getClaim('exp'));
|
||||
$this->assertSame(CarbonImmutable::now()->addMinutes(10)->getTimestamp(), $token->getClaim('exp'));
|
||||
$this->assertSame($user->id, $token->getClaim('user_id'));
|
||||
$this->assertSame($server->uuid, $token->getClaim('server_uuid'));
|
||||
$this->assertSame(['*'], $token->getClaim('permissions'));
|
||||
|
|
Loading…
Reference in a new issue