Merge pull request #2019 from internetee/1930-automate-checking-responses

Automate checking epp responses against  schema
This commit is contained in:
Timo Võhmar 2021-06-17 15:07:29 +03:00 committed by GitHub
commit 6e85fdad1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 314 additions and 38 deletions

View file

@ -0,0 +1,24 @@
module Roids
extend ActiveSupport::Concern
ID_CHAR_LIMIT = 8
included do
def roid
id_size = id.to_s.size
if id_size <= ID_CHAR_LIMIT
"EIS-#{id}"
else
roid_with_prefix(id_size)
end
end
private
def roid_with_prefix(id_size)
id_delta = id_size - ID_CHAR_LIMIT
id_prefix = id.to_s.split(//).first(id_delta).join('').to_s
id_postfix = id.to_s.split(//).last(id_size - id_delta).join('').to_s
"EIS#{id_prefix}-#{id_postfix}"
end
end
end

View file

@ -21,7 +21,7 @@ module UserEvents
Registrar.find(cr_registrar_id).code
else
# cr_id optional for domain, but required for contact; but we want something here anyway
self.creator_str # Fallback if we failed, maybe we can find a string here
self.creator_str || self.registrar.code # Fallback
end
end
end

View file

@ -2,6 +2,7 @@ require 'deserializers/xml/legal_document'
class Contact < ApplicationRecord
include Versions # version/contact_version.rb
include Roids
include EppErrors
include UserEvents
include Contact::Transferable
@ -259,10 +260,6 @@ class Contact < ApplicationRecord
end
end
def roid
"EIS-#{id}"
end
# kind of decorator in order to always return statuses
# if we use separate decorator, then we should add it
# to too many places

View file

@ -1,5 +1,6 @@
class Domain < ApplicationRecord
include UserEvents
include Roids
include Versions # version/domain_version.rb
include Domain::Expirable
include Domain::Activatable
@ -33,8 +34,6 @@ class Domain < ApplicationRecord
has_many :tech_domain_contacts
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true, reject_if: :tech_change_prohibited?
ID_CHAR_LIMIT = 8
def registrant_change_prohibited?
statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED
end
@ -332,15 +331,6 @@ class Domain < ApplicationRecord
domain
end
def roid
id_size = id.to_s.size
if id_size <= ID_CHAR_LIMIT
"EIS-#{id}"
else
roid_with_prefix(id_size)
end
end
def puny_label
name_puny.to_s.split('.').first
end
@ -741,13 +731,4 @@ class Domain < ApplicationRecord
def self.uses_zone?(zone)
exists?(["name ILIKE ?", "%.#{zone.origin}"])
end
private
def roid_with_prefix(id_size)
id_delta = id_size - ID_CHAR_LIMIT
id_prefix = id.to_s.split(//).first(id_delta).join('').to_s
id_postfix = id.to_s.split(//).last(id_size - id_delta).join('').to_s
"EIS#{id_prefix}-#{id_postfix}"
end
end

View file

@ -41,7 +41,7 @@ xml.epp_head do
xml.tag!('domain:clID', @domain.registrar.code)
xml.tag!('domain:crID', @domain.cr_id)
xml.tag!('domain:crID', @domain.cr_id) if @domain.cr_id.present?
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
if @domain.updated_at > @domain.created_at

View file

@ -25,6 +25,7 @@ class EppContactCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text
end
@ -47,6 +48,7 @@ class EppContactCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '1', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail']
assert_nil response_xml.at_xpath('//contact:reason', contact: xml_schema)
end
@ -72,6 +74,7 @@ class EppContactCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '0', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail']
assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text
end
@ -96,6 +99,7 @@ class EppContactCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size
end
@ -120,6 +124,7 @@ class EppContactCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text
assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text
@ -146,6 +151,7 @@ class EppContactCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text
assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text

View file

@ -33,6 +33,8 @@ class EppContactCreateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
contact = Contact.find_by(name: name)
assert_equal name, contact.name
@ -74,6 +76,8 @@ class EppContactCreateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_syntax_error
end
@ -109,6 +113,8 @@ class EppContactCreateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_syntax_error
end
@ -143,6 +149,8 @@ class EppContactCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
contact = Contact.find_by(name: name)
assert_equal "#{session.user.registrar.code}:#{code}".upcase, contact.code
end
@ -174,6 +182,8 @@ class EppContactCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
end
@ -216,6 +226,8 @@ class EppContactCreateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_without_address
contact = Contact.find_by(name: name)
assert_equal name, contact.name
@ -275,6 +287,8 @@ class EppContactCreateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
contact = Contact.find_by(name: name)
assert_equal name, contact.name

View file

@ -24,6 +24,9 @@ class EppContactDeleteBaseTest < EppTestCase
post epp_delete_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
end
@ -50,6 +53,8 @@ class EppContactDeleteBaseTest < EppTestCase
post epp_delete_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert Contact.exists?(id: contact.id)
assert_epp_response :object_status_prohibits_operation
end
@ -77,6 +82,8 @@ class EppContactDeleteBaseTest < EppTestCase
post epp_delete_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert Contact.exists?(id: contact.id)
assert_epp_response :object_status_prohibits_operation
end
@ -105,6 +112,8 @@ class EppContactDeleteBaseTest < EppTestCase
post epp_delete_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_association_prohibits_operation
end

View file

@ -33,6 +33,7 @@ class EppContactInfoBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
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']
@ -65,6 +66,7 @@ class EppContactInfoBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text
assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text
@ -91,6 +93,7 @@ class EppContactInfoBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text
assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text
@ -121,6 +124,7 @@ class EppContactInfoBaseTest < EppTestCase
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_nil response_xml.at_xpath('//contact:authInfo', contact: xml_schema)
assert_equal 'No access', response_xml.at_xpath('//contact:name', contact: xml_schema).text
end

View file

@ -19,6 +19,8 @@ class EppContactTransferBaseTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :unimplemented
end
end

View file

@ -41,6 +41,8 @@ class EppContactUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@contact.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal 'new name', @contact.name
assert_equal 'new-email@inbox.test', @contact.email
@ -73,6 +75,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_emails 1
end
@ -101,7 +105,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_no_emails
end
@ -133,7 +138,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_no_emails
end
@ -160,7 +166,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_does_not_exist
end
@ -196,6 +203,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :data_management_policy_violation
end
@ -228,7 +237,8 @@ class EppContactUpdateBaseTest < EppTestCase
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
end
@ -269,6 +279,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
@contact.reload
@ -315,6 +327,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_without_address
@contact.reload
@ -362,6 +376,8 @@ class EppContactUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@contact.reload
assert_not_equal city, @contact.city
@ -417,6 +433,8 @@ class EppContactUpdateBaseTest < EppTestCase
@contact.reload
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal 'new name', @contact.name
assert_equal 'new-email@inbox.test', @contact.email

View file

@ -17,7 +17,9 @@ class EppDomainBaseTest < EppTestCase
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :object_does_not_exist
assert_correct_against_schema response_xml
end
def test_invalid_path

View file

@ -32,6 +32,7 @@ class EppDomainCheckAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
@ -57,6 +58,7 @@ class EppDomainCheckAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
@ -82,6 +84,7 @@ class EppDomainCheckAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
@ -107,6 +110,7 @@ class EppDomainCheckAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Awaiting payment', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
@ -132,6 +136,7 @@ class EppDomainCheckAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")

View file

@ -20,6 +20,7 @@ class EppDomainCheckBaseTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_correct_against_schema response_xml
assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -41,6 +42,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")
end
@ -65,6 +67,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")
end
@ -87,6 +90,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'invalid format', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -111,6 +115,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'in use', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -135,6 +140,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -159,6 +165,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}")['avail']
assert_equal 'Zone with the same origin exists', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -183,6 +190,7 @@ class EppDomainCheckBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").size
end
end

View file

@ -43,6 +43,9 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
refute Domain.where(name: @idn_auction.domain).exists?
@idn_auction.reload
@ -78,6 +81,9 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
refute Domain.where(name: @idn_auction.domain).exists?
@idn_auction.reload
@ -112,6 +118,9 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
refute Domain.where(name: @idn_auction.domain).exists?
@idn_auction.reload
@ -146,6 +155,9 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
refute Domain.where(name: @idn_auction.domain).exists?
@idn_auction.reload
@ -184,6 +196,9 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@idn_auction.reload
assert @idn_auction.domain_registered?
assert Domain.where(name: @idn_auction.domain).exists?
@ -221,6 +236,9 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@idn_auction.reload
assert @idn_auction.domain_registered?
assert Domain.where(name: @idn_auction.domain).exists?

View file

@ -35,6 +35,8 @@ class EppDomainCreateAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_registers_domain_with_correct_registration_code_after_another_auction_when_payment_is_received
@ -73,6 +75,8 @@ class EppDomainCreateAuctionTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_registers_domain_with_correct_registration_code_when_payment_is_received
@ -109,6 +113,8 @@ class EppDomainCreateAuctionTest < EppTestCase
@auction.reload
assert @auction.domain_registered?
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_domain_cannot_be_registered_without_registration_code
@ -138,6 +144,8 @@ class EppDomainCreateAuctionTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
end
@ -171,6 +179,8 @@ class EppDomainCreateAuctionTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :invalid_authorization_information
end
@ -203,6 +213,8 @@ class EppDomainCreateAuctionTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
end
@ -231,6 +243,8 @@ class EppDomainCreateAuctionTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
end

View file

@ -42,6 +42,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_syntax_error
end
@ -73,6 +75,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :data_management_policy_violation
end
@ -107,6 +111,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :data_management_policy_violation
error_description = 'Legaldoc size exceeds maximum allowed size of 8mB'
@ -143,6 +149,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
end
@ -174,6 +182,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
end
@ -210,6 +220,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
end
@ -248,6 +260,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
@ -285,6 +299,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
@ -322,6 +338,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
@ -360,6 +378,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
@ -398,6 +418,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
@ -432,6 +454,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
@ -475,6 +499,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
@ -511,6 +537,9 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
Setting.legal_document_is_mandatory = false
@ -553,6 +582,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
reserved_domain.reload
@ -588,6 +619,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal transfer_code, Domain.find_by(name: name).transfer_code
end
@ -619,6 +652,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :data_management_policy_violation
end
@ -649,6 +684,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :data_management_policy_violation
end
@ -679,6 +716,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :invalid_authorization_information
end
@ -708,6 +747,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
end
@ -737,6 +778,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :billing_failure
end
@ -766,6 +809,8 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :billing_failure
end
end

View file

@ -35,6 +35,8 @@ class EppDomainDeleteBaseTest < EppTestCase
XML
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_includes Domain.find_by(name: 'invalid.test').statuses, DomainStatus::PENDING_DELETE_CONFIRMATION
assert_epp_response :completed_successfully_action_pending
end
@ -64,6 +66,8 @@ class EppDomainDeleteBaseTest < EppTestCase
assert_no_difference 'Domain.count' do
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_status_prohibits_operation
end
@ -92,6 +96,8 @@ class EppDomainDeleteBaseTest < EppTestCase
perform_enqueued_jobs do
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
@ -126,6 +132,9 @@ class EppDomainDeleteBaseTest < EppTestCase
perform_enqueued_jobs do
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_not @domain.registrant_verification_asked?
@ -160,6 +169,9 @@ class EppDomainDeleteBaseTest < EppTestCase
perform_enqueued_jobs do
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_not @domain.registrant_verification_asked?
@ -193,6 +205,8 @@ class EppDomainDeleteBaseTest < EppTestCase
perform_enqueued_jobs do
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_not @domain.registrant_verification_asked?
@ -219,6 +233,8 @@ class EppDomainDeleteBaseTest < EppTestCase
XML
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
end
@ -246,6 +262,8 @@ class EppDomainDeleteBaseTest < EppTestCase
XML
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_status_prohibits_operation
end

View file

@ -116,10 +116,7 @@ class EppDomainInfoBaseTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
schema = EPP_ALL_SCHEMA
schema_validation_errors = schema.validate(response_xml)
assert_equal 0, schema_validation_errors.size
assert_correct_against_schema response_xml
end
def test_returns_valid_response_if_release_prohibited
@ -147,10 +144,7 @@ class EppDomainInfoBaseTest < EppTestCase
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
schema = EPP_ALL_SCHEMA
schema_validation_errors = schema.validate(response_xml)
assert_equal 0, schema_validation_errors.size
assert_correct_against_schema response_xml
end
def test_reveals_transfer_code_when_domain_is_owned_by_current_user
@ -176,6 +170,7 @@ class EppDomainInfoBaseTest < EppTestCase
assert_equal '65078d5',
response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
assert_correct_against_schema response_xml
end
# Transfer code is the only info we conceal from other registrars, hence a bit oddly-looking
@ -206,6 +201,7 @@ class EppDomainInfoBaseTest < EppTestCase
assert_equal '65078d5',
response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s).text
assert_correct_against_schema response_xml
end
def test_conceals_transfer_code_when_domain_is_not_owned_by_current_user
@ -229,6 +225,7 @@ class EppDomainInfoBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => Xsd::Schema.filename(for_prefix: 'domain-ee').to_s)
end

View file

@ -26,6 +26,9 @@ class EppDomainRenewBaseTest < EppTestCase
post epp_renew_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
domain.reload
assert_epp_response :completed_successfully
@ -57,6 +60,9 @@ class EppDomainRenewBaseTest < EppTestCase
post epp_renew_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
domain.reload
assert_epp_response :completed_successfully
@ -87,6 +93,9 @@ class EppDomainRenewBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
domain.reload
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_status_prohibits_operation
end
@ -115,6 +124,9 @@ class EppDomainRenewBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
domain.reload
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :authorization_error
end
@ -143,6 +155,9 @@ class EppDomainRenewBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
domain.reload
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :billing_failure
end
@ -170,6 +185,9 @@ class EppDomainRenewBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
domain.reload
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :billing_failure
end
@ -197,6 +215,9 @@ class EppDomainRenewBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
domain.reload
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
@ -226,6 +247,10 @@ class EppDomainRenewBaseTest < EppTestCase
post epp_renew_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
domain.reload
assert_epp_response :object_status_prohibits_operation

View file

@ -5,6 +5,9 @@ class EppDomainTransferQueryTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
xml_doc = Nokogiri::XML(response.body)
assert_correct_against_schema xml_doc
assert_epp_response :completed_successfully
assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
assert_equal 'serverApproved', xml_doc.xpath('//domain:trStatus', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
@ -32,6 +35,8 @@ class EppDomainTransferQueryTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :invalid_authorization_information
end
@ -39,6 +44,8 @@ class EppDomainTransferQueryTest < EppTestCase
domains(:shop).transfers.delete_all
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_does_not_exist
end

View file

@ -22,6 +22,8 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
@domain.reload
@ -43,6 +45,8 @@ class EppDomainTransferRequestTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
@ -63,6 +67,8 @@ class EppDomainTransferRequestTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
@ -87,6 +93,8 @@ class EppDomainTransferRequestTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
@ -106,6 +114,8 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_creates_new_domain_transfer
@ -113,11 +123,15 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_approves_automatically_if_auto_approval_is_enabled
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' =>
"#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -125,6 +139,8 @@ class EppDomainTransferRequestTest < EppTestCase
def test_assigns_new_registrar
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_equal @new_registrar, @domain.registrar
end
@ -135,6 +151,8 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
refute_equal @domain.transfer_code, @old_transfer_code
end
@ -146,6 +164,8 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_duplicates_registrant_admin_and_tech_contacts
@ -153,11 +173,15 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_reuses_identical_contact
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal 1, @new_registrar.contacts.where(name: 'William').size
end
@ -166,6 +190,8 @@ class EppDomainTransferRequestTest < EppTestCase
post epp_transfer_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_non_transferable_domain
@ -177,6 +203,8 @@ class EppDomainTransferRequestTest < EppTestCase
assert_equal registrars(:bestnames), domains(:shop).registrar
assert_epp_response :object_status_prohibits_operation
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_discarded_domain_cannot_be_transferred
@ -188,6 +216,8 @@ class EppDomainTransferRequestTest < EppTestCase
assert_equal registrars(:bestnames), @domain.registrar
assert_epp_response :object_is_not_eligible_for_transfer
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_same_registrar
@ -196,6 +226,8 @@ class EppDomainTransferRequestTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :use_error
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
end
def test_wrong_transfer_code
@ -220,6 +252,8 @@ class EppDomainTransferRequestTest < EppTestCase
@domain.reload
assert_epp_response :invalid_authorization_information
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
refute_equal @new_registrar, @domain.registrar
end

View file

@ -38,6 +38,8 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_equal 'f0ff7d17b0', @domain.transfer_code
assert_epp_response :completed_successfully
@ -82,6 +84,8 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :object_status_prohibits_operation
end
@ -106,6 +110,7 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_epp_response :object_status_prohibits_operation
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal DomainStatus::PENDING_UPDATE, response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-ee')}").text
end
@ -142,6 +147,8 @@ class EppDomainUpdateBaseTest < EppTestCase
end
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully_action_pending
assert_not_equal new_registrant, @domain.registrant
assert @domain.registrant_verification_asked?
@ -183,6 +190,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
assert_epp_response :completed_successfully
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_equal @domain.registrant, new_registrant
assert_not @domain.statuses.include? "pendingUpdate"
@ -221,6 +230,8 @@ class EppDomainUpdateBaseTest < EppTestCase
end
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully_action_pending
assert_not_equal new_registrant, @domain.registrant
assert @domain.registrant_verification_asked?
@ -259,6 +270,8 @@ class EppDomainUpdateBaseTest < EppTestCase
end
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully_action_pending
assert_not_equal new_registrant, @domain.registrant
assert @domain.registrant_verification_asked?
@ -290,6 +303,8 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :required_parameter_missing
Setting.legal_document_is_mandatory = old_value
end
@ -332,6 +347,8 @@ class EppDomainUpdateBaseTest < EppTestCase
@domain.reload
# NOTE: completed_successfully_action_pending
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
@ -365,6 +382,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_not @domain.registrant_verification_asked?
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
@ -407,6 +426,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert new_registrant, @domain.registrant
assert_not @domain.registrant_verification_asked?
@ -450,6 +471,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :invalid_authorization_information
assert_not_equal new_registrant, @domain.registrant
assert @domain.disputed?
@ -486,6 +509,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal new_registrant, @domain.registrant
assert_not @domain.registrant_verification_asked?
@ -523,6 +548,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal new_registrant, @domain.registrant
assert_not @domain.registrant_verification_asked?
@ -562,6 +589,8 @@ class EppDomainUpdateBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
assert_equal new_registrant, @domain.registrant
assert_not @domain.registrant_verification_asked?
@ -599,6 +628,9 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_epp_response :completed_successfully
@ -624,6 +656,9 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_epp_response :completed_successfully
assert_includes(@domain.statuses, DomainStatus::CLIENT_HOLD)
@ -652,6 +687,9 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_epp_response :completed_successfully
assert_not_includes(@domain.statuses, DomainStatus::CLIENT_HOLD)
@ -677,6 +715,9 @@ class EppDomainUpdateBaseTest < EppTestCase
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
@domain.reload
assert_epp_response :object_does_not_exist
end

View file

@ -75,6 +75,13 @@ class EppTestCase < ActionDispatch::IntegrationTest
assert schema_version >= version
end
def assert_correct_against_schema(response_xml, message = nil)
schema = EPP_ALL_SCHEMA
schema_validation_errors = schema.validate(response_xml)
assert_equal 0, schema_validation_errors.size, message
end
private
def prefix_schema_tag(prefix, response_xml)