mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Add tests & fixes for epp contact
This commit is contained in:
parent
860c3c8008
commit
7163695ad1
10 changed files with 84 additions and 29 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue