tests(integration): fix user controller test, allegedly

This commit is contained in:
Matthew Penner 2021-08-02 22:23:47 -06:00
parent d2864410ed
commit d9d79d8c95

View file

@ -24,8 +24,8 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',
'data' => [ 'data' => [
['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'avatar_url', 'role_name', 'created_at', 'updated_at']], ['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'admin_role_id', 'root_admin', '2fa', 'avatar_url', 'role_name', 'created_at', 'updated_at']],
['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'avatar_url', 'role_name', 'created_at', 'updated_at']], ['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'admin_role_id', 'root_admin', '2fa', 'avatar_url', 'role_name', 'created_at', 'updated_at']],
], ],
'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages', 'links']], 'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages', 'links']],
]); ]);
@ -54,6 +54,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
'username' => $this->getApiUser()->username, 'username' => $this->getApiUser()->username,
'email' => $this->getApiUser()->email, 'email' => $this->getApiUser()->email,
'language' => $this->getApiUser()->language, 'language' => $this->getApiUser()->language,
'admin_role_id' => $this->getApiUser()->admin_role_id,
'root_admin' => (bool) $this->getApiUser()->root_admin, 'root_admin' => (bool) $this->getApiUser()->root_admin,
'2fa' => (bool) $this->getApiUser()->totp_enabled, '2fa' => (bool) $this->getApiUser()->totp_enabled,
'avatar_url' => $this->getApiUser()->avatarURL(), 'avatar_url' => $this->getApiUser()->avatarURL(),
@ -93,7 +94,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonCount(2); $response->assertJsonCount(2);
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'], 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'admin_role_id', 'root_admin', '2fa', 'created_at', 'updated_at'],
]); ]);
$response->assertJson([ $response->assertJson([
@ -127,7 +128,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',
'attributes' => [ 'attributes' => [
'id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at', 'id', 'external_id', 'uuid', 'username', 'email', 'language', 'admin_role_id', 'root_admin', '2fa', 'created_at', 'updated_at',
'relationships' => ['servers' => ['object', 'data' => [['object', 'attributes' => []]]]], 'relationships' => ['servers' => ['object', 'data' => [['object', 'attributes' => []]]]],
], ],
]); ]);
@ -226,7 +227,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonCount(3); $response->assertJsonCount(3);
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'], 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'admin_role_id', 'root_admin', '2fa', 'created_at', 'updated_at'],
'meta' => ['resource'], 'meta' => ['resource'],
]); ]);
@ -257,7 +258,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$response->assertJsonCount(2); $response->assertJsonCount(2);
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',
'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'root_admin', '2fa', 'created_at', 'updated_at'], 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'language', 'admin_role_id', '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']);