mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
rubocop autocorret to get tests green
This commit is contained in:
parent
c0caf53878
commit
2d6ed7fa45
24 changed files with 105 additions and 112 deletions
|
@ -11,6 +11,7 @@ class Admin::ContactVersionsController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_contact
|
def set_contact
|
||||||
@contact = Contact.find(params[:id])
|
@contact = Contact.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ class Admin::DomainVersionsController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_domain
|
def set_domain
|
||||||
@domain = Domain.find(params[:id])
|
@domain = Domain.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Client::ContactsController < ClientController
|
||||||
redirect_to [:client, @contact]
|
redirect_to [:client, @contact]
|
||||||
else
|
else
|
||||||
flash[:alert] = I18n.t('shared.failed_to_create_contact')
|
flash[:alert] = I18n.t('shared.failed_to_create_contact')
|
||||||
render "new"
|
render 'new'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class Client::ContactsController < ClientController
|
||||||
end
|
end
|
||||||
|
|
||||||
def contact_params
|
def contact_params
|
||||||
params.require(:contact).permit( :email, :phone, :fax, :ident_type, :ident, :auth_info, :name, :org_name,
|
params.require(:contact).permit(:email, :phone, :fax, :ident_type, :ident, :auth_info, :name, :org_name,
|
||||||
address_attributes: [:city, :street, :zip, :street2, :street3, :country_id])
|
address_attributes: [:city, :street, :zip, :street2, :street3, :country_id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class SessionsController < Devise::SessionsController
|
class SessionsController < Devise::SessionsController
|
||||||
def create
|
def create
|
||||||
#TODO: Create ID Card login here:
|
# TODO: Create ID Card login here:
|
||||||
# this is just testing config
|
# this is just testing config
|
||||||
# if Rails.env.development? || Rails.env.test?
|
# if Rails.env.development? || Rails.env.test?
|
||||||
@user = User.find_by(username: 'gitlab') if params[:gitlab]
|
@user = User.find_by(username: 'gitlab') if params[:gitlab]
|
||||||
|
@ -10,8 +10,7 @@ class SessionsController < Devise::SessionsController
|
||||||
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
|
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
|
||||||
|
|
||||||
flash[:notice] = I18n.t('shared.welcome')
|
flash[:notice] = I18n.t('shared.welcome')
|
||||||
sign_in_and_redirect @user, :event => :authentication
|
sign_in_and_redirect @user, event: :authentication
|
||||||
return
|
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def coffee_script_tag(&block)
|
def coffee_script_tag(&block)
|
||||||
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, :type => 'text/javascript')
|
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, type: 'text/javascript')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,11 +54,11 @@ module Epp::ContactsHelper
|
||||||
## CREATE
|
## CREATE
|
||||||
def validate_contact_create_request
|
def validate_contact_create_request
|
||||||
@ph = params_hash['epp']['command']['create']['create']
|
@ph = params_hash['epp']['command']['create']['create']
|
||||||
xml_attrs_present?(@ph, [ %w(authInfo pw), %w(postalInfo)])
|
xml_attrs_present?(@ph, [%w(authInfo pw), %w(postalInfo)])
|
||||||
|
|
||||||
return epp_errors.empty? unless @ph['postalInfo'].is_a?(Hash) || @ph['postalInfo'].is_a?(Array)
|
return epp_errors.empty? unless @ph['postalInfo'].is_a?(Hash) || @ph['postalInfo'].is_a?(Array)
|
||||||
|
|
||||||
#(epp_errors << Address.validate_postal_info_types(parsed_frame)).flatten!
|
# (epp_errors << Address.validate_postal_info_types(parsed_frame)).flatten!
|
||||||
xml_attrs_array_present?(@ph['postalInfo'], [%w(name), %w(addr city), %w(addr cc)])
|
xml_attrs_array_present?(@ph['postalInfo'], [%w(name), %w(addr city), %w(addr cc)])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ module Epp::ContactsHelper
|
||||||
|
|
||||||
def owner?
|
def owner?
|
||||||
return false unless find_contact
|
return false unless find_contact
|
||||||
#return true if current_epp_user.registrar == find_contact.created_by.try(:registrar)
|
# return true if current_epp_user.registrar == find_contact.created_by.try(:registrar)
|
||||||
return true if @contact.registrar == current_epp_user.registrar
|
return true if @contact.registrar == current_epp_user.registrar
|
||||||
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error') }
|
epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error') }
|
||||||
false
|
false
|
||||||
|
|
|
@ -7,12 +7,12 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
if @domain.errors.any?
|
if @domain.errors.any?
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @domain.save
|
unless @domain.save
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
render '/epp/domains/create'
|
render '/epp/domains/create'
|
||||||
|
@ -55,12 +55,12 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
if @domain.errors.any?
|
if @domain.errors.any?
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @domain.save
|
unless @domain.save
|
||||||
handle_errors(@domain)
|
handle_errors(@domain)
|
||||||
raise ActiveRecord::Rollback and return
|
fail ActiveRecord::Rollback and return
|
||||||
end
|
end
|
||||||
|
|
||||||
render '/epp/domains/success'
|
render '/epp/domains/success'
|
||||||
|
|
|
@ -2,8 +2,7 @@ class Ability
|
||||||
include CanCan::Ability
|
include CanCan::Ability
|
||||||
|
|
||||||
def initialize(user)
|
def initialize(user)
|
||||||
|
alias_action :create, :read, :update, :destroy, to: :crud
|
||||||
alias_action :create, :read, :update, :destroy, :to => :crud
|
|
||||||
|
|
||||||
user ||= User.new
|
user ||= User.new
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ class Ability
|
||||||
can :read, DomainTransfer, transfer_to_id: user.registrar.id
|
can :read, DomainTransfer, transfer_to_id: user.registrar.id
|
||||||
can :read, DomainTransfer, transfer_from_id: user.registrar.id
|
can :read, DomainTransfer, transfer_from_id: user.registrar.id
|
||||||
can :approve_as_client, DomainTransfer,
|
can :approve_as_client, DomainTransfer,
|
||||||
transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
|
transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
|
||||||
end
|
end
|
||||||
|
|
||||||
# Define abilities for the passed in user here. For example:
|
# Define abilities for the passed in user here. For example:
|
||||||
|
|
|
@ -13,19 +13,19 @@ class Address < ActiveRecord::Base
|
||||||
has_paper_trail class_name: 'AddressVersion'
|
has_paper_trail class_name: 'AddressVersion'
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# def validate_postal_info_types(parsed_frame)
|
# def validate_postal_info_types(parsed_frame)
|
||||||
# errors, used = [], []
|
# errors, used = [], []
|
||||||
# parsed_frame.css('postalInfo').each do |pi|
|
# parsed_frame.css('postalInfo').each do |pi|
|
||||||
# attr = pi.attributes['type'].try(:value)
|
# attr = pi.attributes['type'].try(:value)
|
||||||
# errors << { code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type') } and next unless attr
|
# errors << { code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type') } and next unless attr
|
||||||
# unless TYPES.include?(attr)
|
# unless TYPES.include?(attr)
|
||||||
# errors << { code: 2005, msg: I18n.t('errors.messages.invalid_type'), value: { obj: 'type', val: attr } }
|
# errors << { code: 2005, msg: I18n.t('errors.messages.invalid_type'), value: { obj: 'type', val: attr } }
|
||||||
# next
|
# next
|
||||||
# end
|
# end
|
||||||
# errors << { code: 2005, msg: I18n.t('errors.messages.repeating_postal_info') } and next if used.include?(attr)
|
# errors << { code: 2005, msg: I18n.t('errors.messages.repeating_postal_info') } and next if used.include?(attr)
|
||||||
# used << attr
|
# used << attr
|
||||||
# end; errors
|
# end; errors
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def extract_attributes(ah)
|
def extract_attributes(ah)
|
||||||
address_hash = {}
|
address_hash = {}
|
||||||
|
@ -36,10 +36,10 @@ class Address < ActiveRecord::Base
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def local?(postal_info)
|
# def local?(postal_info)
|
||||||
# return :local_address_attributes if postal_info[:type] == LOCAL_TYPE_SHORT
|
# return :local_address_attributes if postal_info[:type] == LOCAL_TYPE_SHORT
|
||||||
# :international_address_attributes
|
# :international_address_attributes
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def addr_hash_from_params(addr)
|
def addr_hash_from_params(addr)
|
||||||
return {} if addr.nil?
|
return {} if addr.nil?
|
||||||
|
|
|
@ -25,7 +25,7 @@ module EppErrors
|
||||||
values.each do |err|
|
values.each do |err|
|
||||||
code, value = find_epp_code_and_value(err)
|
code, value = find_epp_code_and_value(err)
|
||||||
next unless code
|
next unless code
|
||||||
epp_errors << { code: code, msg: err, value: value}
|
epp_errors << { code: code, msg: err, value: value }
|
||||||
end
|
end
|
||||||
epp_errors
|
epp_errors
|
||||||
end
|
end
|
||||||
|
@ -37,7 +37,7 @@ module EppErrors
|
||||||
|
|
||||||
epp_errors = []
|
epp_errors = []
|
||||||
send(key).each do |x|
|
send(key).each do |x|
|
||||||
x.errors.messages.each do |key, values|
|
x.errors.messages.each do |_key, values|
|
||||||
epp_errors << x.collect_parent_errors(values)
|
epp_errors << x.collect_parent_errors(values)
|
||||||
end
|
end
|
||||||
end if multi.include?(macro)
|
end if multi.include?(macro)
|
||||||
|
|
|
@ -18,7 +18,5 @@ module UserEvents
|
||||||
def epp_user_events(id)
|
def epp_user_events(id)
|
||||||
where(whodunnit: "#{id}-EppUser")
|
where(whodunnit: "#{id}-EppUser")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,8 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
#has_one :local_address, dependent: :destroy
|
# has_one :local_address, dependent: :destroy
|
||||||
#has_one :international_address, dependent: :destroy
|
# has_one :international_address, dependent: :destroy
|
||||||
has_one :address, dependent: :destroy
|
has_one :address, dependent: :destroy
|
||||||
has_one :disclosure, class_name: 'ContactDisclosure'
|
has_one :disclosure, class_name: 'ContactDisclosure'
|
||||||
|
|
||||||
|
@ -20,22 +20,22 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
accepts_nested_attributes_for :address, :disclosure
|
accepts_nested_attributes_for :address, :disclosure
|
||||||
|
|
||||||
validates :code, :phone, :email, :ident, :address, :registrar,presence: true
|
validates :code, :phone, :email, :ident, :address, :registrar, presence: true
|
||||||
|
|
||||||
validate :ident_must_be_valid
|
validate :ident_must_be_valid
|
||||||
#validate :presence_of_one_address
|
# validate :presence_of_one_address
|
||||||
|
|
||||||
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/ # /\+\d{3}\.\d+/
|
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/ # /\+\d{3}\.\d+/
|
||||||
validates :email, format: /@/
|
validates :email, format: /@/
|
||||||
|
|
||||||
validates :code, uniqueness: { message: :epp_id_taken }
|
validates :code, uniqueness: { message: :epp_id_taken }
|
||||||
|
|
||||||
delegate :country, to: :address#, prefix: true
|
delegate :country, to: :address # , prefix: true
|
||||||
delegate :city, to: :address#, prefix: true
|
delegate :city, to: :address # , prefix: true
|
||||||
delegate :street, to: :address#, prefix: true
|
delegate :street, to: :address # , prefix: true
|
||||||
delegate :zip, to: :address#, prefix: true
|
delegate :zip, to: :address # , prefix: true
|
||||||
|
|
||||||
#scopes
|
# scopes
|
||||||
scope :current_registrars, ->(id) { where(registrar_id: id) }
|
scope :current_registrars, ->(id) { where(registrar_id: id) }
|
||||||
# archiving
|
# archiving
|
||||||
has_paper_trail class_name: 'ContactVersion'
|
has_paper_trail class_name: 'ContactVersion'
|
||||||
|
@ -97,7 +97,6 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
# should use only in transaction
|
# should use only in transaction
|
||||||
def destroy_and_clean
|
def destroy_and_clean
|
||||||
|
|
||||||
if relations_with_domain?
|
if relations_with_domain?
|
||||||
errors.add(:domains, :exist)
|
errors.add(:domains, :exist)
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -5,5 +5,4 @@ class ContactVersion < PaperTrail::Version
|
||||||
|
|
||||||
self.table_name = :contact_versions
|
self.table_name = :contact_versions
|
||||||
self.sequence_name = :contact_version_id_seq
|
self.sequence_name = :contact_version_id_seq
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,17 +19,17 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
has_many :nameservers, dependent: :delete_all
|
has_many :nameservers, dependent: :delete_all
|
||||||
accepts_nested_attributes_for :nameservers, allow_destroy: true,
|
accepts_nested_attributes_for :nameservers, allow_destroy: true,
|
||||||
reject_if: proc { |attrs| attrs[:hostname].blank? }
|
reject_if: proc { |attrs| attrs[:hostname].blank? }
|
||||||
|
|
||||||
has_many :domain_statuses, dependent: :delete_all
|
has_many :domain_statuses, dependent: :delete_all
|
||||||
accepts_nested_attributes_for :domain_statuses, allow_destroy: true,
|
accepts_nested_attributes_for :domain_statuses, allow_destroy: true,
|
||||||
reject_if: proc { |attrs| attrs[:value].blank? }
|
reject_if: proc { |attrs| attrs[:value].blank? }
|
||||||
|
|
||||||
has_many :domain_transfers, dependent: :delete_all
|
has_many :domain_transfers, dependent: :delete_all
|
||||||
|
|
||||||
has_many :dnskeys, dependent: :delete_all
|
has_many :dnskeys, dependent: :delete_all
|
||||||
accepts_nested_attributes_for :dnskeys, allow_destroy: true,
|
accepts_nested_attributes_for :dnskeys, allow_destroy: true,
|
||||||
reject_if: proc { |attrs| attrs[:public_key].blank? }
|
reject_if: proc { |attrs| attrs[:public_key].blank? }
|
||||||
|
|
||||||
delegate :code, to: :owner_contact, prefix: true
|
delegate :code, to: :owner_contact, prefix: true
|
||||||
delegate :email, to: :owner_contact, prefix: true
|
delegate :email, to: :owner_contact, prefix: true
|
||||||
|
@ -118,7 +118,7 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
def validate_nameserver_ips
|
def validate_nameserver_ips
|
||||||
nameservers.each do |ns|
|
nameservers.each do |ns|
|
||||||
next if !ns.hostname.end_with?(name)
|
next unless ns.hostname.end_with?(name)
|
||||||
next if ns.ipv4.present?
|
next if ns.ipv4.present?
|
||||||
errors.add(:nameservers, :invalid) if errors[:nameservers].blank?
|
errors.add(:nameservers, :invalid) if errors[:nameservers].blank?
|
||||||
ns.errors.add(:ipv4, :blank)
|
ns.errors.add(:ipv4, :blank)
|
||||||
|
|
|
@ -24,16 +24,16 @@ class Epp::EppDomain < Domain
|
||||||
],
|
],
|
||||||
'2004' => [ # Parameter value range error
|
'2004' => [ # Parameter value range error
|
||||||
[:nameservers, :out_of_range,
|
[:nameservers, :out_of_range,
|
||||||
{
|
{
|
||||||
min: domain_validation_sg.setting(:ns_min_count).value,
|
min: domain_validation_sg.setting(:ns_min_count).value,
|
||||||
max: domain_validation_sg.setting(:ns_max_count).value
|
max: domain_validation_sg.setting(:ns_max_count).value
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[:dnskeys, :out_of_range,
|
[:dnskeys, :out_of_range,
|
||||||
{
|
{
|
||||||
min: domain_validation_sg.setting(:dnskeys_min_count).value,
|
min: domain_validation_sg.setting(:dnskeys_min_count).value,
|
||||||
max: domain_validation_sg.setting(:dnskeys_max_count).value
|
max: domain_validation_sg.setting(:dnskeys_max_count).value
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[:period, :out_of_range, { value: { obj: 'period', val: period } }]
|
[:period, :out_of_range, { value: { obj: 'period', val: period } }]
|
||||||
],
|
],
|
||||||
|
@ -71,8 +71,8 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
# TODO: Find out if there are any attributes that can be changed
|
# TODO: Find out if there are any attributes that can be changed
|
||||||
# if not, delete this method
|
# if not, delete this method
|
||||||
def parse_and_update_domain_attributes(parsed_frame)
|
def parse_and_update_domain_attributes(_parsed_frame)
|
||||||
#assign_attributes(self.class.parse_update_params_from_frame(parsed_frame))
|
# assign_attributes(self.class.parse_update_params_from_frame(parsed_frame))
|
||||||
|
|
||||||
errors.empty?
|
errors.empty?
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
class Registrar < ActiveRecord::Base
|
class Registrar < ActiveRecord::Base
|
||||||
belongs_to :country
|
belongs_to :country
|
||||||
has_many :domains, :dependent => :restrict_with_error
|
has_many :domains, dependent: :restrict_with_error
|
||||||
has_many :contacts, :dependent => :restrict_with_error
|
has_many :contacts, dependent: :restrict_with_error
|
||||||
has_many :epp_users, :dependent => :restrict_with_error
|
has_many :epp_users, dependent: :restrict_with_error
|
||||||
has_many :users, :dependent => :restrict_with_error
|
has_many :users, dependent: :restrict_with_error
|
||||||
|
|
||||||
validates :name, :reg_no, :address, :country, presence: true
|
validates :name, :reg_no, :address, :country, presence: true
|
||||||
validates :name, :reg_no, uniqueness: true
|
validates :name, :reg_no, uniqueness: true
|
||||||
|
|
||||||
|
|
||||||
def domain_transfers
|
def domain_transfers
|
||||||
at = DomainTransfer.arel_table
|
at = DomainTransfer.arel_table
|
||||||
DomainTransfer.where(
|
DomainTransfer.where(
|
||||||
|
|
|
@ -41,12 +41,12 @@ Devise.setup do |config|
|
||||||
# Configure which authentication keys should be case-insensitive.
|
# Configure which authentication keys should be case-insensitive.
|
||||||
# These keys will be downcased upon creating or modifying a user and when used
|
# These keys will be downcased upon creating or modifying a user and when used
|
||||||
# to authenticate or find a user. Default is :email.
|
# to authenticate or find a user. Default is :email.
|
||||||
config.case_insensitive_keys = [ :email ]
|
config.case_insensitive_keys = [:email]
|
||||||
|
|
||||||
# Configure which authentication keys should have whitespace stripped.
|
# Configure which authentication keys should have whitespace stripped.
|
||||||
# These keys will have whitespace before and after removed upon creating or
|
# These keys will have whitespace before and after removed upon creating or
|
||||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||||
config.strip_whitespace_keys = [ :email ]
|
config.strip_whitespace_keys = [:email]
|
||||||
|
|
||||||
# Tell if authentication through request.params is enabled. True by default.
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
# It can be set to an array that will enable params authentication only for the
|
# It can be set to an array that will enable params authentication only for the
|
||||||
|
|
|
@ -31,7 +31,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
root 'domains#index'
|
root 'domains#index'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
## CLIENT ROUTES
|
## CLIENT ROUTES
|
||||||
namespace(:client) do
|
namespace(:client) do
|
||||||
|
@ -66,10 +66,10 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
authenticated :user do
|
authenticated :user do
|
||||||
root :to => 'admin/domains#index', :as => :authenticated_root
|
root to: 'admin/domains#index', as: :authenticated_root
|
||||||
end
|
end
|
||||||
|
|
||||||
root :to => redirect('login')
|
root to: redirect('login')
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
|
@ -2,12 +2,12 @@ desc 'Commands for whois'
|
||||||
|
|
||||||
desc 'generate whois files'
|
desc 'generate whois files'
|
||||||
task 'whois:generate' => :environment do
|
task 'whois:generate' => :environment do
|
||||||
Dir.mkdir("./tmp/whois") unless File.exists?("./tmp/whois") #a folder for ze stuff
|
Dir.mkdir('./tmp/whois') unless File.exist?('./tmp/whois') # a folder for ze stuff
|
||||||
|
|
||||||
alphabet = (("a".."z").to_a << %w(ö õ ü ä) ).flatten!
|
alphabet = (('a'..'z').to_a << %w(ö õ ü ä)).flatten!
|
||||||
@domains = {}
|
@domains = {}
|
||||||
alphabet.each do |letter|
|
alphabet.each do |letter|
|
||||||
domains = Domain.where([ 'name LIKE ?', "#{letter}%" ])
|
domains = Domain.where(['name LIKE ?', "#{letter}%"])
|
||||||
@domains[letter] = {}
|
@domains[letter] = {}
|
||||||
|
|
||||||
domains.each do |domain|
|
domains.each do |domain|
|
||||||
|
@ -22,9 +22,8 @@ task 'whois:generate' => :environment do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@domains.each do |k,v|
|
@domains.each do |k, v|
|
||||||
file = File.open("tmp/whois/#{k}_domain.yaml", 'w') { |f| f.write(v.to_yaml) }
|
file = File.open("tmp/whois/#{k}_domain.yaml", 'w') { |f| f.write(v.to_yaml) }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe 'EPP Contact', epp: true do
|
||||||
|
|
||||||
expect(response[:result_code]).to eq('1000')
|
expect(response[:result_code]).to eq('1000')
|
||||||
expect(response[:msg]).to eq('Command completed successfully')
|
expect(response[:msg]).to eq('Command completed successfully')
|
||||||
#expect(response[:clTRID]).to eq('ABC-12345')
|
# expect(response[:clTRID]).to eq('ABC-12345')
|
||||||
expect(Contact.first.created_by_id).to eq 2
|
expect(Contact.first.created_by_id).to eq 2
|
||||||
expect(Contact.first.updated_by_id).to eq nil
|
expect(Contact.first.updated_by_id).to eq nil
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_create_xml({
|
xml = domain_create_xml({
|
||||||
ns: [
|
ns: [
|
||||||
{ hostObj: { value: 'invalid1-' } },
|
{ hostObj: { value: 'invalid1-' } },
|
||||||
{ hostObj: { value: '-invalid2' } },
|
{ hostObj: { value: '-invalid2' } }
|
||||||
]
|
]
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -314,7 +314,7 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
it 'does not create a domain with invalid period' do
|
it 'does not create a domain with invalid period' do
|
||||||
xml = domain_create_xml({
|
xml = domain_create_xml({
|
||||||
period: {value: '367', attrs: { unit: 'd' } }
|
period: { value: '367', attrs: { unit: 'd' } }
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_request(xml, :xml)
|
response = epp_request(xml, :xml)
|
||||||
|
@ -420,26 +420,26 @@ describe 'EPP Domain', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not create a domain with two identical dnskeys' do
|
it 'does not create a domain with two identical dnskeys' do
|
||||||
xml = domain_create_xml({
|
xml = domain_create_xml({
|
||||||
dnssec: [
|
dnssec: [
|
||||||
{
|
{
|
||||||
dnskey: {
|
dnskey: {
|
||||||
flags: { value: '257' },
|
flags: { value: '257' },
|
||||||
protocol: { value: '3' },
|
protocol: { value: '3' },
|
||||||
alg: { value: '3' },
|
alg: { value: '3' },
|
||||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dnskey: {
|
dnskey: {
|
||||||
flags: { value: '0' },
|
flags: { value: '0' },
|
||||||
protocol: { value: '3' },
|
protocol: { value: '3' },
|
||||||
alg: { value: '5' },
|
alg: { value: '5' },
|
||||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
response = epp_request(xml, :xml)
|
response = epp_request(xml, :xml)
|
||||||
|
|
||||||
|
@ -580,12 +580,12 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(inf_data.css('status').first[:s]).to eq('clientHold')
|
expect(inf_data.css('status').first[:s]).to eq('clientHold')
|
||||||
expect(inf_data.css('registrant').text).to eq(d.owner_contact_code)
|
expect(inf_data.css('registrant').text).to eq(d.owner_contact_code)
|
||||||
|
|
||||||
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map { |x| x.text }
|
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map(&:text)
|
||||||
admin_contacts_existing = d.admin_contacts.pluck(:code)
|
admin_contacts_existing = d.admin_contacts.pluck(:code)
|
||||||
|
|
||||||
expect(admin_contacts_from_request).to eq(admin_contacts_existing)
|
expect(admin_contacts_from_request).to eq(admin_contacts_existing)
|
||||||
|
|
||||||
hosts_from_request = inf_data.css('hostObj').map { |x| x.text }
|
hosts_from_request = inf_data.css('hostObj').map(&:text)
|
||||||
hosts_existing = d.nameservers.where(ipv4: nil).pluck(:hostname)
|
hosts_existing = d.nameservers.where(ipv4: nil).pluck(:hostname)
|
||||||
|
|
||||||
expect(hosts_from_request).to eq(hosts_existing)
|
expect(hosts_from_request).to eq(hosts_existing)
|
||||||
|
|
|
@ -72,16 +72,16 @@ describe 'EPP Helper', epp: true do
|
||||||
|
|
||||||
xml = domain_create_xml({
|
xml = domain_create_xml({
|
||||||
name: { value: 'one.ee' },
|
name: { value: 'one.ee' },
|
||||||
period: {value: '345', attrs: { unit: 'd' } },
|
period: { value: '345', attrs: { unit: 'd' } },
|
||||||
ns: [
|
ns: [
|
||||||
{ hostObj: {value: 'ns1.test.net' } },
|
{ hostObj: { value: 'ns1.test.net' } },
|
||||||
{ hostObj: {value: 'ns2.test.net' } }
|
{ hostObj: { value: 'ns2.test.net' } }
|
||||||
],
|
],
|
||||||
registrant: { value: '32fsdaf' },
|
registrant: { value: '32fsdaf' },
|
||||||
_other: [
|
_other: [
|
||||||
{ contact: {value: '2323rafaf', attrs: { type: 'admin' } } },
|
{ contact: { value: '2323rafaf', attrs: { type: 'admin' } } },
|
||||||
{ contact: {value: '3dgxx', attrs: { type: 'tech' } } },
|
{ contact: { value: '3dgxx', attrs: { type: 'tech' } } },
|
||||||
{ contact: {value: '345xxv', attrs: { type: 'tech' } } }
|
{ contact: { value: '345xxv', attrs: { type: 'tech' } } }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -452,7 +452,6 @@ describe 'EPP Helper', epp: true do
|
||||||
generated = Nokogiri::XML(domain_delete_xml).to_s.squish
|
generated = Nokogiri::XML(domain_delete_xml).to_s.squish
|
||||||
expect(generated).to eq(expected)
|
expect(generated).to eq(expected)
|
||||||
|
|
||||||
|
|
||||||
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
<command>
|
<command>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
feature 'Contact management', type: :feature do
|
feature 'Contact management', type: :feature do
|
||||||
#background do
|
# background do
|
||||||
#end
|
# end
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
Fabricate(:user, country: Fabricate(:country, iso: 'EE'), admin: false, username: 'zone')
|
Fabricate(:user, country: Fabricate(:country, iso: 'EE'), admin: false, username: 'zone')
|
||||||
|
|
|
@ -74,7 +74,7 @@ end
|
||||||
|
|
||||||
describe Contact, '#up_id' do
|
describe Contact, '#up_id' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
#Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user), registrar: zone)
|
# Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user), registrar: zone)
|
||||||
@epp_user = Fabricate(:epp_user)
|
@epp_user = Fabricate(:epp_user)
|
||||||
@contact = Fabricate.build(:contact, code: 'asd12', created_by: @epp_user, updated_by: @epp_user)
|
@contact = Fabricate.build(:contact, code: 'asd12', created_by: @epp_user, updated_by: @epp_user)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue