From a24c594cbdeb6b54edffc2d40482f5ae30c48327 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Wed, 14 Dec 2022 18:23:46 -0700 Subject: [PATCH] user: remove `name_first` and `name_last` from tests --- database/Factories/NodeFactory.php | 8 +++--- database/Factories/UserFactory.php | 2 -- storage/app/packs/.githold | 0 .../Users/ExternalUserControllerTest.php | 4 +-- .../Application/Users/UserControllerTest.php | 26 ++++++------------- .../Api/Client/AccountControllerTest.php | 2 -- 6 files changed, 14 insertions(+), 28 deletions(-) delete mode 100755 storage/app/packs/.githold diff --git a/database/Factories/NodeFactory.php b/database/Factories/NodeFactory.php index 1dbd5d9f5..65786f702 100644 --- a/database/Factories/NodeFactory.php +++ b/database/Factories/NodeFactory.php @@ -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, ]; } } diff --git a/database/Factories/UserFactory.php b/database/Factories/UserFactory.php index 1e38eced6..7cb3f0eda 100644 --- a/database/Factories/UserFactory.php +++ b/database/Factories/UserFactory.php @@ -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, diff --git a/storage/app/packs/.githold b/storage/app/packs/.githold deleted file mode 100755 index e69de29bb..000000000 diff --git a/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php b/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php index 1c02df7fc..053ba36ee 100644 --- a/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php +++ b/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php @@ -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, diff --git a/tests/Integration/Api/Application/Users/UserControllerTest.php b/tests/Integration/Api/Application/Users/UserControllerTest.php index 0aebe3d9b..60f104201 100644 --- a/tests/Integration/Api/Application/Users/UserControllerTest.php +++ b/tests/Integration/Api/Application/Users/UserControllerTest.php @@ -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']); diff --git a/tests/Integration/Api/Client/AccountControllerTest.php b/tests/Integration/Api/Client/AccountControllerTest.php index 0fe1813a3..6c297648d 100644 --- a/tests/Integration/Api/Client/AccountControllerTest.php +++ b/tests/Integration/Api/Client/AccountControllerTest.php @@ -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, ], ]);