user: remove name_first
and name_last
from tests
This commit is contained in:
parent
6b11836a41
commit
a24c594cbd
6 changed files with 14 additions and 28 deletions
|
@ -27,6 +27,10 @@ class NodeFactory extends Factory
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'name' => 'FactoryNode_' . Str::random(10),
|
'name' => 'FactoryNode_' . Str::random(10),
|
||||||
'fqdn' => $this->faker->unique()->ipv4,
|
'fqdn' => $this->faker->unique()->ipv4,
|
||||||
|
'listen_port_http' => 8080,
|
||||||
|
'listen_port_sftp' => 2022,
|
||||||
|
'public_port_http' => 8080,
|
||||||
|
'public_port_sftp' => 2022,
|
||||||
'scheme' => 'http',
|
'scheme' => 'http',
|
||||||
'behind_proxy' => false,
|
'behind_proxy' => false,
|
||||||
'memory' => 1024,
|
'memory' => 1024,
|
||||||
|
@ -36,9 +40,7 @@ class NodeFactory extends Factory
|
||||||
'upload_size' => 100,
|
'upload_size' => 100,
|
||||||
'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH),
|
'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH),
|
||||||
'daemon_token' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
|
'daemon_token' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
|
||||||
'daemonListen' => 8080,
|
'daemon_base' => Node::DEFAULT_DAEMON_BASE,
|
||||||
'daemonSFTP' => 2022,
|
|
||||||
'daemonBase' => '/var/lib/pterodactyl/volumes',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ class UserFactory extends Factory
|
||||||
'uuid' => Uuid::uuid4()->toString(),
|
'uuid' => Uuid::uuid4()->toString(),
|
||||||
'username' => $this->faker->userName . '_' . Str::random(10),
|
'username' => $this->faker->userName . '_' . Str::random(10),
|
||||||
'email' => Str::random(32) . '@example.com',
|
'email' => Str::random(32) . '@example.com',
|
||||||
'name_first' => $this->faker->firstName,
|
|
||||||
'name_last' => $this->faker->lastName,
|
|
||||||
'password' => $password ?: $password = bcrypt('password'),
|
'password' => $password ?: $password = bcrypt('password'),
|
||||||
'language' => 'en',
|
'language' => 'en',
|
||||||
'root_admin' => false,
|
'root_admin' => false,
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'object',
|
'object',
|
||||||
'attributes' => [
|
'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',
|
'language', 'root_admin', '2fa', 'created_at', 'updated_at',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
@ -35,8 +35,6 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
'uuid' => $user->uuid,
|
'uuid' => $user->uuid,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'first_name' => $user->name_first,
|
|
||||||
'last_name' => $user->name_last,
|
|
||||||
'language' => $user->language,
|
'language' => $user->language,
|
||||||
'root_admin' => (bool) $user->root_admin,
|
'root_admin' => (bool) $user->root_admin,
|
||||||
'2fa' => (bool) $user->totp_enabled,
|
'2fa' => (bool) $user->totp_enabled,
|
||||||
|
|
|
@ -24,8 +24,8 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'object',
|
'object',
|
||||||
'data' => [
|
'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', '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']],
|
||||||
],
|
],
|
||||||
'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages']],
|
'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages']],
|
||||||
]);
|
]);
|
||||||
|
@ -52,11 +52,9 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
'uuid' => $this->getApiUser()->uuid,
|
'uuid' => $this->getApiUser()->uuid,
|
||||||
'username' => $this->getApiUser()->username,
|
'username' => $this->getApiUser()->username,
|
||||||
'email' => $this->getApiUser()->email,
|
'email' => $this->getApiUser()->email,
|
||||||
'first_name' => $this->getApiUser()->name_first,
|
|
||||||
'last_name' => $this->getApiUser()->name_last,
|
|
||||||
'language' => $this->getApiUser()->language,
|
'language' => $this->getApiUser()->language,
|
||||||
'root_admin' => $this->getApiUser()->root_admin,
|
'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),
|
'created_at' => $this->formatTimestamp($this->getApiUser()->created_at),
|
||||||
'updated_at' => $this->formatTimestamp($this->getApiUser()->updated_at),
|
'updated_at' => $this->formatTimestamp($this->getApiUser()->updated_at),
|
||||||
],
|
],
|
||||||
|
@ -69,11 +67,9 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
'uuid' => $user->uuid,
|
'uuid' => $user->uuid,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'first_name' => $user->name_first,
|
|
||||||
'last_name' => $user->name_last,
|
|
||||||
'language' => $user->language,
|
'language' => $user->language,
|
||||||
'root_admin' => (bool) $user->root_admin,
|
'root_admin' => (bool) $user->root_admin,
|
||||||
'2fa' => (bool) $user->totp_enabled,
|
'2fa' => (bool) $user->use_totp,
|
||||||
'created_at' => $this->formatTimestamp($user->created_at),
|
'created_at' => $this->formatTimestamp($user->created_at),
|
||||||
'updated_at' => $this->formatTimestamp($user->updated_at),
|
'updated_at' => $this->formatTimestamp($user->updated_at),
|
||||||
],
|
],
|
||||||
|
@ -92,7 +88,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
$response->assertJsonCount(2);
|
$response->assertJsonCount(2);
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'object',
|
'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([
|
$response->assertJson([
|
||||||
|
@ -103,8 +99,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
'uuid' => $user->uuid,
|
'uuid' => $user->uuid,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'first_name' => $user->name_first,
|
|
||||||
'last_name' => $user->name_last,
|
|
||||||
'language' => $user->language,
|
'language' => $user->language,
|
||||||
'root_admin' => (bool) $user->root_admin,
|
'root_admin' => (bool) $user->root_admin,
|
||||||
'2fa' => (bool) $user->totp_enabled,
|
'2fa' => (bool) $user->totp_enabled,
|
||||||
|
@ -128,7 +122,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'object',
|
'object',
|
||||||
'attributes' => [
|
'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' => []]]]],
|
'relationships' => ['servers' => ['object', 'data' => [['object', 'attributes' => []]]]],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
@ -209,15 +203,13 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
$response = $this->postJson('/api/application/users', [
|
$response = $this->postJson('/api/application/users', [
|
||||||
'username' => 'testuser',
|
'username' => 'testuser',
|
||||||
'email' => 'test@example.com',
|
'email' => 'test@example.com',
|
||||||
'first_name' => 'Test',
|
|
||||||
'last_name' => 'User',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(Response::HTTP_CREATED);
|
$response->assertStatus(Response::HTTP_CREATED);
|
||||||
$response->assertJsonCount(3);
|
$response->assertJsonCount(3);
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'object',
|
'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'],
|
'meta' => ['resource'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -243,14 +235,12 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
||||||
$response = $this->patchJson('/api/application/users/' . $user->id, [
|
$response = $this->patchJson('/api/application/users/' . $user->id, [
|
||||||
'username' => 'new.test.name',
|
'username' => 'new.test.name',
|
||||||
'email' => 'new@emailtest.com',
|
'email' => 'new@emailtest.com',
|
||||||
'first_name' => $user->name_first,
|
|
||||||
'last_name' => $user->name_last,
|
|
||||||
]);
|
]);
|
||||||
$response->assertStatus(Response::HTTP_OK);
|
$response->assertStatus(Response::HTTP_OK);
|
||||||
$response->assertJsonCount(2);
|
$response->assertJsonCount(2);
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'object',
|
'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']);
|
$this->assertDatabaseHas('users', ['username' => 'new.test.name', 'email' => 'new@emailtest.com']);
|
||||||
|
|
|
@ -26,8 +26,6 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'first_name' => $user->name_first,
|
|
||||||
'last_name' => $user->name_last,
|
|
||||||
'language' => $user->language,
|
'language' => $user->language,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue