chore: Allow setting "users.display_name" in Platform API (#5532)
This commit is contained in:
parent
57fcb79d71
commit
4f0360c7a2
2 changed files with 13 additions and 4 deletions
|
@ -51,6 +51,6 @@ class Platform::Api::V1::UsersController < PlatformController
|
|||
end
|
||||
|
||||
def user_params
|
||||
params.permit(:name, :email, :password, custom_attributes: {})
|
||||
params.permit(:name, :display_name, :email, :password, custom_attributes: {})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -96,15 +96,24 @@ RSpec.describe 'Platform Users API', type: :request do
|
|||
|
||||
it 'creates a new user and permissible for the user' do
|
||||
expect do
|
||||
post '/platform/api/v1/users/', params: { name: 'test', email: 'test@test.com', password: 'Password1!',
|
||||
post '/platform/api/v1/users/', params: { name: 'test', display_name: 'displaytest',
|
||||
email: 'test@test.com', password: 'Password1!',
|
||||
custom_attributes: { test: 'test_create' } },
|
||||
headers: { api_access_token: platform_app.access_token.token }, as: :json
|
||||
end.not_to enqueue_mail
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
data = JSON.parse(response.body)
|
||||
expect(data['email']).to eq('test@test.com')
|
||||
expect(data['custom_attributes']['test']).to eq('test_create')
|
||||
expect(data).to match(
|
||||
hash_including(
|
||||
'name' => 'test',
|
||||
'display_name' => 'displaytest',
|
||||
'email' => 'test@test.com',
|
||||
'custom_attributes' => {
|
||||
'test' => 'test_create'
|
||||
}
|
||||
)
|
||||
)
|
||||
expect(platform_app.platform_app_permissibles.first.permissible_id).to eq data['id']
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue