mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +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)
|
def user=(user)
|
||||||
@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
|
end
|
||||||
|
|
||||||
def info_xml(id, password = nil)
|
def info_xml(id, password = nil)
|
||||||
|
|
|
@ -53,11 +53,6 @@ module Depp
|
||||||
current_user.request(xml)
|
current_user.request(xml)
|
||||||
end
|
end
|
||||||
|
|
||||||
def hostname_present
|
|
||||||
domain_params[:nameservers_attributes]
|
|
||||||
.select { |_key, value| value['hostname'].present? }.any?
|
|
||||||
end
|
|
||||||
|
|
||||||
def create(domain_params)
|
def create(domain_params)
|
||||||
dns_hash = {}
|
dns_hash = {}
|
||||||
keys = Domain.create_dnskeys_hash(domain_params)
|
keys = Domain.create_dnskeys_hash(domain_params)
|
||||||
|
@ -66,7 +61,7 @@ module Depp
|
||||||
period = domain_params[:period].to_i.to_s
|
period = domain_params[:period].to_i.to_s
|
||||||
period_unit = domain_params[:period][-1].to_s
|
period_unit = domain_params[:period][-1].to_s
|
||||||
|
|
||||||
xml = if hostname_present
|
xml = if domain_params[:nameservers_attributes].select { |key, value| value['hostname'].present? }.any?
|
||||||
epp_xml.create({
|
epp_xml.create({
|
||||||
name: { value: domain_params[:name] },
|
name: { value: domain_params[:name] },
|
||||||
period: { value: period, attrs: { unit: period_unit } },
|
period: { value: period, attrs: { unit: period_unit } },
|
||||||
|
@ -242,12 +237,9 @@ module Depp
|
||||||
rem_arr << { ns: rem_ns } if rem_ns.any?
|
rem_arr << { ns: rem_ns } if rem_ns.any?
|
||||||
rem_arr << { _anonymus: rem_anon } if rem_anon.any?
|
rem_arr << { _anonymus: rem_anon } if rem_anon.any?
|
||||||
|
|
||||||
return if domain_params[:registrant] == old_domain_params[:registrant]
|
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] } }]
|
chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] if domain_params[:verified]
|
||||||
if domain_params[:verified].blank? && (domain_params[:verified])
|
|
||||||
chg = [{ registrant: { value: domain_params[:registrant],
|
|
||||||
attrs: { verified: 'yes' } } }]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
add_arr = nil if add_arr.none?
|
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