mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
fix tests
This commit is contained in:
parent
0fe20bd63b
commit
3b594cf30d
10 changed files with 388 additions and 1664 deletions
|
@ -14,30 +14,16 @@ module Repp
|
|||
render_error(I18n.t('errors.messages.not_found'), :not_found) and return if api_user_id.blank?
|
||||
|
||||
api_user = current_user.registrar.api_users.find(api_user_id)
|
||||
interface = cert_params[:interface].presence || 'api'
|
||||
|
||||
# Validate interface
|
||||
unless Certificate::INTERFACES.include?(interface)
|
||||
render_error(I18n.t('errors.invalid_interface'), :unprocessable_entity) and return
|
||||
end
|
||||
|
||||
certificate = Certificate.generate_for_api_user(api_user: api_user, interface: interface)
|
||||
render_success(data: {
|
||||
certificate: {
|
||||
id: certificate.id,
|
||||
common_name: certificate.common_name,
|
||||
expires_at: certificate.expires_at,
|
||||
interface: certificate.interface
|
||||
}
|
||||
})
|
||||
certificate = Certificate.generate_for_api_user(api_user: api_user)
|
||||
render_success(data: { certificate: certificate })
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def cert_params
|
||||
params.require(:certificate).permit(:api_user_id, :interface)
|
||||
params.require(:certificate).permit(:api_user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue