mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Merge remote-tracking branch 'origin/master' into repp-domains
This commit is contained in:
commit
43e5b74668
29 changed files with 357 additions and 49 deletions
|
@ -57,6 +57,15 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
|
|||
assert_equal({ errors: [base: ['Not authorized']] }, json_body)
|
||||
end
|
||||
|
||||
def test_gets_contact_domain_links_when_requested
|
||||
get "/api/v1/registrant/contacts/#{@contact.uuid}?links=true", headers: @auth_headers
|
||||
|
||||
expected_links = @contact.domains.uniq.map { |d| { name: d.name, id: d.uuid }}
|
||||
assert_response :ok
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_empty expected_links - response_json[:links]
|
||||
end
|
||||
private
|
||||
|
||||
def auth_token
|
||||
|
|
|
@ -2,6 +2,51 @@ require 'test_helper'
|
|||
|
||||
class EppDomainCreateBaseTest < EppTestCase
|
||||
|
||||
def test_illegal_chars_in_dns_key
|
||||
name = "new.#{dns_zones(:one).origin}"
|
||||
contact = contacts(:john)
|
||||
registrant = contact.becomes(Registrant)
|
||||
|
||||
pub_key = "AwEAAddt2AkLf\n
|
||||
\n
|
||||
YGKgiEZB5SmIF8E\n
|
||||
vrjxNMH6HtxW\rEA4RJ9Ao6LCWheg8"
|
||||
|
||||
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>
|
||||
<create>
|
||||
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>#{name}</domain:name>
|
||||
<domain:registrant>#{registrant.code}</domain:registrant>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
||||
<secDNS:keyData>
|
||||
<secDNS:flags>257</secDNS:flags>
|
||||
<secDNS:protocol>3</secDNS:protocol>
|
||||
<secDNS:alg>8</secDNS:alg>
|
||||
<secDNS:pubKey>#{pub_key}</secDNS:pubKey>
|
||||
</secDNS:keyData>
|
||||
</secDNS:create>
|
||||
<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
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
assert_epp_response :parameter_value_syntax_error
|
||||
end
|
||||
|
||||
|
||||
def test_not_registers_domain_without_legaldoc
|
||||
now = Time.zone.parse('2010-07-05')
|
||||
travel_to now
|
||||
|
|
|
@ -3,6 +3,7 @@ require 'test_helper'
|
|||
class EppDomainTransferRequestTest < EppTestCase
|
||||
def setup
|
||||
@domain = domains(:shop)
|
||||
@contact = contacts(:jane)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
@original_transfer_wait_time = Setting.transfer_wait_time
|
||||
Setting.transfer_wait_time = 0
|
||||
|
@ -12,6 +13,95 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
Setting.transfer_wait_time = @original_transfer_wait_time
|
||||
end
|
||||
|
||||
def test_transfer_domain_with_contacts_if_registrant_and_tech_are_shared
|
||||
@domain.tech_domain_contacts[0].update!(contact_id: @domain.registrant.id)
|
||||
|
||||
@domain.tech_domain_contacts[1].delete
|
||||
@domain.reload
|
||||
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
@domain.reload
|
||||
|
||||
tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id)
|
||||
|
||||
assert_equal @domain.contacts.where(original_id: @domain.registrant.original_id).count, 1
|
||||
assert_equal tech.registrar_id, @domain.registrar.id
|
||||
end
|
||||
|
||||
def test_transfer_domain_with_contacts_if_registrant_and_admin_are_shared
|
||||
@domain.admin_domain_contacts[0].update!(contact_id: @domain.registrant.id)
|
||||
@domain.tech_domain_contacts[0].update!(contact_id: @contact.id)
|
||||
|
||||
@domain.tech_domain_contacts[1].delete
|
||||
@domain.reload
|
||||
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
@domain.reload
|
||||
|
||||
admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id)
|
||||
|
||||
assert_equal @domain.contacts.where(original_id: @domain.registrant.original_id).count, 1
|
||||
assert_equal admin.registrar_id, @domain.registrar.id
|
||||
end
|
||||
|
||||
def test_transfer_domain_with_contacts_if_admin_and_tech_are_shared
|
||||
@domain.admin_domain_contacts[0].update!(contact_id: @contact.id)
|
||||
@domain.tech_domain_contacts[0].update!(contact_id: @contact.id)
|
||||
|
||||
@domain.tech_domain_contacts[1].delete
|
||||
@domain.reload
|
||||
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
@domain.reload
|
||||
|
||||
admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id)
|
||||
tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id)
|
||||
|
||||
result_hash = @domain.contacts.pluck(:original_id).group_by(&:itself).transform_values(&:count)
|
||||
assert result_hash[admin.original_id], 2
|
||||
|
||||
assert_equal admin.registrar_id, @domain.registrar.id
|
||||
assert_equal tech.registrar_id, @domain.registrar.id
|
||||
end
|
||||
|
||||
def test_transfer_domain_with_contacts_if_admin_and_tech_and_registrant_are_shared
|
||||
@domain.tech_domain_contacts[0].update!(contact_id: @domain.registrant.id)
|
||||
@domain.admin_domain_contacts[0].update!(contact_id: @domain.registrant.id)
|
||||
|
||||
@domain.tech_domain_contacts[1].delete
|
||||
@domain.reload
|
||||
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
@domain.reload
|
||||
|
||||
admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id)
|
||||
tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id)
|
||||
|
||||
assert_equal @domain.contacts.where(original_id: @domain.registrant.original_id).count, 2
|
||||
|
||||
result_hash = @domain.contacts.pluck(:original_id).group_by(&:itself).transform_values(&:count)
|
||||
assert result_hash[@domain.registrant.original_id], 2
|
||||
|
||||
assert_equal admin.registrar_id, @domain.registrar.id
|
||||
assert_equal tech.registrar_id, @domain.registrar.id
|
||||
end
|
||||
|
||||
def test_transfers_domain_at_once
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
|
|
@ -38,4 +38,17 @@ class ReppV1DomainsTransferInfoTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'Authorization error', json[:message]
|
||||
assert_empty json[:data]
|
||||
end
|
||||
|
||||
def test_processes_puny_domains
|
||||
@domain.update(name_puny: 'xn--prototp-s2aa.ee')
|
||||
|
||||
headers = @auth_headers
|
||||
headers['Auth-Code'] = @domain.transfer_code
|
||||
|
||||
get "/repp/v1/domains/xn--prototp-s2aa.ee/transfer_info", headers: headers
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue