mirror of
https://github.com/internetee/registry.git
synced 2025-08-18 23:43:57 +02:00
added test for domain transfer iteraction
This commit is contained in:
parent
2620933543
commit
4d9c81f63b
17 changed files with 385 additions and 41 deletions
|
@ -185,7 +185,6 @@ module Actions
|
|||
|
||||
def validate_ns_records
|
||||
return unless domain.nameservers.any?
|
||||
return unless dns_validation_enabled?
|
||||
|
||||
result = DNSValidator.validate(domain: domain, name: domain.name, record_type: 'NS')
|
||||
return if result[:errors].blank?
|
||||
|
@ -195,7 +194,6 @@ module Actions
|
|||
|
||||
def validate_dns_records
|
||||
return unless domain.dnskeys.any?
|
||||
return unless dns_validation_enabled?
|
||||
|
||||
result = DNSValidator.validate(domain: domain, name: domain.name, record_type: 'DNSKEY')
|
||||
return if result[:errors].blank?
|
||||
|
@ -228,13 +226,6 @@ module Actions
|
|||
end
|
||||
end
|
||||
|
||||
def dns_validation_enabled?
|
||||
# Enable DNS validation in production or when explicitly enabled
|
||||
# Disabled in test environment by default unless explicitly enabled
|
||||
return ENV['DNS_VALIDATION_ENABLED'] == 'true' if Rails.env.test?
|
||||
Rails.env.production? || ENV['DNS_VALIDATION_ENABLED'] == 'true'
|
||||
end
|
||||
|
||||
def validation_process_errored?
|
||||
return if domain.valid?
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@ module Actions
|
|||
# return domain.pending_transfer if domain.pending_transfer
|
||||
# attach_legal_document(::Deserializers::Xml::LegalDocument.new(frame).call)
|
||||
|
||||
return if domain.errors[:epp_errors].any?
|
||||
return false if domain.errors[:epp_errors].any?
|
||||
|
||||
commit
|
||||
true
|
||||
end
|
||||
|
||||
def domain_exists?
|
||||
|
@ -34,6 +35,8 @@ module Actions
|
|||
validate_registrar
|
||||
validate_eligilibty
|
||||
validate_not_discarded
|
||||
validate_ns_records
|
||||
validate_dns_records
|
||||
end
|
||||
|
||||
def valid_transfer_code?
|
||||
|
@ -62,6 +65,30 @@ module Actions
|
|||
domain.add_epp_error('2106', nil, nil, 'Object is not eligible for transfer')
|
||||
end
|
||||
|
||||
def validate_ns_records
|
||||
return unless domain.nameservers.any?
|
||||
|
||||
result = DNSValidator.validate(domain: domain, name: domain.name, record_type: 'NS')
|
||||
return if result[:errors].blank?
|
||||
|
||||
assign_dns_validation_error(result[:errors])
|
||||
end
|
||||
|
||||
def validate_dns_records
|
||||
return unless domain.dnskeys.any?
|
||||
|
||||
result = DNSValidator.validate(domain: domain, name: domain.name, record_type: 'DNSKEY')
|
||||
return if result[:errors].blank?
|
||||
|
||||
assign_dns_validation_error(result[:errors])
|
||||
end
|
||||
|
||||
def assign_dns_validation_error(errors)
|
||||
errors.each do |error|
|
||||
domain.add_epp_error('2306', nil, nil, error)
|
||||
end
|
||||
end
|
||||
|
||||
def commit
|
||||
bare_domain = Domain.find(domain.id)
|
||||
::DomainTransfer.request(bare_domain, user)
|
||||
|
|
|
@ -101,7 +101,6 @@ module Actions
|
|||
|
||||
def validate_ns_records
|
||||
return unless domain.nameservers.any?
|
||||
return unless dns_validation_enabled?
|
||||
|
||||
result = DNSValidator.validate(domain: domain, name: domain.name, record_type: 'NS')
|
||||
return if result[:errors].blank?
|
||||
|
@ -111,7 +110,6 @@ module Actions
|
|||
|
||||
def validate_dns_records
|
||||
return unless domain.dnskeys.any?
|
||||
return unless dns_validation_enabled?
|
||||
|
||||
result = DNSValidator.validate(domain: domain, name: domain.name, record_type: 'DNSKEY')
|
||||
return if result[:errors].blank?
|
||||
|
@ -125,13 +123,6 @@ module Actions
|
|||
end
|
||||
end
|
||||
|
||||
def dns_validation_enabled?
|
||||
# Enable DNS validation in production or when explicitly enabled
|
||||
# Disabled in test environment by default unless explicitly enabled
|
||||
return ENV['DNS_VALIDATION_ENABLED'] == 'true' if Rails.env.test?
|
||||
Rails.env.production? || ENV['DNS_VALIDATION_ENABLED'] == 'true'
|
||||
end
|
||||
|
||||
def assign_dnssec_modifications
|
||||
@dnskeys = []
|
||||
params[:dns_keys].each do |key|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue