Return tests to passing now that we don't ignore a critical event...
This commit is contained in:
parent
09832cc558
commit
0621d8475d
14 changed files with 44 additions and 60 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Tests\Integration\Api\Application\Users;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Http\Response;
|
||||
use Pterodactyl\Tests\Integration\Api\Application\ApplicationApiIntegrationTestCase;
|
||||
|
@ -13,7 +14,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
|||
*/
|
||||
public function testGetRemoteUser()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()->create(['external_id' => Str::random()]);
|
||||
|
||||
$response = $this->getJson('/api/application/users/external/' . $user->external_id);
|
||||
$response->assertStatus(Response::HTTP_OK);
|
||||
|
@ -60,7 +61,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
|||
*/
|
||||
public function testErrorReturnedIfNoPermission()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user = User::factory()->create(['external_id' => Str::random()]);
|
||||
$this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]);
|
||||
|
||||
$response = $this->getJson('/api/application/users/external/' . $user->external_id);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Tests\Integration\Api\Client;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
@ -41,13 +42,13 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
|||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->putJson('/api/client/account/email', [
|
||||
'email' => 'hodor@example.com',
|
||||
'email' => $email = Str::random() . '@example.com',
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
$response->assertStatus(Response::HTTP_NO_CONTENT);
|
||||
|
||||
$this->assertDatabaseHas('users', ['id' => $user->id, 'email' => 'hodor@example.com']);
|
||||
$this->assertDatabaseHas('users', ['id' => $user->id, 'email' => $email]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,7 +50,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase
|
|||
public function testNotFoundErrorIsReturnedIfScheduleDoesNotBelongToServer()
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
[, $server2] = $this->generateTestAccount(['user_id' => $user->id]);
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
|
||||
$schedule = Schedule::factory()->create(['server_id' => $server2->id]);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
|
|||
public function testScheduleBelongingToAnotherServerCannotBeViewed()
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
[, $server2] = $this->generateTestAccount(['user_id' => $user->id]);
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
|
||||
$schedule = Schedule::factory()->create(['server_id' => $server2->id]);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase
|
|||
public function testErrorIsReturnedIfScheduleDoesNotBelongToServer()
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
[, $server2] = $this->generateTestAccount(['user_id' => $user->id]);
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
|
||||
$schedule = Schedule::factory()->create(['server_id' => $server2->id]);
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
|
|||
public function testErrorIsReturnedIfScheduleDoesNotBelongToServer()
|
||||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
[, $server2] = $this->generateTestAccount(['user_id' => $user->id]);
|
||||
$server2 = $this->createServerModel(['owner_id' => $user->id]);
|
||||
|
||||
/** @var \Pterodactyl\Models\Schedule $schedule */
|
||||
$schedule = Schedule::factory()->create(['server_id' => $server2->id]);
|
||||
|
|
|
@ -32,8 +32,9 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
|||
/** @var \Pterodactyl\Models\User $differentUser */
|
||||
$differentUser = User::factory()->create();
|
||||
|
||||
$real = Uuid::uuid4()->toString();
|
||||
// Generate a UUID that lines up with a user in the database if it were to be cast to an int.
|
||||
$uuid = $differentUser->id . str_repeat('a', strlen((string) $differentUser->id)) . substr(Uuid::uuid4()->toString(), 8);
|
||||
$uuid = $differentUser->id . substr($real, strlen((string) $differentUser->id));
|
||||
|
||||
/** @var \Pterodactyl\Models\User $subuser */
|
||||
$subuser = User::factory()->create(['uuid' => $uuid]);
|
||||
|
|
|
@ -28,7 +28,11 @@ class TestResponse extends IlluminateTestResponse
|
|||
if ($actual !== $status && $status !== 500) {
|
||||
$this->dump();
|
||||
if (!is_null($this->exception) && !$this->exception instanceof DisplayException && !$this->exception instanceof ValidationException) {
|
||||
dump($this->exception);
|
||||
dump([
|
||||
'exception_class' => get_class($this->exception),
|
||||
'message' => $this->exception->getMessage(),
|
||||
'trace' => $this->exception->getTrace(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@ trait CreatesTestModels
|
|||
return [$user, $this->createServerModel(['user_id' => $user->id])];
|
||||
}
|
||||
|
||||
/** @var \Pterodactyl\Models\Server $server */
|
||||
$server = $this->createServerModel();
|
||||
|
||||
Subuser::query()->create([
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue