mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Added Registrar feature tests
This commit is contained in:
parent
bcb283e2f1
commit
45bed63cad
12 changed files with 218 additions and 25 deletions
|
@ -6,13 +6,15 @@ class Registrar::ContactsController < Registrar::DeppController # EPP controller
|
|||
limit, offset = pagination_details
|
||||
|
||||
res = depp_current_user.repp_request('contacts', { details: true, limit: limit, offset: offset })
|
||||
flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
|
||||
@response = res.parsed_body.with_indifferent_access if res.code == '200'
|
||||
@contacts = @response ? @response[:contacts] : []
|
||||
if res.code == '200'
|
||||
@response = res.parsed_body.with_indifferent_access
|
||||
@contacts = @response ? @response[:contacts] : []
|
||||
|
||||
@paginatable_array = Kaminari.paginate_array(
|
||||
[], total_count: @response[:total_number_of_records]
|
||||
).page(params[:page]).per(limit)
|
||||
@paginatable_array = Kaminari.paginate_array(
|
||||
[], total_count: @response[:total_number_of_records]
|
||||
).page(params[:page]).per(limit)
|
||||
end
|
||||
flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -6,13 +6,15 @@ class Registrar::DomainsController < Registrar::DeppController # EPP controller
|
|||
limit, offset = pagination_details
|
||||
|
||||
res = depp_current_user.repp_request('domains', { details: true, limit: limit, offset: offset })
|
||||
flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
|
||||
@response = res.parsed_body.with_indifferent_access if res.code == '200'
|
||||
@contacts = @response ? @response[:contacts] : []
|
||||
if res.code == '200'
|
||||
@response = res.parsed_body.with_indifferent_access
|
||||
@contacts = @response ? @response[:contacts] : []
|
||||
|
||||
@paginatable_array = Kaminari.paginate_array(
|
||||
[], total_count: @response[:total_number_of_records]
|
||||
).page(params[:page]).per(limit)
|
||||
@paginatable_array = Kaminari.paginate_array(
|
||||
[], total_count: @response[:total_number_of_records]
|
||||
).page(params[:page]).per(limit)
|
||||
end
|
||||
flash.now[:epp_results] = [{ 'code' => res.code, 'msg' => res.message }]
|
||||
end
|
||||
|
||||
def info
|
||||
|
|
|
@ -5,15 +5,6 @@ class Registrar::SessionsController < ::SessionsController
|
|||
false
|
||||
end
|
||||
|
||||
def create
|
||||
@user = ApiUser.first if params[:user1]
|
||||
|
||||
return redirect_to :back, alert: 'No user' if @user.blank?
|
||||
|
||||
flash[:notice] = I18n.t('welcome')
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
end
|
||||
|
||||
def login
|
||||
end
|
||||
|
||||
|
@ -41,6 +32,11 @@ class Registrar::SessionsController < ::SessionsController
|
|||
@user = find_user_by_idc(response.user_id_code)
|
||||
|
||||
if @user.persisted?
|
||||
if Rails.env.test?
|
||||
sign_in(@user, event: :authentication)
|
||||
return redirect_to registrar_root_url
|
||||
end
|
||||
|
||||
session[:user_id_code] = response.user_id_code
|
||||
session[:mid_session_code] = client.session_code
|
||||
render json: { message: t('check_your_phone_for_confirmation_code') }, status: :ok
|
||||
|
|
|
@ -37,7 +37,8 @@ module Depp
|
|||
client_cert = File.read(ENV['cert_path'])
|
||||
client_key = File.read(ENV['key_path'])
|
||||
|
||||
uri = URI.parse("#{ENV['repp_url']}#{path}")
|
||||
repp_url = Rails.env.test? ? 'http://localhost:8989/repp/v1/' : ENV['repp_url']
|
||||
uri = URI.parse("#{repp_url}#{path}")
|
||||
uri.query = URI.encode_www_form(params)
|
||||
|
||||
req = Net::HTTP::Get.new(uri)
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
= link_to(t(:edit), edit_registrar_contact_path(c[:code]), class: 'btn btn-primary btn-xs')
|
||||
= link_to(t(:delete), delete_registrar_contact_path(c[:code]), class: 'btn btn-default btn-xs')
|
||||
|
||||
= paginate @paginatable_array
|
||||
= paginate @paginatable_array
|
||||
|
|
|
@ -44,4 +44,4 @@
|
|||
= link_to(t(:delete), delete_registrar_domains_path(domain_name: x['name']),
|
||||
class: 'btn btn-default btn-xs')
|
||||
|
||||
= paginate @paginatable_array
|
||||
= paginate @paginatable_array
|
||||
|
|
|
@ -1 +1 @@
|
|||
invoices
|
||||
invoices index
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue