mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue