mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +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
|
||||
|
|
|
@ -25,6 +25,7 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase
|
|||
def test_skips_auction_when_domains_is_blocked
|
||||
assert_equal 'shop.test', @domain.name
|
||||
blocked_domains(:one).update!(name: 'shop.test')
|
||||
@domain.save!(validate: false)
|
||||
|
||||
@domain.release
|
||||
|
||||
|
@ -34,6 +35,7 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase
|
|||
def test_skips_auction_when_domains_is_reserved
|
||||
assert_equal 'shop.test', @domain.name
|
||||
reserved_domains(:one).update!(name: 'shop.test')
|
||||
@domain.save!(validate: false)
|
||||
|
||||
@domain.release
|
||||
|
||||
|
@ -58,6 +60,24 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_updates_whois_server
|
||||
@domain.update!(delete_date: '2010-07-04')
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
old_whois = @domain.whois_record
|
||||
|
||||
Domain.release_domains
|
||||
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
old_whois.reload
|
||||
end
|
||||
|
||||
whois_record = Whois::Record.find_by(name: @domain.name)
|
||||
json = { "name"=>@domain.name,
|
||||
"status"=>["AtAuction"],
|
||||
"disclaimer"=> Setting.registry_whois_disclaimer }
|
||||
assert_equal whois_record.json, json
|
||||
end
|
||||
|
||||
def test_notifies_registrar
|
||||
@domain.update!(delete_date: '2010-07-04')
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
|
|
|
@ -20,6 +20,7 @@ class AdminAreaPricesTest < ApplicationSystemTestCase
|
|||
fill_in 'Valid from', with: effective_date
|
||||
click_on 'Create price'
|
||||
|
||||
|
||||
assert_text 'Price has been created'
|
||||
assert_text I18n.localize(effective_date)
|
||||
end
|
||||
|
|
28
test/system/registrar_area/account_activities_test.rb
Normal file
28
test/system/registrar_area/account_activities_test.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class RegistrarAccountActivitiesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@registrar = registrars(:bestnames)
|
||||
sign_in users(:api_bestnames)
|
||||
end
|
||||
|
||||
def test_show_account_activity_page
|
||||
account_activities(:one).update(sum: "123.00")
|
||||
visit registrar_account_activities_path
|
||||
assert_text 'Account activity'
|
||||
end
|
||||
|
||||
def test_download_account_activity
|
||||
now = Time.zone.parse('2010-07-05 08:00')
|
||||
travel_to now
|
||||
account_activities(:one).update(sum: "123.00")
|
||||
|
||||
get registrar_account_activities_path(format: :csv)
|
||||
|
||||
assert_response :ok
|
||||
assert_equal "text/csv", response.headers['Content-Type']
|
||||
assert_equal %(attachment; filename="account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv"; filename*=UTF-8''account_activities_#{Time.zone.now.to_formatted_s(:number)}.csv),
|
||||
response.headers['Content-Disposition']
|
||||
assert_not_empty response.body
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue