Merge branch 'master' of https://github.com/internetee/registry into 39-registrant-confirmation-should-not-be-asked

This commit is contained in:
Oleg Hasjanov 2021-03-12 10:40:16 +02:00
commit 169318cd13
249 changed files with 3620 additions and 2725 deletions

View file

@ -26,7 +26,7 @@ class EppContactCheckBaseTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal '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
end
def test_contact_is_available
@ -52,7 +52,8 @@ class EppContactCheckBaseTest < EppTestCase
end
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@ -98,9 +99,61 @@ class EppContactCheckBaseTest < EppTestCase
assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size
end
def test_check_contact_with_prefix
@contact.update_columns(code: "#{@contact.registrar.code}:JOHN-001".upcase)
assert @contact.code, "#{@contact.registrar.code}:JOHN-001".upcase
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<check>
<contact:check xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>BESTNAMES:JOHN-001</contact:id>
</contact:check>
</check>
</command>
</epp>
XML
post epp_check_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
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
end
def test_check_contact_without_prefix
@contact.update_columns(code: "#{@contact.registrar.code}:JOHN-001".upcase)
assert @contact.code, "#{@contact.registrar.code}:JOHN-001".upcase
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<check>
<contact:check xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>JOHN-001</contact:id>
</contact:check>
</check>
</command>
</epp>
XML
post epp_check_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
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
end
private
def xml_schema
'https://epp.tld.ee/schema/contact-ee-1.1.xsd'
end
end
end

View file

@ -27,6 +27,60 @@ class EppContactDeleteBaseTest < EppTestCase
assert_epp_response :completed_successfully
end
def test_delete_contact_with_server_delete_prohibited
contact = deletable_contact
contact.update(statuses: Contact::SERVER_DELETE_PROHIBITED)
assert contact.statuses.include? Contact::SERVER_DELETE_PROHIBITED
contact.update_columns(code: contact.code.upcase)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<delete>
<contact:delete xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>#{contact.code.upcase}</contact:id>
</contact:delete>
</delete>
</command>
</epp>
XML
post epp_delete_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert Contact.exists?(id: contact.id)
assert_epp_response :object_status_prohibits_operation
end
def test_delete_contact_with_client_delete_prohibited
contact = deletable_contact
contact.update(statuses: Contact::CLIENT_DELETE_PROHIBITED)
assert contact.statuses.include? Contact::CLIENT_DELETE_PROHIBITED
contact.update_columns(code: contact.code.upcase)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<delete>
<contact:delete xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>#{contact.code.upcase}</contact:id>
</contact:delete>
</delete>
</command>
</epp>
XML
post epp_delete_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert Contact.exists?(id: contact.id)
assert_epp_response :object_status_prohibits_operation
end
def test_undeletable_cannot_be_deleted
contact = contacts(:john)
assert_not contact.deletable?
@ -61,4 +115,4 @@ class EppContactDeleteBaseTest < EppTestCase
DomainContact.delete_all
contacts(:john)
end
end
end

View file

@ -44,6 +44,58 @@ class EppContactInfoBaseTest < EppTestCase
contact: xml_schema).text
end
def test_get_info_about_contact_with_prefix
@contact.update_columns(code: 'TEST:JOHN-001')
assert @contact.code, 'TEST:JOHN-001'
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<info>
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>TEST:JOHN-001</contact:id>
</contact:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text
assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text
end
def test_get_info_about_contact_without_prefix
@contact.update_columns(code: "#{@contact.registrar.code}:JOHN-001".upcase)
assert @contact.code, "#{@contact.registrar.code}:JOHN-001".upcase
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<info>
<contact:info xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>JOHN-001</contact:id>
</contact:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text
assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text
end
def test_hides_password_and_name_when_current_registrar_is_not_sponsoring
non_sponsoring_registrar = registrars(:goodnames)
@contact.update!(registrar: non_sponsoring_registrar)

View file

@ -2,6 +2,51 @@ require 'test_helper'
class EppDomainCreateBaseTest < EppTestCase
def test_illegal_chars_in_dns_key
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
pub_key = "AwEAAddt2AkLf\n
\n
YGKgiEZB5SmIF8E\n
vrjxNMH6HtxW\rEA4RJ9Ao6LCWheg8"
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
</domain:create>
</create>
<extension>
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
<secDNS:keyData>
<secDNS:flags>257</secDNS:flags>
<secDNS:protocol>3</secDNS:protocol>
<secDNS:alg>8</secDNS:alg>
<secDNS:pubKey>#{pub_key}</secDNS:pubKey>
</secDNS:keyData>
</secDNS:create>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :parameter_value_syntax_error
end
def test_not_registers_domain_without_legaldoc
now = Time.zone.parse('2010-07-05')
travel_to now
@ -31,6 +76,230 @@ class EppDomainCreateBaseTest < EppTestCase
assert_epp_response :required_parameter_missing
end
def test_create_domain_with_unique_contact
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contacts(:jane).code}</domain:contact>
<domain:contact type="tech">#{contacts(:william).code}</domain:contact>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :completed_successfully
end
def test_create_domain_with_array_of_not_unique_admins_and_techs
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :parameter_value_policy_error
end
def test_create_domain_with_array_of_not_unique_admins
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :parameter_value_policy_error
end
def test_create_domain_with_array_of_not_unique_techs
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :parameter_value_policy_error
end
def test_create_domain_with_array_of_not_unique_admin_but_tech_another_one
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
contact_two = contacts(:william)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="admin">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact_two.code}</domain:contact>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :parameter_value_policy_error
end
def test_create_domain_with_array_of_not_unique_techs_but_admin_another_one
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
contact_two = contacts(:william)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<create>
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{name}</domain:name>
<domain:registrant>#{registrant.code}</domain:registrant>
<domain:contact type="admin">#{contact_two.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
<domain:contact type="tech">#{contact.code}</domain:contact>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :parameter_value_policy_error
end
def test_registers_new_domain_with_required_attributes
now = Time.zone.parse('2010-07-05')
travel_to now

View file

@ -133,6 +133,40 @@ class EppDomainDeleteBaseTest < EppTestCase
assert_epp_response :completed_successfully
end
def test_deletes_on_update_prohibited
assert_equal 'shop.test', @domain.name
@domain.update(statuses: [DomainStatus::SERVER_UPDATE_PROHIBITED])
Setting.request_confirmation_on_domain_deletion_enabled = false
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<delete>
<domain:delete xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
perform_enqueued_jobs do
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
@domain.reload
assert_not @domain.registrant_verification_asked?
assert_not @domain.pending_delete_confirmation?
assert_no_emails
assert_epp_response :completed_successfully
end
def test_skips_registrant_confirmation_when_required_but_already_verified_by_registrar
assert_equal 'shop.test', @domain.name
Setting.request_confirmation_on_domain_deletion_enabled = true

View file

@ -3,6 +3,7 @@ require 'test_helper'
class EppDomainTransferRequestTest < EppTestCase
def setup
@domain = domains(:shop)
@contact = contacts(:jane)
@new_registrar = registrars(:goodnames)
@original_transfer_wait_time = Setting.transfer_wait_time
Setting.transfer_wait_time = 0
@ -12,6 +13,95 @@ class EppDomainTransferRequestTest < EppTestCase
Setting.transfer_wait_time = @original_transfer_wait_time
end
def test_transfer_domain_with_contacts_if_registrant_and_tech_are_shared
@domain.tech_domain_contacts[0].update!(contact_id: @domain.registrant.id)
@domain.tech_domain_contacts[1].delete
@domain.reload
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
@domain.reload
tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id)
assert_equal @domain.contacts.where(original_id: @domain.registrant.original_id).count, 1
assert_equal tech.registrar_id, @domain.registrar.id
end
def test_transfer_domain_with_contacts_if_registrant_and_admin_are_shared
@domain.admin_domain_contacts[0].update!(contact_id: @domain.registrant.id)
@domain.tech_domain_contacts[0].update!(contact_id: @contact.id)
@domain.tech_domain_contacts[1].delete
@domain.reload
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
@domain.reload
admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id)
assert_equal @domain.contacts.where(original_id: @domain.registrant.original_id).count, 1
assert_equal admin.registrar_id, @domain.registrar.id
end
def test_transfer_domain_with_contacts_if_admin_and_tech_are_shared
@domain.admin_domain_contacts[0].update!(contact_id: @contact.id)
@domain.tech_domain_contacts[0].update!(contact_id: @contact.id)
@domain.tech_domain_contacts[1].delete
@domain.reload
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
@domain.reload
admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id)
tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id)
result_hash = @domain.contacts.pluck(:original_id).group_by(&:itself).transform_values(&:count)
assert result_hash[admin.original_id], 2
assert_equal admin.registrar_id, @domain.registrar.id
assert_equal tech.registrar_id, @domain.registrar.id
end
def test_transfer_domain_with_contacts_if_admin_and_tech_and_registrant_are_shared
@domain.tech_domain_contacts[0].update!(contact_id: @domain.registrant.id)
@domain.admin_domain_contacts[0].update!(contact_id: @domain.registrant.id)
@domain.tech_domain_contacts[1].delete
@domain.reload
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
@domain.reload
admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id)
tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id)
assert_equal @domain.contacts.where(original_id: @domain.registrant.original_id).count, 2
result_hash = @domain.contacts.pluck(:original_id).group_by(&:itself).transform_values(&:count)
assert result_hash[@domain.registrant.original_id], 2
assert_equal admin.registrar_id, @domain.registrar.id
assert_equal tech.registrar_id, @domain.registrar.id
end
def test_transfers_domain_at_once
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }

View file

@ -63,6 +63,27 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_epp_response :object_status_prohibits_operation
end
def test_prohibited_domain_cannot_be_updated
@domain.update!(statuses: [DomainStatus::SERVER_UPDATE_PROHIBITED])
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<update>
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>shop.test</domain:name>
</domain:update>
</update>
</command>
</epp>
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :object_status_prohibits_operation
end
def test_does_not_return_server_delete_prohibited_status_when_pending_update_status_is_set
@domain.update!(statuses: [DomainStatus::SERVER_DELETE_PROHIBITED,
DomainStatus::PENDING_UPDATE])
@ -124,6 +145,46 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_verification_and_notification_emails
end
def test_domain_should_doesnt_have_pending_update_when_updated_registrant_with_same_idents_data
assert_not @domain.statuses.include? "pendingUpdate"
old_registrant = @domain.registrant
new_registrant = contacts(:william).becomes(Registrant)
new_registrant.update(ident: old_registrant.ident)
new_registrant.update(ident_country_code: old_registrant.ident_country_code)
new_registrant.update(ident_type: old_registrant.ident_type)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<update>
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="no">#{new_registrant.code}</domain:registrant>
</domain:chg>
</domain:update>
</update>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
assert_epp_response :completed_successfully
assert_equal @domain.registrant, new_registrant
assert_not @domain.statuses.include? "pendingUpdate"
end
def test_requires_verification_from_current_registrant_when_not_yet_verified_by_registrar
Setting.request_confirmation_on_registrant_change_enabled = true
new_registrant = contacts(:william)

View file

@ -26,6 +26,31 @@ class EppPollTest < EppTestCase
assert_equal 'Your domain has been updated', xml_doc.at_css('msgQ msg').text
end
def test_does_not_drop_error_if_old_version
version = Version::DomainVersion.last
@notification.update(attached_obj_type: 'DomainVersion', attached_obj_id: version.id)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<poll op="req"/>
</command>
</epp>
XML
assert_nothing_raised do
post epp_poll_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
xml_doc = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully_ack_to_dequeue
assert_equal 2.to_s, xml_doc.at_css('msgQ')[:count]
assert_equal @notification.id.to_s, xml_doc.at_css('msgQ')[:id]
assert_equal Time.zone.parse('2010-07-05').utc.xmlschema, xml_doc.at_css('msgQ qDate').text
assert_equal 'Your domain has been updated', xml_doc.at_css('msgQ msg').text
end
def test_return_action_data_when_present
@notification.update!(action: actions(:contact_update))