1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-24 01:52:30 +01:00

user: remove name_first and name_last from tests

This commit is contained in:
Matthew Penner 2022-12-14 18:23:46 -07:00
parent 6b11836a41
commit a24c594cbd
No known key found for this signature in database
6 changed files with 14 additions and 28 deletions

View File

@ -27,6 +27,10 @@ class NodeFactory extends Factory
'public' => true,
'name' => 'FactoryNode_' . Str::random(10),
'fqdn' => $this->faker->unique()->ipv4,
'listen_port_http' => 8080,
'listen_port_sftp' => 2022,
'public_port_http' => 8080,
'public_port_sftp' => 2022,
'scheme' => 'http',
'behind_proxy' => false,
'memory' => 1024,
@ -36,9 +40,7 @@ class NodeFactory extends Factory
'upload_size' => 100,
'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH),
'daemon_token' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
'daemonListen' => 8080,
'daemonSFTP' => 2022,
'daemonBase' => '/var/lib/pterodactyl/volumes',
'daemon_base' => Node::DEFAULT_DAEMON_BASE,
];
}
}

View File

@ -29,8 +29,6 @@ class UserFactory extends Factory
'uuid' => Uuid::uuid4()->toString(),
'username' => $this->faker->userName . '_' . Str::random(10),
'email' => Str::random(32) . '@example.com',
'name_first' => $this->faker->firstName,
'name_last' => $this->faker->lastName,
'password' => $password ?: $password = bcrypt('password'),
'language' => 'en',
'root_admin' => false,

View File

@ -22,7 +22,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonStructure([
'object',
'attributes' => [
'id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name',
'id', 'external_id', 'uuid', 'username', 'email',
'language', 'root_admin', '2fa', 'created_at', 'updated_at',
],
]);
@ -35,8 +35,6 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
'uuid' => $user->uuid,
'username' => $user->username,
'email' => $user->email,
'first_name' => $user->name_first,
'last_name' => $user->name_last,
'language' => $user->language,
'root_admin' => (bool) $user->root_admin,
'2fa' => (bool) $user->totp_enabled,

View File

@ -24,8 +24,8 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonStructure([
'object',
'data' => [
['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at']],
['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at']],
['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at']],
['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at']],
],
'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages']],
]);
@ -52,11 +52,9 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
'uuid' => $this->getApiUser()->uuid,
'username' => $this->getApiUser()->username,
'email' => $this->getApiUser()->email,
'first_name' => $this->getApiUser()->name_first,
'last_name' => $this->getApiUser()->name_last,
'language' => $this->getApiUser()->language,
'root_admin' => $this->getApiUser()->root_admin,
'2fa' => (bool) $this->getApiUser()->totp_enabled,
'2fa' => $this->getApiUser()->use_totp,
'created_at' => $this->formatTimestamp($this->getApiUser()->created_at),
'updated_at' => $this->formatTimestamp($this->getApiUser()->updated_at),
],
@ -69,11 +67,9 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
'uuid' => $user->uuid,
'username' => $user->username,
'email' => $user->email,
'first_name' => $user->name_first,
'last_name' => $user->name_last,
'language' => $user->language,
'root_admin' => (bool) $user->root_admin,
'2fa' => (bool) $user->totp_enabled,
'2fa' => (bool) $user->use_totp,
'created_at' => $this->formatTimestamp($user->created_at),
'updated_at' => $this->formatTimestamp($user->updated_at),
],
@ -92,7 +88,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonCount(2);
$response->assertJsonStructure([
'object',
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'],
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'],
]);
$response->assertJson([
@ -103,8 +99,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
'uuid' => $user->uuid,
'username' => $user->username,
'email' => $user->email,
'first_name' => $user->name_first,
'last_name' => $user->name_last,
'language' => $user->language,
'root_admin' => (bool) $user->root_admin,
'2fa' => (bool) $user->totp_enabled,
@ -128,7 +122,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonStructure([
'object',
'attributes' => [
'id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at',
'id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at',
'relationships' => ['servers' => ['object', 'data' => [['object', 'attributes' => []]]]],
],
]);
@ -209,15 +203,13 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response = $this->postJson('/api/application/users', [
'username' => 'testuser',
'email' => 'test@example.com',
'first_name' => 'Test',
'last_name' => 'User',
]);
$response->assertStatus(Response::HTTP_CREATED);
$response->assertJsonCount(3);
$response->assertJsonStructure([
'object',
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'],
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'],
'meta' => ['resource'],
]);
@ -243,14 +235,12 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response = $this->patchJson('/api/application/users/' . $user->id, [
'username' => 'new.test.name',
'email' => 'new@emailtest.com',
'first_name' => $user->name_first,
'last_name' => $user->name_last,
]);
$response->assertStatus(Response::HTTP_OK);
$response->assertJsonCount(2);
$response->assertJsonStructure([
'object',
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'],
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'],
]);
$this->assertDatabaseHas('users', ['username' => 'new.test.name', 'email' => 'new@emailtest.com']);

View File

@ -26,8 +26,6 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
'admin' => false,
'username' => $user->username,
'email' => $user->email,
'first_name' => $user->name_first,
'last_name' => $user->name_last,
'language' => $user->language,
],
]);