mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Introduce custom assertion
This commit is contained in:
parent
5939da366e
commit
348e6e5d7a
54 changed files with 378 additions and 389 deletions
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppContactCheckBaseTest < ActionDispatch::IntegrationTest
|
||||
class EppContactCheckBaseTest < EppTestCase
|
||||
setup do
|
||||
@contact = contacts(:john)
|
||||
end
|
||||
|
@ -24,8 +24,7 @@ class EppContactCheckBaseTest < ActionDispatch::IntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
assert_equal 'john-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppContactCreateBaseTest < ActionDispatch::IntegrationTest
|
||||
class EppContactCreateBaseTest < EppTestCase
|
||||
def test_creates_new_contact_with_minimum_required_parameters
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
@ -28,9 +28,7 @@ class EppContactCreateBaseTest < ActionDispatch::IntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
contact = Contact.last
|
||||
assert_not_empty contact.code
|
||||
assert_equal 'New', contact.name
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppContactDeleteBaseTest < ActionDispatch::IntegrationTest
|
||||
class EppContactDeleteBaseTest < EppTestCase
|
||||
def test_deletes_contact
|
||||
contact = deletable_contact
|
||||
|
||||
|
@ -23,9 +23,7 @@ class EppContactDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
assert_difference 'Contact.count', -1 do
|
||||
post '/epp/command/delete', { 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, response_xml.css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_undeletable_cannot_be_deleted
|
||||
|
@ -51,8 +49,7 @@ class EppContactDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
assert_no_difference 'Contact.count' do
|
||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2305', response_xml.at_css('result')[:code]
|
||||
assert_epp_response :object_association_prohibits_operation
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppContactInfoBaseTest < ActionDispatch::IntegrationTest
|
||||
class EppContactInfoBaseTest < EppTestCase
|
||||
setup do
|
||||
@contact = contacts(:john)
|
||||
end
|
||||
|
@ -32,8 +32,7 @@ class EppContactInfoBaseTest < ActionDispatch::IntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
assert_equal 'JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text
|
||||
assert_equal 'ok', response_xml.at_xpath('//contact:status', contact: xml_schema)['s']
|
||||
assert_equal 'john@inbox.test', response_xml.at_xpath('//contact:email', contact: xml_schema)
|
||||
|
@ -62,8 +61,7 @@ class EppContactInfoBaseTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2303', response_xml.at_css('result')[:code]
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppContactUpdateBaseTest < ActionDispatch::IntegrationTest
|
||||
class EppContactUpdateBaseTest < EppTestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
|
@ -40,9 +40,7 @@ class EppContactUpdateBaseTest < ActionDispatch::IntegrationTest
|
|||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@contact.reload
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', response_xml.at_css('result')[:code]
|
||||
assert_equal 1, response_xml.css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal 'new name', @contact.name
|
||||
assert_equal 'new-email@inbox.test', @contact.email
|
||||
assert_equal '+123.4', @contact.phone
|
||||
|
@ -158,8 +156,7 @@ class EppContactUpdateBaseTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2303', response_xml.at_css('result')[:code]
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
require 'test_helper'
|
||||
|
||||
class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
||||
class EppDomainCheckAuctionTest < EppTestCase
|
||||
setup do
|
||||
@auction = auctions(:one)
|
||||
@idn_auction = auctions(:idn)
|
||||
|
@ -31,8 +31,7 @@ class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
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
|
||||
|
@ -56,8 +55,7 @@ class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
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
|
||||
|
@ -81,8 +79,7 @@ class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
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
|
||||
|
@ -106,8 +103,7 @@ class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
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
|
||||
|
@ -131,8 +127,7 @@ class EppDomainCheckAuctionTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCheckBaseTest < ApplicationIntegrationTest
|
||||
class EppDomainCheckBaseTest < EppTestCase
|
||||
def test_returns_valid_response
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
@ -18,8 +18,7 @@ class EppDomainCheckBaseTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: UTF-8
|
||||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
||||
class EppDomainCreateAuctionIdnTest < EppTestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
|
@ -46,11 +46,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
|
||||
@idn_auction.reload
|
||||
refute @idn_auction.domain_registered?
|
||||
|
||||
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
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
||||
def test_domain_with_unicode_idn_cannot_be_registered_without_registration_code
|
||||
|
@ -84,11 +80,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
|
||||
@idn_auction.reload
|
||||
refute @idn_auction.domain_registered?
|
||||
|
||||
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
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
||||
def test_domain_with_ascii_idn_cannot_be_registered_without_winning_the_auction
|
||||
|
@ -121,11 +113,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
|
||||
@idn_auction.reload
|
||||
refute @idn_auction.domain_registered?
|
||||
|
||||
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
|
||||
assert_epp_response :parameter_value_policy_error
|
||||
end
|
||||
|
||||
def test_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auction
|
||||
|
@ -195,11 +183,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
|
||||
@idn_auction.reload
|
||||
refute @idn_auction.domain_registered?
|
||||
|
||||
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
|
||||
assert_epp_response :parameter_value_policy_error
|
||||
end
|
||||
|
||||
def test_registers_unicode_domain_with_correct_registration_code_when_payment_is_received
|
||||
|
@ -235,10 +219,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
@idn_auction.reload
|
||||
assert @idn_auction.domain_registered?
|
||||
assert Domain.where(name: @idn_auction.domain).exists?
|
||||
|
||||
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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_registers_ascii_domain_with_correct_registration_code_when_payment_is_received
|
||||
|
@ -274,9 +255,6 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
@idn_auction.reload
|
||||
assert @idn_auction.domain_registered?
|
||||
assert Domain.where(name: @idn_auction.domain).exists?
|
||||
|
||||
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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
||||
class EppDomainCreateAuctionTest < EppTestCase
|
||||
setup do
|
||||
@auction = auctions(:one)
|
||||
Domain.release_to_auction = true
|
||||
|
@ -33,9 +33,7 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_registers_domain_with_correct_registration_code_after_another_auction_when_payment_is_received
|
||||
|
@ -72,9 +70,7 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_registers_domain_with_correct_registration_code_when_payment_is_received
|
||||
|
@ -109,10 +105,7 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
|
||||
@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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_without_registration_code
|
||||
|
@ -141,10 +134,7 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_with_wrong_registration_code
|
||||
|
@ -176,10 +166,7 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_when_payment_is_not_received
|
||||
|
@ -210,10 +197,7 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_when_at_auction
|
||||
|
@ -240,9 +224,6 @@ class EppDomainCreateAuctionTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :parameter_value_policy_error
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateBaseTest < ApplicationIntegrationTest
|
||||
class EppDomainCreateBaseTest < EppTestCase
|
||||
def test_domain_can_be_registered_with_required_attributes_only
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
@ -28,9 +28,6 @@ class EppDomainCreateBaseTest < ApplicationIntegrationTest
|
|||
domain = Domain.last
|
||||
assert_equal 'new.test', domain.name
|
||||
assert_equal contacts(:john).becomes(Registrant), domain.registrant
|
||||
|
||||
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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateNameserversTest < ApplicationIntegrationTest
|
||||
class EppDomainCreateNameserversTest < EppTestCase
|
||||
# Glue record requirement
|
||||
def test_nameserver_ip_address_is_required_if_hostname_is_under_the_same_domain
|
||||
request_xml = <<-XML
|
||||
|
@ -30,6 +30,6 @@ class EppDomainCreateNameserversTest < ApplicationIntegrationTest
|
|||
assert_no_difference 'Domain.count' do
|
||||
post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_equal '2003', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateReservedTest < ApplicationIntegrationTest
|
||||
class EppDomainCreateReservedTest < EppTestCase
|
||||
setup do
|
||||
@reserved_domain = reserved_domains(:one)
|
||||
end
|
||||
|
@ -34,10 +34,7 @@ class EppDomainCreateReservedTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_registering_reserved_domain_regenerates_registration_code
|
||||
|
@ -101,11 +98,7 @@ class EppDomainCreateReservedTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_registered_without_registration_code
|
||||
|
@ -133,10 +126,6 @@ class EppDomainCreateReservedTest < ApplicationIntegrationTest
|
|||
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
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainCreateTransferCodeTest < ApplicationIntegrationTest
|
||||
class EppDomainCreateTransferCodeTest < EppTestCase
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
end
|
||||
|
@ -28,8 +28,7 @@ class EppDomainCreateTransferCodeTest < ApplicationIntegrationTest
|
|||
|
||||
post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
refute_empty Domain.find_by(name: 'brandnew.test').transfer_code
|
||||
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_honors_custom
|
||||
|
@ -58,7 +57,6 @@ class EppDomainCreateTransferCodeTest < ApplicationIntegrationTest
|
|||
|
||||
post '/epp/command/create', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_equal '1058ad73', Domain.find_by(name: 'brandnew.test').transfer_code
|
||||
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
||||
class EppDomainDeleteBaseTest < EppTestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
|
@ -36,8 +36,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
assert_includes Domain.find_by(name: 'invalid.test').statuses, DomainStatus::PENDING_DELETE_CONFIRMATION
|
||||
assert_equal '1001', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
end
|
||||
|
||||
def test_discarded_domain_cannot_be_deleted
|
||||
|
@ -65,7 +64,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
assert_no_difference 'Domain.count' do
|
||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_equal '2105', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :object_is_not_eligible_for_renewal
|
||||
end
|
||||
|
||||
def test_requests_registrant_confirmation_when_required
|
||||
|
@ -96,8 +95,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
assert @domain.registrant_verification_asked?
|
||||
assert @domain.pending_delete_confirmation?
|
||||
assert_emails 1
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1001', response_xml.at_css('result')[:code]
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
end
|
||||
|
||||
def test_skips_registrant_confirmation_when_not_required
|
||||
|
@ -128,8 +126,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
assert_not @domain.registrant_verification_asked?
|
||||
assert_not @domain.pending_delete_confirmation?
|
||||
assert_no_emails
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', response_xml.at_css('result')[:code]
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_skips_registrant_confirmation_when_required_but_already_verified_by_registrar
|
||||
|
@ -160,8 +157,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
assert_not @domain.registrant_verification_asked?
|
||||
assert_not @domain.pending_delete_confirmation?
|
||||
assert_no_emails
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', response_xml.at_css('result')[:code]
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_legal_document_is_required
|
||||
|
@ -182,10 +178,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2003', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Required parameter missing: extension > extdata > legalDocument [legal_document]',
|
||||
response_xml.at_css('result msg').text
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
||||
def test_domain_cannot_be_deleted_when_explicitly_prohibited_by_registrar
|
||||
|
@ -212,9 +205,7 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2304', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Domain status prohibits operation', response_xml.at_css('result msg').text
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
|
||||
def test_domain_not_found
|
||||
|
@ -240,8 +231,6 @@ class EppDomainDeleteBaseTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2303', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Domain not found', response_xml.at_css('result msg').text
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainRenewTest < ApplicationIntegrationTest
|
||||
class EppDomainRenewTest < EppTestCase
|
||||
self.use_transactional_fixtures = false
|
||||
|
||||
setup do
|
||||
|
@ -26,7 +26,6 @@ class EppDomainRenewTest < ApplicationIntegrationTest
|
|||
assert_no_changes -> { domains(:invalid).valid_to } do
|
||||
post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
end
|
||||
assert_equal '2304', Nokogiri::XML(response.body).at_css('result')[:code],
|
||||
Nokogiri::XML(response.body).css('result').text
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainUpdateTest < ApplicationIntegrationTest
|
||||
class EppDomainUpdateTest < EppTestCase
|
||||
def setup
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
@ -27,8 +27,7 @@ class EppDomainUpdateTest < ApplicationIntegrationTest
|
|||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
@domain.reload
|
||||
assert_equal 'f0ff7d17b0', @domain.transfer_code
|
||||
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_discarded_domain_cannot_be_updated
|
||||
|
@ -48,6 +47,6 @@ class EppDomainUpdateTest < ApplicationIntegrationTest
|
|||
XML
|
||||
|
||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
assert_equal '2105', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :object_is_not_eligible_for_renewal
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainInfoBaseTest < ApplicationIntegrationTest
|
||||
class EppDomainInfoBaseTest < EppTestCase
|
||||
def test_returns_valid_response
|
||||
assert_equal 'john-001', contacts(:john).code
|
||||
domains(:shop).update_columns(statuses: [DomainStatus::OK],
|
||||
|
@ -24,8 +24,7 @@ class EppDomainInfoBaseTest < ApplicationIntegrationTest
|
|||
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_epp_response :completed_successfully
|
||||
assert_equal 'shop.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
assert_equal 'ok', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s']
|
||||
assert_equal 'john-001', response_xml.at_xpath('//domain:registrant', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
|
@ -125,8 +124,6 @@ class EppDomainInfoBaseTest < ApplicationIntegrationTest
|
|||
|
||||
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '2303', response_xml.at_css('result')[:code]
|
||||
assert_equal 'Domain not found', response_xml.at_css('result msg').text
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainTransferBaseTest < ApplicationIntegrationTest
|
||||
class EppDomainTransferBaseTest < EppTestCase
|
||||
def test_non_existent_domain
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
@ -19,6 +19,7 @@ class EppDomainTransferBaseTest < ApplicationIntegrationTest
|
|||
XML
|
||||
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
assert_equal '2303', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainTransferQueryTest < ApplicationIntegrationTest
|
||||
class EppDomainTransferQueryTest < EppTestCase
|
||||
def test_returns_domain_transfer_details
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert_equal '1000', xml_doc.at_css('result')[:code]
|
||||
assert_equal 1, xml_doc.css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
assert_equal 'serverApproved', xml_doc.xpath('//domain:trStatus', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
assert_equal 'goodnames', xml_doc.xpath('//domain:reID', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
|
@ -30,13 +29,15 @@ class EppDomainTransferQueryTest < ApplicationIntegrationTest
|
|||
XML
|
||||
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_equal '2201', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
|
||||
# https://github.com/internetee/registry/issues/686
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
||||
def test_no_domain_transfer
|
||||
domains(:shop).transfers.delete_all
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_equal '2303', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
||||
class EppDomainTransferRequestTest < EppTestCase
|
||||
def setup
|
||||
@domain = domains(:shop)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
|
@ -14,8 +14,7 @@ class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
|||
|
||||
def test_transfers_domain_at_once
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_creates_new_domain_transfer
|
||||
|
@ -77,7 +76,7 @@ class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
|||
domains(:shop).reload
|
||||
|
||||
assert_equal registrars(:bestnames), domains(:shop).registrar
|
||||
assert_equal '2304', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
|
||||
def test_discarded_domain_cannot_be_transferred
|
||||
|
@ -87,15 +86,14 @@ class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
|||
@domain.reload
|
||||
|
||||
assert_equal registrars(:bestnames), @domain.registrar
|
||||
assert_equal '2105', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :object_is_not_eligible_for_renewal
|
||||
end
|
||||
|
||||
def test_same_registrar
|
||||
assert_no_difference -> { @domain.transfers.size } do
|
||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
assert_equal '2002', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_epp_response :use_error
|
||||
end
|
||||
|
||||
def test_wrong_transfer_code
|
||||
|
@ -118,7 +116,9 @@ class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
|||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
@domain.reload
|
||||
refute_equal @new_registrar, @domain.registrar
|
||||
assert_equal '2201', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
|
||||
# https://github.com/internetee/registry/issues/686
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppLoginCredentialsTest < ApplicationIntegrationTest
|
||||
class EppLoginCredentialsTest < EppTestCase
|
||||
def test_correct_credentials
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
@ -27,8 +27,7 @@ class EppLoginCredentialsTest < ApplicationIntegrationTest
|
|||
post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
assert EppSession.find_by(session_id: 'new_session_id')
|
||||
assert_equal users(:api_bestnames), EppSession.find_by(session_id: 'new_session_id').user
|
||||
assert Nokogiri::XML(response.body).at_css('result[code="1000"]')
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_already_logged_in
|
||||
|
@ -58,7 +57,8 @@ class EppLoginCredentialsTest < ApplicationIntegrationTest
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=any_random_string' }
|
||||
assert Nokogiri::XML(response.body).at_css('result[code="2501"]')
|
||||
post '/epp/session/login', { frame: request_xml }, 'HTTP_COOKIE' => 'session=any_random_string'
|
||||
|
||||
assert_epp_response :authentication_error_server_closing_connection
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppLoginPasswordChangeTest < ActionDispatch::IntegrationTest
|
||||
class EppLoginPasswordChangeTest < EppTestCase
|
||||
def test_password_change
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
@ -27,7 +27,6 @@ class EppLoginPasswordChangeTest < ActionDispatch::IntegrationTest
|
|||
|
||||
post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
assert_equal 'new-password', users(:api_bestnames).plain_text_password
|
||||
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppLoginSessionLimitTest < ApplicationIntegrationTest
|
||||
class EppLoginSessionLimitTest < EppTestCase
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
EppSession.delete_all
|
||||
|
@ -16,9 +16,7 @@ class EppLoginSessionLimitTest < ApplicationIntegrationTest
|
|||
assert_difference 'EppSession.count' do
|
||||
post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
end
|
||||
|
||||
assert Nokogiri::XML(response.body).at_css('result[code="1000"]')
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_reached
|
||||
|
@ -31,8 +29,7 @@ class EppLoginSessionLimitTest < ApplicationIntegrationTest
|
|||
assert_no_difference 'EppSession.count' do
|
||||
post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
end
|
||||
|
||||
assert Nokogiri::XML(response.body).at_css('result[code="2501"]')
|
||||
assert_epp_response :authentication_error_server_closing_connection
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppLogoutTest < ApplicationIntegrationTest
|
||||
class EppLogoutTest < EppTestCase
|
||||
def test_success_response
|
||||
post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert Nokogiri::XML(response.body).at_css('result[code="1500"]')
|
||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||
assert_epp_response :completed_successfully_ending_session
|
||||
end
|
||||
|
||||
def test_ends_current_session
|
||||
|
@ -19,7 +18,7 @@ class EppLogoutTest < ApplicationIntegrationTest
|
|||
|
||||
def test_anonymous_user
|
||||
post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
assert Nokogiri::XML(response.body).at_css('result[code="2201"]')
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppPollTest < ApplicationIntegrationTest
|
||||
class EppPollTest < EppTestCase
|
||||
setup do
|
||||
@notification = notifications(:complete)
|
||||
end
|
||||
|
@ -18,8 +18,7 @@ class EppPollTest < ApplicationIntegrationTest
|
|||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert_equal 1301.to_s, xml_doc.at_css('result')[:code]
|
||||
assert_equal 1, xml_doc.css('result').size
|
||||
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
|
||||
|
@ -63,9 +62,7 @@ class EppPollTest < ApplicationIntegrationTest
|
|||
XML
|
||||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert_equal 1300.to_s, xml_doc.at_css('result')[:code]
|
||||
assert_equal 1, xml_doc.css('result').size
|
||||
assert_epp_response :completed_successfully_no_messages
|
||||
end
|
||||
|
||||
def test_mark_as_read
|
||||
|
@ -85,8 +82,7 @@ class EppPollTest < ApplicationIntegrationTest
|
|||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert notification.read?
|
||||
assert_equal 1000.to_s, xml_doc.at_css('result')[:code]
|
||||
assert_equal 1, xml_doc.css('result').size
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal 1.to_s, xml_doc.at_css('msgQ')[:count]
|
||||
assert_equal notification.id.to_s, xml_doc.at_css('msgQ')[:id]
|
||||
end
|
||||
|
@ -105,9 +101,8 @@ class EppPollTest < ApplicationIntegrationTest
|
|||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
notification.reload
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert notification.unread?
|
||||
assert_equal 2303.to_s, xml_doc.at_css('result')[:code]
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
||||
def test_notification_not_found
|
||||
|
@ -121,7 +116,6 @@ class EppPollTest < ApplicationIntegrationTest
|
|||
XML
|
||||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert_equal 2303.to_s, xml_doc.at_css('result')[:code]
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue