mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
fixed bag, added test
This commit is contained in:
parent
3fb1ccb41f
commit
3d9a763f32
3 changed files with 29 additions and 16 deletions
|
@ -77,7 +77,8 @@ module Depp
|
|||
|
||||
def user=(user)
|
||||
@user = user
|
||||
@epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag)
|
||||
@epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag, schema_prefix: 'contact-ee',
|
||||
schema_version: '1.1')
|
||||
end
|
||||
|
||||
def info_xml(id, password = nil)
|
||||
|
|
|
@ -53,11 +53,6 @@ module Depp
|
|||
current_user.request(xml)
|
||||
end
|
||||
|
||||
def hostname_present
|
||||
domain_params[:nameservers_attributes]
|
||||
.select { |_key, value| value['hostname'].present? }.any?
|
||||
end
|
||||
|
||||
def create(domain_params)
|
||||
dns_hash = {}
|
||||
keys = Domain.create_dnskeys_hash(domain_params)
|
||||
|
@ -66,16 +61,16 @@ module Depp
|
|||
period = domain_params[:period].to_i.to_s
|
||||
period_unit = domain_params[:period][-1].to_s
|
||||
|
||||
xml = if hostname_present
|
||||
epp_xml.create({
|
||||
xml = if domain_params[:nameservers_attributes].select { |key, value| value['hostname'].present? }.any?
|
||||
epp_xml.create({
|
||||
name: { value: domain_params[:name] },
|
||||
period: { value: period, attrs: { unit: period_unit } },
|
||||
ns: Domain.create_nameservers_hash(domain_params),
|
||||
registrant: { value: domain_params[:registrant] },
|
||||
_anonymus: Domain.create_contacts_hash(domain_params)
|
||||
}, dns_hash, Domain.construct_custom_params_hash(domain_params))
|
||||
else
|
||||
epp_xml.create({
|
||||
else
|
||||
epp_xml.create({
|
||||
name: { value: domain_params[:name] },
|
||||
period: { value: period, attrs: { unit: period_unit } },
|
||||
registrant: { value: domain_params[:registrant] },
|
||||
|
@ -242,12 +237,9 @@ module Depp
|
|||
rem_arr << { ns: rem_ns } if rem_ns.any?
|
||||
rem_arr << { _anonymus: rem_anon } if rem_anon.any?
|
||||
|
||||
return if domain_params[:registrant] == old_domain_params[:registrant]
|
||||
|
||||
chg = [{ registrant: { value: domain_params[:registrant] } }]
|
||||
if domain_params[:verified].blank? && (domain_params[:verified])
|
||||
chg = [{ registrant: { value: domain_params[:registrant],
|
||||
attrs: { verified: 'yes' } } }]
|
||||
if domain_params[:registrant] != old_domain_params[:registrant]
|
||||
chg = [{ registrant: { value: domain_params[:registrant] } }] unless domain_params[:verified].present?
|
||||
chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] if domain_params[:verified]
|
||||
end
|
||||
|
||||
add_arr = nil if add_arr.none?
|
||||
|
|
20
test/system/registrar_area/domain/domain_test.rb
Normal file
20
test/system/registrar_area/domain/domain_test.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class Domainest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@user = users(:api_bestnames)
|
||||
@contact = contacts(:jack)
|
||||
|
||||
@domain = domains(:shop)
|
||||
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
def test_update_tech_contact
|
||||
visit edit_registrar_domains_path + "?domain_name=#{@domain.name}"
|
||||
fill_in 'domain_contacts_attributes_0_code_helper', with: "#{@contact.code} #{@contact.name}"
|
||||
click_on 'Save'
|
||||
|
||||
assert_redirect_to info_registrar_domains_url(domain_name: @domain_params[:name])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue