mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Remove specs
This commit is contained in:
parent
68750883f0
commit
54577b530b
127 changed files with 1954 additions and 7197 deletions
|
@ -1,7 +1,11 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppContactCreateBaseTest < EppTestCase
|
||||
def test_creates_new_contact_with_minimum_required_parameters
|
||||
def test_creates_new_contact_with_required_attributes
|
||||
name = 'new'
|
||||
email = 'new@registrar.test'
|
||||
phone = '+1.2'
|
||||
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
|
@ -9,7 +13,76 @@ class EppContactCreateBaseTest < EppTestCase
|
|||
<create>
|
||||
<contact:create xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:postalInfo>
|
||||
<contact:name>New</contact:name>
|
||||
<contact:name>#{name}</contact:name>
|
||||
</contact:postalInfo>
|
||||
<contact:voice>#{phone}</contact:voice>
|
||||
<contact:email>#{email}</contact:email>
|
||||
</contact:create>
|
||||
</create>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:ident type="priv" cc="US">any</eis:ident>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
assert_difference 'Contact.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
contact = Contact.find_by(name: name)
|
||||
assert_equal name, contact.name
|
||||
assert_equal email, contact.email
|
||||
assert_equal phone, contact.phone
|
||||
assert_not_empty contact.code
|
||||
end
|
||||
|
||||
def test_respects_custom_code
|
||||
name = 'new'
|
||||
code = 'custom-id'
|
||||
session = epp_sessions(:api_bestnames)
|
||||
|
||||
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>
|
||||
<contact:create xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:id>#{code}</contact:id>
|
||||
<contact:postalInfo>
|
||||
<contact:name>#{name}</contact:name>
|
||||
</contact:postalInfo>
|
||||
<contact:voice>+1.2</contact:voice>
|
||||
<contact:email>any@any.test</contact:email>
|
||||
</contact:create>
|
||||
</create>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:ident type="priv" cc="US">any</eis:ident>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
|
||||
contact = Contact.find_by(name: name)
|
||||
assert_equal "#{session.user.registrar.code}:#{code}".upcase, contact.code
|
||||
end
|
||||
|
||||
def test_fails_when_required_attributes_are_missing
|
||||
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>
|
||||
<contact:create xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:postalInfo>
|
||||
<contact:name>\s</contact:name>
|
||||
</contact:postalInfo>
|
||||
<contact:voice>+123.4</contact:voice>
|
||||
<contact:email>new@inbox.test</contact:email>
|
||||
|
@ -24,15 +97,9 @@ class EppContactCreateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
assert_difference 'Contact.count' do
|
||||
assert_no_difference 'Contact.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
contact = Contact.last
|
||||
assert_not_empty contact.code
|
||||
assert_equal 'New', contact.name
|
||||
assert_equal 'new@inbox.test', contact.email
|
||||
assert_equal '+123.4', contact.phone
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -133,6 +133,98 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
assert_no_emails
|
||||
end
|
||||
|
||||
def test_non_existing_contact
|
||||
assert_nil Contact.find_by(code: 'non-existing')
|
||||
|
||||
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>
|
||||
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:id>non-existing</contact:id>
|
||||
<contact:chg>
|
||||
<contact:postalInfo>
|
||||
<contact:name>any</contact:name>
|
||||
</contact:postalInfo>
|
||||
</contact:chg>
|
||||
</contact:update>
|
||||
</update>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
||||
def test_ident_code_cannot_be_updated
|
||||
new_ident_code = '12345'
|
||||
assert_not_equal new_ident_code, @contact.ident
|
||||
|
||||
# https://github.com/internetee/registry/issues/415
|
||||
@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>
|
||||
<update>
|
||||
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:id>#{@contact.code}</contact:id>
|
||||
<contact:chg>
|
||||
<contact:postalInfo>
|
||||
</contact:postalInfo>
|
||||
</contact:chg>
|
||||
</contact:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:ident cc="#{@contact.ident_country_code}" type="#{@contact.ident_type}">#{new_ident_code}</eis:ident>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
assert_no_changes -> { @contact.updated_at } do
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :data_management_policy_violation
|
||||
end
|
||||
|
||||
# https://github.com/internetee/registry/issues/576
|
||||
def test_ident_type_and_ident_country_code_can_be_updated_when_absent
|
||||
@contact.update_columns(ident: 'test', ident_type: nil, ident_country_code: nil)
|
||||
|
||||
# https://github.com/internetee/registry/issues/415
|
||||
@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>
|
||||
<update>
|
||||
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:id>#{@contact.code}</contact:id>
|
||||
<contact:chg>
|
||||
<contact:postalInfo/>
|
||||
</contact:chg>
|
||||
</contact:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:ident cc="US" type="priv">#{@contact.ident}</eis:ident>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)
|
||||
|
@ -140,4 +232,4 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
assert_not_equal other_contact, contact
|
||||
Domain.update_all(registrant_id: other_contact)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateBaseTest < EppTestCase
|
||||
def test_domain_can_be_registered_with_required_attributes_only
|
||||
def test_registers_new_domain_with_required_attributes
|
||||
now = Time.zone.parse('2010-07-05')
|
||||
travel_to now
|
||||
name = "new.#{dns_zones(:one).origin}"
|
||||
registrant = contacts(:john).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>new.test</domain:name>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
<domain:name>#{name}</domain:name>
|
||||
<domain:registrant>#{registrant.code}</domain:registrant>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
|
@ -25,9 +30,223 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
|
||||
domain = Domain.last
|
||||
assert_equal 'new.test', domain.name
|
||||
assert_equal contacts(:john).becomes(Registrant), domain.registrant
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
domain = Domain.find_by(name: name)
|
||||
assert_equal name, domain.name
|
||||
assert_equal registrant, domain.registrant
|
||||
assert_not_empty domain.transfer_code
|
||||
|
||||
default_registration_period = 1.year + 1.day
|
||||
assert_equal now + default_registration_period, domain.expire_time
|
||||
end
|
||||
|
||||
def test_registers_reserved_domain_with_registration_code
|
||||
reserved_domain = reserved_domains(:one)
|
||||
registration_code = reserved_domain.registration_code
|
||||
|
||||
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>#{reserved_domain.name}</domain:name>
|
||||
<domain:registrant>#{contacts(:john).code}</domain:registrant>
|
||||
</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:reserved>
|
||||
<eis:pw>#{registration_code}</eis:pw>
|
||||
</eis:reserved>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
reserved_domain.reload
|
||||
assert_not_equal registration_code, reserved_domain.registration_code
|
||||
end
|
||||
|
||||
def test_respects_custom_transfer_code
|
||||
name = "new.#{dns_zones(:one).origin}"
|
||||
transfer_code = 'custom-transfer-code'
|
||||
|
||||
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>#{contacts(:john).code}</domain:registrant>
|
||||
<domain:authInfo>
|
||||
<domain:pw>#{transfer_code}</domain:pw>
|
||||
</domain:authInfo>
|
||||
</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
|
||||
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal transfer_code, Domain.find_by(name: name).transfer_code
|
||||
end
|
||||
|
||||
def test_blocked_domain_cannot_be_registered
|
||||
blocked_domain = 'blocked.test'
|
||||
assert BlockedDomain.find_by(name: blocked_domain)
|
||||
|
||||
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>#{blocked_domain}</domain:name>
|
||||
<domain:registrant>#{contacts(:john).code}</domain:registrant>
|
||||
</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/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :data_management_policy_violation
|
||||
end
|
||||
|
||||
def test_reserved_domain_cannot_be_registered_with_wrong_registration_code
|
||||
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>#{reserved_domains(:one).name}</domain:name>
|
||||
<domain:registrant>#{contacts(:john).code}</domain:registrant>
|
||||
</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:reserved>
|
||||
<eis:pw>wrong</eis:pw>
|
||||
</eis:reserved>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
||||
def test_reserved_domain_cannot_be_registered_without_registration_code
|
||||
reserved_domain = reserved_domains(:one)
|
||||
|
||||
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>#{reserved_domain.name}</domain:name>
|
||||
<domain:registrant>#{contacts(:john).code}</domain:registrant>
|
||||
</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/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
||||
def test_insufficient_funds
|
||||
session = epp_sessions(:api_bestnames)
|
||||
session.user.registrar.accounts.first.update!(balance: 0)
|
||||
|
||||
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>new.test</domain:name>
|
||||
<domain:registrant>#{contacts(:john).code}</domain:registrant>
|
||||
</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/command/create', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
end
|
||||
assert_epp_response :billing_failure
|
||||
end
|
||||
|
||||
def test_no_price
|
||||
assert_nil Billing::Price.find_by(duration: '2 months')
|
||||
|
||||
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>new.test</domain:name>
|
||||
<domain:period unit="m">2</domain:period>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
</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/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :billing_failure
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateReservedTest < EppTestCase
|
||||
setup do
|
||||
@reserved_domain = reserved_domains(:one)
|
||||
end
|
||||
|
||||
def test_registers_reserved_domain_with_correct_registration_code
|
||||
assert_equal 'reserved.test', @reserved_domain.name
|
||||
assert_equal 'reserved-001', @reserved_domain.registration_code
|
||||
|
||||
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>reserved.test</domain:name>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
</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:reserved>
|
||||
<eis:pw>reserved-001</eis:pw>
|
||||
</eis:reserved>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_registering_reserved_domain_regenerates_registration_code
|
||||
assert_equal 'reserved.test', @reserved_domain.name
|
||||
assert_equal 'reserved-001', @reserved_domain.registration_code
|
||||
|
||||
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>reserved.test</domain:name>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
</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:reserved>
|
||||
<eis:pw>reserved-001</eis:pw>
|
||||
</eis:reserved>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@reserved_domain.reload
|
||||
|
||||
assert_not_equal 'reserved-001', @reserved_domain.registration_code
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_with_wrong_registration_code
|
||||
assert_equal 'reserved.test', @reserved_domain.name
|
||||
assert_equal 'reserved-001', @reserved_domain.registration_code
|
||||
|
||||
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>reserved.test</domain:name>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
</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:reserved>
|
||||
<eis:pw>wrong</eis:pw>
|
||||
</eis:reserved>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_without_registration_code
|
||||
assert_equal 'reserved.test', @reserved_domain.name
|
||||
|
||||
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>reserved.test</domain:name>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
</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/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
end
|
|
@ -1,62 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateTransferCodeTest < EppTestCase
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
end
|
||||
|
||||
def test_generates_default
|
||||
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>brandnew.test</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
</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
|
||||
|
||||
post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
refute_empty Domain.find_by(name: 'brandnew.test').transfer_code
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_honors_custom
|
||||
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>brandnew.test</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:registrant>john-001</domain:registrant>
|
||||
<domain:authInfo>
|
||||
<domain:pw>1058ad73</domain:pw>
|
||||
</domain:authInfo>
|
||||
</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
|
||||
|
||||
post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_equal '1058ad73', Domain.find_by(name: 'brandnew.test').transfer_code
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
end
|
|
@ -1,52 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainUpdateTest < EppTestCase
|
||||
def setup
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_update_domain
|
||||
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:chg>
|
||||
<domain:authInfo>
|
||||
<domain:pw>f0ff7d17b0</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
assert_equal 'f0ff7d17b0', @domain.transfer_code
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_discarded_domain_cannot_be_updated
|
||||
@domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
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/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
end
|
295
test/integration/epp/domain/update/base_test.rb
Normal file
295
test/integration/epp/domain/update/base_test.rb
Normal file
|
@ -0,0 +1,295 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainUpdateBaseTest < EppTestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
def setup
|
||||
@domain = domains(:shop)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_update_domain
|
||||
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:chg>
|
||||
<domain:authInfo>
|
||||
<domain:pw>f0ff7d17b0</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
assert_equal 'f0ff7d17b0', @domain.transfer_code
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_discarded_domain_cannot_be_updated
|
||||
@domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
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/command/update', { frame: request_xml }, '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])
|
||||
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:update>
|
||||
</update>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal DomainStatus::PENDING_UPDATE, response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
end
|
||||
|
||||
def test_requires_verification_from_current_registrant_when_provided_registrant_is_a_new_one
|
||||
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||
new_registrant = contacts(:william).becomes(Registrant)
|
||||
assert_not_equal new_registrant, @domain.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>
|
||||
<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>#{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/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
assert_not_equal new_registrant, @domain.registrant
|
||||
assert @domain.registrant_verification_asked?
|
||||
assert_includes @domain.statuses, DomainStatus::PENDING_UPDATE
|
||||
assert_verification_and_notification_emails
|
||||
end
|
||||
|
||||
def test_requires_verification_from_current_registrant_when_not_yet_verified_by_registrar
|
||||
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||
new_registrant = contacts(:william)
|
||||
assert_not_equal new_registrant, @domain.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>
|
||||
<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/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
assert_not_equal new_registrant, @domain.registrant
|
||||
assert @domain.registrant_verification_asked?
|
||||
assert_includes @domain.statuses, DomainStatus::PENDING_UPDATE
|
||||
assert_verification_and_notification_emails
|
||||
end
|
||||
|
||||
def test_skips_verification_when_provided_registrant_is_the_same_as_current_one
|
||||
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||
|
||||
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>#{@domain.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/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_not @domain.registrant_verification_asked?
|
||||
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
|
||||
assert_no_emails
|
||||
end
|
||||
|
||||
def test_skips_verification_when_disabled
|
||||
Setting.request_confrimation_on_registrant_change_enabled = false
|
||||
new_registrant = contacts(:william).becomes(Registrant)
|
||||
assert_not_equal new_registrant, @domain.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>
|
||||
<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>#{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/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal new_registrant, @domain.registrant
|
||||
assert_not @domain.registrant_verification_asked?
|
||||
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
|
||||
assert_no_emails
|
||||
end
|
||||
|
||||
def test_skips_verification_from_current_registrant_when_already_verified_by_registrar
|
||||
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||
new_registrant = contacts(:william).becomes(Registrant)
|
||||
assert_not_equal new_registrant, @domain.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>
|
||||
<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="yes">#{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/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal new_registrant, @domain.registrant
|
||||
assert_not @domain.registrant_verification_asked?
|
||||
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
|
||||
assert_no_emails
|
||||
end
|
||||
|
||||
def test_deactivates_domain_when_all_name_servers_are_removed
|
||||
assert @domain.active?
|
||||
assert_equal 2, @domain.nameservers.count
|
||||
|
||||
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:rem>
|
||||
<domain:ns>
|
||||
<domain:hostAttr>
|
||||
<domain:hostName>#{nameservers(:shop_ns1).hostname}</domain:hostName>
|
||||
</domain:hostAttr>
|
||||
<domain:hostAttr>
|
||||
<domain:hostName>#{nameservers(:shop_ns2).hostname}</domain:hostName>
|
||||
</domain:hostAttr>
|
||||
</domain:ns>
|
||||
</domain:rem>
|
||||
</domain:update>
|
||||
</update>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert @domain.inactive?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assert_verification_and_notification_emails
|
||||
assert_emails 2
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue