mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
parent
640faaadb9
commit
42e8f86dae
51 changed files with 1619 additions and 53 deletions
87
test/integration/epp/domain/check/auction_test.rb
Normal file
87
test/integration/epp/domain/check/auction_test.rb
Normal file
|
@ -0,0 +1,87 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
@auction = auctions(:one)
|
||||
Domain.release_to_auction = true
|
||||
end
|
||||
|
||||
teardown do
|
||||
Domain.release_to_auction = false
|
||||
end
|
||||
|
||||
def test_domain_is_unavailable_when_at_auction
|
||||
@auction.update!(status: Auction.statuses[:started])
|
||||
|
||||
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>
|
||||
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>auction.test</domain:name>
|
||||
</domain:check>
|
||||
</check>
|
||||
</command>
|
||||
</epp>
|
||||
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])
|
||||
|
||||
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>
|
||||
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>auction.test</domain:name>
|
||||
</domain:check>
|
||||
</check>
|
||||
</command>
|
||||
</epp>
|
||||
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 'Awaiting payment', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
end
|
||||
|
||||
def test_domain_is_available_when_payment_received
|
||||
@auction.update!(status: Auction.statuses[:payment_received])
|
||||
|
||||
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>
|
||||
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>auction.test</domain:name>
|
||||
</domain:check>
|
||||
</check>
|
||||
</command>
|
||||
</epp>
|
||||
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 '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
|
||||
end
|
||||
end
|
248
test/integration/epp/domain/create/auction_test.rb
Normal file
248
test/integration/epp/domain/create/auction_test.rb
Normal file
|
@ -0,0 +1,248 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
@auction = auctions(:one)
|
||||
Domain.release_to_auction = true
|
||||
end
|
||||
|
||||
teardown do
|
||||
Domain.release_to_auction = false
|
||||
end
|
||||
|
||||
def test_registers_domain_without_registration_code_when_not_at_auction
|
||||
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>not-at-auction.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_difference 'Domain.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', response_xml.at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
end
|
||||
|
||||
def test_registers_domain_with_correct_registration_code_after_another_auction_when_payment_is_received
|
||||
@auction.update!(status: Auction.statuses[:domain_registered], registration_code: 'some')
|
||||
|
||||
another_auction = @auction.dup
|
||||
another_auction.uuid = nil
|
||||
another_auction.status = Auction.statuses[:payment_received]
|
||||
another_auction.registration_code = 'auction002'
|
||||
another_auction.save!
|
||||
|
||||
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>auction.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:reserved>
|
||||
<eis:pw>auction002</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
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', response_xml.at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
end
|
||||
|
||||
def test_registers_domain_with_correct_registration_code_when_payment_is_received
|
||||
@auction.update!(status: Auction.statuses[:payment_received],
|
||||
registration_code: 'auction001')
|
||||
|
||||
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>auction.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:reserved>
|
||||
<eis:pw>auction001</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
|
||||
|
||||
@auction.reload
|
||||
assert @auction.domain_registered?
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', response_xml.at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_without_registration_code
|
||||
@auction.update!(status: Auction.statuses[:payment_received],
|
||||
registration_code: 'auction001')
|
||||
|
||||
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>auction.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=api_bestnames'
|
||||
end
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2003', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Required parameter missing; reserved>pw element is required',
|
||||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_with_wrong_registration_code
|
||||
@auction.update!(status: Auction.statuses[:payment_received],
|
||||
registration_code: 'auction001')
|
||||
|
||||
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>auction.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: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
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2202', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Invalid authorization information; invalid reserved>pw value',
|
||||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_when_payment_is_not_received
|
||||
@auction.update!(status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
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>auction.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:reserved>
|
||||
<eis:pw>test</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
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2003', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Required parameter missing; reserved>pw element required for reserved domains',
|
||||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_when_at_auction
|
||||
@auction.update!(status: Auction.statuses[:started])
|
||||
|
||||
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>auction.test</domain:name>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">test</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
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2306', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Parameter value policy error: domain is at auction',
|
||||
response_xml.at_css('result msg').text
|
||||
end
|
||||
end
|
87
test/integration/epp/domain/info/auction_test.rb
Normal file
87
test/integration/epp/domain/info/auction_test.rb
Normal file
|
@ -0,0 +1,87 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainInfoAuctionTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
@auction = auctions(:one)
|
||||
Domain.release_to_auction = true
|
||||
end
|
||||
|
||||
teardown do
|
||||
Domain.release_to_auction = false
|
||||
end
|
||||
|
||||
def test_domain_is_unavailable_when_at_auction
|
||||
@auction.update!(status: Auction.statuses[:started])
|
||||
|
||||
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>
|
||||
<domain:info xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>auction.test</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/info', { 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 'auction.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
assert_equal 'At auction', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s']
|
||||
end
|
||||
|
||||
def test_domain_is_reserved_when_awaiting_payment
|
||||
@auction.update!(status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
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>
|
||||
<domain:info xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>auction.test</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/info', { 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 'auction.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
assert_equal 'Awaiting payment', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s']
|
||||
end
|
||||
|
||||
def test_domain_is_reserved_when_payment_received
|
||||
@auction.update!(status: Auction.statuses[:payment_received])
|
||||
|
||||
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>
|
||||
<domain:info xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>auction.test</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/command/info', { 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 'auction.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
assert_equal 'Reserved', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s']
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue