mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
added test when ipv4 and ipv6 isnt in array for bulk nameservers changed
This commit is contained in:
parent
52d575229c
commit
4ed4e36fa1
2 changed files with 126 additions and 0 deletions
80
test/integration/admin_area/domain_update_confirms_test.rb
Normal file
80
test/integration/admin_area/domain_update_confirms_test.rb
Normal file
|
@ -0,0 +1,80 @@
|
|||
require 'test_helper'
|
||||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_t
|
||||
new_registrant = contacts(:william)
|
||||
assert_not_equal new_registrant, @domain.registrant
|
||||
|
||||
puts new_registrant.name
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>#{@domain.name}</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant>#{new_registrant.code}</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
puts @domain.registrant
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_registrant_of_domain
|
||||
new_registrant = contacts(:william)
|
||||
assert_not_equal new_registrant, @domain.registrant
|
||||
|
||||
@domain.registrant
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>#{@domain.name}</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant>#{new_registrant.code}</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
# puts response.body
|
||||
puts @domain.registrant
|
||||
end
|
||||
|
||||
end
|
|
@ -74,4 +74,50 @@ class ReppV1RegistrarNameserversTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 2005, json[:code]
|
||||
assert_equal 'IPv6 is invalid [ipv6]', json[:message]
|
||||
end
|
||||
|
||||
def test_ipv4_isnt_array
|
||||
nameserver = nameservers(:shop_ns1)
|
||||
payload = {
|
||||
"data": {
|
||||
"id": nameserver.hostname,
|
||||
"type": "nameserver",
|
||||
"domains": ["shop.test", "airport.test", "library.test", "metro.test"],
|
||||
"attributes": {
|
||||
"hostname": nameserver.hostname,
|
||||
"ipv4": "1.1.1.1",
|
||||
"ipv6": ["2620:119:352::36"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
put '/repp/v1/registrar/nameservers', headers: @auth_headers, params: payload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal 2005, json[:code]
|
||||
assert_equal 'IPv4 should be array [ipv4]', json[:message]
|
||||
end
|
||||
|
||||
def test_ipv6_isnt_array
|
||||
nameserver = nameservers(:shop_ns1)
|
||||
payload = {
|
||||
"data": {
|
||||
"id": nameserver.hostname,
|
||||
"type": "nameserver",
|
||||
"domains": ["shop.test", "airport.test", "library.test", "metro.test"],
|
||||
"attributes": {
|
||||
"hostname": nameserver.hostname,
|
||||
"ipv4": ["1.1.1.1"],
|
||||
"ipv6": "2620:119:352::36"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
put '/repp/v1/registrar/nameservers', headers: @auth_headers, params: payload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal 2005, json[:code]
|
||||
assert_equal 'IPv6 should be array [ipv6]', json[:message]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue