diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 39e0d7af59..adcad8f721 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -169,26 +169,26 @@ def validate_update def parsed_response_for_dnskey(value) doc = Nokogiri::Slop params[:parsed_frame].css(value).to_html - return true if doc.document.children.empty? - + store = [] - if value == 'add' - doc.document.add.children.each_with_index do |x, i| - store << doc.document.add.children[i].name + case value + when 'add' + doc.document.add.children.each_with_index do |_x, i| + store << doc.document.add.children[i].name end - elsif value == 'chg' - doc.document.chg.children.each_with_index do |x, i| - store << doc.document.chg.children[i].name + when 'chg' + doc.document.chg.children.each_with_index do |_x, i| + store << doc.document.chg.children[i].name end else - doc.document.rem.children.each_with_index do |x, i| - store << doc.document.rem.children[i].name + doc.document.rem.children.each_with_index do |_x, i| + store << doc.document.rem.children[i].name end end - return true if store.size == 1 and store[0] == "keyData" + return true if store.size.positive? && store.include?('keyData') store.empty? end @@ -209,10 +209,9 @@ def dnskey_update_enabled return if parsed_response_for_dnskey('rem') end - return epp_errors.add(:epp_errors, - code: '2304', - msg: "#{I18n.t(:object_status_prohibits_operation)} - :serverObjUpdateEnabled") + epp_errors.add(:epp_errors, + code: '2304', + msg: "#{I18n.t(:object_status_prohibits_operation)} :serverObjUpdateProhibited") end end diff --git a/test/integration/epp/domain/update/replace_dns_test.rb b/test/integration/epp/domain/update/replace_dns_test.rb new file mode 100644 index 0000000000..62dcbc299f --- /dev/null +++ b/test/integration/epp/domain/update/replace_dns_test.rb @@ -0,0 +1,47 @@ +require 'test_helper' + +class EppDomainUpdateReplaceDnsTest < EppTestCase + def test_parsed_response_for_dnskey_with_spaces_in_request + doc = Nokogiri::XML::Document.parse(schema_update) + params = { parsed_frame: doc } + domain_controller = Epp::DomainsController.new + domain_controller.params = ActionController::Parameters.new(params) + + assert_equal(domain_controller.send(:parsed_response_for_dnskey, 'rem'), true) + assert_equal(domain_controller.send(:parsed_response_for_dnskey, 'add'), true) + end + + def schema_update + <<~XML + + + + + + shop.test + + + + + \n + + 257 + 3 + 8 + AwEAAbXae59P87nfCP1MpLJouUhtDlVFbgek392nxqJcIHwYAs5sd4O4BPAvd41VmqhWllTiArNYDBV8UAtPZ8eZtYDC4D7ITC1HsxzQzzMUOorrNwMQMFq/PHP9tKelfRh68dh7UX0nTKlIouTcZ3xbqxAeoAbgvFjj/ZDS8G4QE2NgdonaK2w9q/da189zrZUhyAgecZCiTXbqqXd/LNXGRwDjJgFBWBmXbEjkcSfHke7idAcGqmYK2E5FstsmEwDcupxZ8jxuN1m/wDrBeZE5UdT24LtLGDda+ATXvCuARhQtZzSAn0JOdfGN5xJ02g+OtsbVC/mSGR3rykjzJ+hUlPU=\n + + \n + + 257 + 3 + 8 + AwEAAdas/oY6xQV2MYd+o5pcUHK0f/mtETRNyBhh/TSABqRM9JikXlSrwLFT9sAfOsTiRNbPnvEiCKdEdoN0f0Oel0WNXadLlVINmxtCue93bSX7zxrVvjhbkHffOVdpBL0CIDQoX1HPZmoBXXPdZtWLpDQ7nVfUtdC/McTFSRawUYaoCWOEAgC8YY+kh6C8TUZzHMl+JiVE6YFkTIFf+z4MxA920UxUnGpdcfRbcB0CYjCxe+PuiA+aZHFheEe5S5tlW7tO96hxK/k2l93N//T2mEM53TKomk62HoWvNVdPrs7jdZbGzeY2eBPDWMAIIpgOv9ApORi+kHSQm2POCwf/KYs=\n + + + + 0.04946500 1632965705 + +\n + XML + end +end diff --git a/test/system/registrar_area/bulk_change/nameserver_test.rb b/test/system/registrar_area/bulk_change/nameserver_test.rb index 8a053333f3..b6aa37e595 100644 --- a/test/system/registrar_area/bulk_change/nameserver_test.rb +++ b/test/system/registrar_area/bulk_change/nameserver_test.rb @@ -3,6 +3,7 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase setup do sign_in users(:api_goodnames) + Capybara.default_max_wait_time = 5 end def test_replaces_current_registrar_nameservers