mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Merge branch '1832-registrar-prefix-on-contact-info-and-check-requests' of https://github.com/internetee/registry into 1832-registrar-prefix-on-contact-info-and-check-requests
This commit is contained in:
commit
1960164223
2 changed files with 6 additions and 5 deletions
|
@ -45,9 +45,9 @@ class Epp::Contact < Contact
|
||||||
def check_availability(codes, reg:)
|
def check_availability(codes, reg:)
|
||||||
codes = [codes] if codes.is_a?(String)
|
codes = [codes] if codes.is_a?(String)
|
||||||
res = []
|
res = []
|
||||||
codes.map { |c| c.strip.upcase }.map { |c| c.include?(':') ? c : "#{reg}:#{c}" }.each do |x|
|
codes.map { |c| c.include?(':') ? c : "#{reg}:#{c}" }.map { |c| c.strip.upcase }.each do |x|
|
||||||
c = find_by_epp_code(x)
|
c = find_by_epp_code(x)
|
||||||
res << c ? { code: c.code, avail: 0, reason: 'in use' } : { code: x, avail: 1 }
|
res << (c ? { code: c.code, avail: 0, reason: 'in use' } : { code: x, avail: 1 })
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -52,7 +52,8 @@ class EppContactCheckBaseTest < EppTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_is_unavailable
|
def test_contact_is_unavailable
|
||||||
assert_equal 'john-001', @contact.code
|
@contact.update_columns(code: "#{@contact.registrar.code}:JOHN-001".upcase)
|
||||||
|
assert @contact.code, "#{@contact.registrar.code}:JOHN-001".upcase
|
||||||
|
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
@ -108,7 +109,7 @@ class EppContactCheckBaseTest < EppTestCase
|
||||||
<command>
|
<command>
|
||||||
<check>
|
<check>
|
||||||
<contact:check xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
<contact:check xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||||
<contact:id>TEST:JOHN-001</contact:id>
|
<contact:id>BESTNAMES:JOHN-001</contact:id>
|
||||||
</contact:check>
|
</contact:check>
|
||||||
</check>
|
</check>
|
||||||
</command>
|
</command>
|
||||||
|
@ -120,7 +121,7 @@ class EppContactCheckBaseTest < EppTestCase
|
||||||
|
|
||||||
response_xml = Nokogiri::XML(response.body)
|
response_xml = Nokogiri::XML(response.body)
|
||||||
assert_epp_response :completed_successfully
|
assert_epp_response :completed_successfully
|
||||||
assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text
|
assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text
|
||||||
assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text
|
assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue