diff --git a/app/models/dnskey.rb b/app/models/dnskey.rb index e9e15802f..348bddde7 100644 --- a/app/models/dnskey.rb +++ b/app/models/dnskey.rb @@ -34,9 +34,12 @@ class Dnskey < ApplicationRecord def epp_code_map { '2005' => [ - [:alg, :invalid, { value: { obj: 'alg', val: alg }, values: ALGORITHMS.join(', ') }], - [:protocol, :invalid, { value: { obj: 'protocol', val: protocol }, values: PROTOCOLS.join(', ') }], - [:flags, :invalid, { value: { obj: 'flags', val: flags }, values: FLAGS.join(', ') }] + [:alg, :invalid, { value: { obj: 'alg', val: alg }, + values: "Valid algorithms are: #{ALGORITHMS.join(', ')}" }], + [:protocol, :invalid, { value: { obj: 'protocol', val: protocol }, + values: "Valid protocols are: #{PROTOCOLS.join(', ')}" }], + [:flags, :invalid, { value: { obj: 'flags', val: flags }, + values: "Valid protocols are: #{PROTOCOLS.join(', ')}" }], ], '2302' => [ [:public_key, :taken, { value: { obj: 'pubKey', val: public_key } }] diff --git a/config/locales/en.yml b/config/locales/en.yml index a28d97f81..8ba570e6c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -123,7 +123,7 @@ en: dnskey: attributes: alg: - invalid: 'Valid algorithms are: %{values}' + invalid: '%{values}' blank: 'Algorithm is missing' protocol: invalid: 'Valid protocols are: %{values}' diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index 0fb0a5fff..54f817c94 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -17,6 +17,37 @@ class EppDomainUpdateBaseTest < EppTestCase @original_registrant_change_verification end + def test_update_dnskey_with_invalid_alg + request_xml = <<~XML + + + + + + shop.test + + + + + + 257 + 3 + 666 + P25MwGXr2sTbxdOIKRNbSC8bUO2CObo4/T8kMFoKcgs= + + + + + + XML + + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + response_xml = Nokogiri::XML(response.body) + assert_correct_against_schema response_xml + assert_epp_response :parameter_value_syntax_error + end + def test_update_domain request_xml = <<-XML