diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 4e3d20305..bd9a1d4a3 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -802,7 +802,7 @@ class Epp::Domain < Domain next end - domain_name = DNS::DomainName.new(domain_name_as_string) + domain_name = DNS::DomainName.new(SimpleIDN.to_unicode(domain_name_as_string)) if domain_name.unavailable? reason = I18n.t("errors.messages.epp_domain_#{domain_name.unavailability_reason}") diff --git a/test/integration/epp/domain/check/auction_test.rb b/test/integration/epp/domain/check/auction_test.rb index efc048f85..6a2722dc5 100644 --- a/test/integration/epp/domain/check/auction_test.rb +++ b/test/integration/epp/domain/check/auction_test.rb @@ -1,8 +1,10 @@ +# encoding: UTF-8 require 'test_helper' class EppDomainCheckAuctionTest < ApplicationIntegrationTest setup do @auction = auctions(:one) + @idn_auction = auctions(:idn) Domain.release_to_auction = true end @@ -35,6 +37,56 @@ class EppDomainCheckAuctionTest < ApplicationIntegrationTest assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text end + def test_idn_ascii_domain_is_unavailable_when_at_auction + @idn_auction.update!(status: Auction.statuses[:started]) + + request_xml = <<-XML + + + + + + xn--pramiid-n2a.test + + + + + XML + + post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + + response_xml = Nokogiri::XML(response.body) + assert_equal '1000', response_xml.at_css('result')[:code] + assert_equal 1, response_xml.css('result').size + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] + assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + end + + def test_idn_unicode_domain_is_unavailable_when_at_auction + @idn_auction.update!(status: Auction.statuses[:started]) + + request_xml = <<-XML + + + + + + püramiid.test + + + + + XML + + post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + + response_xml = Nokogiri::XML(response.body) + assert_equal '1000', response_xml.at_css('result')[:code] + assert_equal 1, response_xml.css('result').size + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] + assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + end + def test_domain_is_unavailable_when_awaiting_payment @auction.update!(status: Auction.statuses[:awaiting_payment])