Merge remote-tracking branch 'origin/master' into 1580-registrar-api-contacts-endpoint

This commit is contained in:
Karl Erik Õunapuu 2020-11-17 09:55:32 +02:00
commit db50a89d85
No known key found for this signature in database
GPG key ID: C9DD647298A34764
51 changed files with 801 additions and 285 deletions

View file

@ -448,10 +448,9 @@ dispute_period_in_months:
registry_whois_disclaimer:
code: registry_whois_disclaimer
value: 'Search results may not be used for commercial, advertising, recompilation,
repackaging, redistribution, reuse, obscuring or other similar activities.'
value: "{\"en\":\"111\",\"et\":\"222\",\"ru\":\"333\"}"
group: contacts
format: string
format: hash
created_at: <%= Time.zone.parse('2010-07-05') %>
updated_at: <%= Time.zone.parse('2010-07-05') %>

View file

@ -1,64 +0,0 @@
require 'test_helper'
class EppLoginCredentialsTest < EppTestCase
def test_correct_credentials
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>
<login>
<clID>test_bestnames</clID>
<pw>testtest</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
post epp_login_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
assert EppSession.find_by(session_id: 'new_session_id')
assert_equal users(:api_bestnames), EppSession.find_by(session_id: 'new_session_id').user
assert_epp_response :completed_successfully
end
def test_already_logged_in
assert true # Handled by EPP proxy
end
def test_wrong_credentials
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>
<login>
<clID>non-existent</clID>
<pw>valid-but-wrong</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
post epp_login_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=any_random_string' }
assert_epp_response :authentication_error_server_closing_connection
end
end

View file

@ -1,32 +0,0 @@
require 'test_helper'
class EppLoginPasswordChangeTest < EppTestCase
def test_password_change
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>
<login>
<clID>test_bestnames</clID>
<pw>testtest</pw>
<newPW>new-password</newPW>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
post epp_login_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
assert_equal 'new-password', users(:api_bestnames).plain_text_password
assert_epp_response :completed_successfully
end
end

View file

@ -1,61 +0,0 @@
require 'test_helper'
class EppLoginSessionLimitTest < EppTestCase
setup do
travel_to Time.zone.parse('2010-07-05')
EppSession.delete_all
end
def test_not_reached
(EppSession.limit_per_registrar - 1).times do
EppSession.create!(session_id: SecureRandom.hex,
user: users(:api_bestnames),
updated_at: Time.zone.parse('2010-07-05'))
end
assert_difference 'EppSession.count' do
post epp_login_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
end
assert_epp_response :completed_successfully
end
def test_reached
EppSession.limit_per_registrar.times do
EppSession.create!(session_id: SecureRandom.hex,
user: users(:api_bestnames),
updated_at: Time.zone.parse('2010-07-05'))
end
assert_no_difference 'EppSession.count' do
post epp_login_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
end
assert_epp_response :authentication_error_server_closing_connection
end
private
def 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>
<login>
<clID>test_bestnames</clID>
<pw>testtest</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
end
end

View file

@ -0,0 +1,189 @@
require 'test_helper'
class EppLoginTest < EppTestCase
setup do
@original_sessions_per_registrar_setting = EppSession.sessions_per_registrar
end
teardown do
EppSession.sessions_per_registrar = @original_sessions_per_registrar_setting
end
def test_logging_in_with_correct_credentials_creates_new_session
user = users(:api_bestnames)
new_session_id = 'new-session-id'
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>
<login>
<clID>#{user.username}</clID>
<pw>#{user.plain_text_password}</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
assert_difference 'EppSession.count' do
post '/epp/session/login', params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => "session=#{new_session_id}" }
end
assert_epp_response :completed_successfully
session = EppSession.last
assert_equal new_session_id, session.session_id
assert_equal user, session.user
end
def test_user_cannot_login_again
session = epp_sessions(:api_bestnames)
user = session.user
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>
<login>
<clID>#{user.username}</clID>
<pw>#{user.plain_text_password}</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
assert_no_difference 'EppSession.count' do
post '/epp/session/login', params: { frame: request_xml },
headers: { HTTP_COOKIE: "session=#{session.session_id}" }
end
assert_epp_response :use_error
end
def test_user_cannot_login_with_wrong_credentials
user = users(:api_bestnames)
wrong_password = 'a' * ApiUser.min_password_length
assert_not_equal wrong_password, user.plain_text_password
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>
<login>
<clID>#{user.username}</clID>
<pw>#{wrong_password}</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
assert_no_difference 'EppSession.count' do
post '/epp/session/login', params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new-session-id' }
end
assert_epp_response :authentication_error_server_closing_connection
end
def test_password_change
user = users(:api_bestnames)
new_password = 'a' * ApiUser.min_password_length
assert_not_equal new_password, user.plain_text_password
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>
<login>
<clID>#{user.username}</clID>
<pw>#{user.plain_text_password}</pw>
<newPW>#{new_password}</newPW>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
post '/epp/session/login', params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new-session-id' }
user.reload
assert_epp_response :completed_successfully
assert_equal new_password, user.plain_text_password
end
def test_user_cannot_login_when_max_allowed_sessions_per_registrar_is_exceeded
user = users(:api_bestnames)
eliminate_effect_of_existing_epp_sessions
EppSession.sessions_per_registrar = 1
EppSession.create!(session_id: 'any', user: user)
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>
<login>
<clID>#{user.username}</clID>
<pw>#{user.plain_text_password}</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
<svcs>
<objURI>https://epp.tld.ee/schema/domain-eis-1.0.xsd</objURI>
<objURI>https://epp.tld.ee/schema/contact-ee-1.1.xsd</objURI>
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
<objURI>urn:ietf:params:xml:ns:keyrelay-1.0</objURI>
</svcs>
</login>
</command>
</epp>
XML
assert_no_difference 'EppSession.count' do
post '/epp/session/login', params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=new-session-id' }
end
assert_epp_response :session_limit_exceeded_server_closing_connection
end
private
def eliminate_effect_of_existing_epp_sessions
EppSession.delete_all
end
end

View file

@ -5,10 +5,6 @@ class DomainDeleteMailerTest < ActionMailer::TestCase
@domain = domains(:shop)
end
def test_force_delete_templates
assert_equal %w[private_person legal_person], DomainDeleteMailer.force_delete_templates
end
def test_delivers_confirmation_request_email
assert_equal 'shop.test', @domain.name
assert_equal 'john@inbox.test', @domain.registrant.email
@ -68,8 +64,7 @@ class DomainDeleteMailerTest < ActionMailer::TestCase
email = DomainDeleteMailer.forced(domain: @domain,
registrar: @domain.registrar,
registrant: @domain.registrant,
template_name: DomainDeleteMailer.force_delete_templates
.first).deliver_now
template_name: @domain.notification_template).deliver_now
assert_emails 1
assert_equal ['legal@registry.test'], email.from

View file

@ -8,7 +8,18 @@ class DomainExpireMailerTest < ActionMailer::TestCase
email = DomainExpireMailer.expired(domain: domain, registrar: domain.registrar).deliver_now
assert_emails 1
assert_equal 'Domeen shop.test on aegunud / Domain shop.test has expired' \
' / Срок действия домена shop.test истек', email.subject
assert_equal I18n.t("domain_expire_mailer.expired.subject", domain_name: domain.name),
email.subject
end
end
def test_delivers_domain_expiration_soft_email
domain = domains(:shop)
assert_equal 'shop.test', domain.name
email = DomainExpireMailer.expired_soft(domain: domain, registrar: domain.registrar).deliver_now
assert_emails 1
assert_equal I18n.t("domain_expire_mailer.expired_soft.subject", domain_name: domain.name),
email.subject
end
end

View file

@ -1,10 +1,11 @@
class DomainDeleteMailerPreview < ActionMailer::Preview
def self.define_forced_templates
DomainDeleteMailer.force_delete_templates.each do |template_name|
%w[private_person legal_person invalid_email].each do |template_name|
define_method "forced_#{template_name}".to_sym do
DomainDeleteMailer.forced(domain: @domain,
registrar: @domain.registrar,
registrant: @domain.registrant,
domain = Domain.first
DomainDeleteMailer.forced(domain: domain,
registrar: domain.registrar,
registrant: domain.registrant,
template_name: template_name)
end
end
@ -12,26 +13,25 @@ class DomainDeleteMailerPreview < ActionMailer::Preview
define_forced_templates
def initialize
@domain = Domain.first
super
end
def confirmation_request
DomainDeleteMailer.confirmation_request(domain: @domain,
registrar: @domain.registrar,
registrant: @domain.registrant)
domain = Domain.first
DomainDeleteMailer.confirmation_request(domain: domain,
registrar: domain.registrar,
registrant: domain.registrant)
end
def accepted
DomainDeleteMailer.accepted(@domain)
domain = Domain.first
DomainDeleteMailer.accepted(domain)
end
def rejected
DomainDeleteMailer.rejected(@domain)
domain = Domain.first
DomainDeleteMailer.rejected(domain)
end
def expired
DomainDeleteMailer.expired(@domain)
domain = Domain.first
DomainDeleteMailer.expired(domain)
end
end
end

View file

@ -4,4 +4,10 @@ class DomainExpireMailerPreview < ActionMailer::Preview
DomainExpireMailer.expired(domain: domain,
registrar: domain.registrar)
end
end
def expired_soft
domain = Domain.first
DomainExpireMailer.expired_soft(domain: domain,
registrar: domain.registrar)
end
end

View file

@ -27,8 +27,8 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
@domain.reload
assert @domain.force_delete_scheduled?
assert_equal Date.parse('2010-09-20'), @domain.force_delete_date.to_date
assert_equal Date.parse('2010-08-06'), @domain.force_delete_start.to_date
assert_equal Date.parse('2010-09-19'), @domain.force_delete_date.to_date
assert_equal Date.parse('2010-08-05'), @domain.force_delete_start.to_date
end
def test_schedules_force_delete_soft_less_than_year_ahead
@ -137,19 +137,49 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
assert_not @domain.force_delete_scheduled?
end
def test_cancelling_force_delete_removes_statuses_that_were_set_on_force_delete
def test_force_delete_does_not_double_statuses
statuses = [
DomainStatus::FORCE_DELETE,
DomainStatus::SERVER_RENEW_PROHIBITED,
DomainStatus::SERVER_TRANSFER_PROHIBITED,
DomainStatus::FORCE_DELETE,
DomainStatus::SERVER_RENEW_PROHIBITED,
DomainStatus::SERVER_TRANSFER_PROHIBITED,
]
@domain.statuses = @domain.statuses + statuses
@domain.save!
@domain.reload
@domain.schedule_force_delete(type: :fast_track)
assert_equal @domain.statuses.size, statuses.size
end
def test_cancelling_force_delete_removes_force_delete_status
@domain.schedule_force_delete(type: :fast_track)
assert @domain.statuses.include?(DomainStatus::FORCE_DELETE)
assert @domain.statuses.include?(DomainStatus::SERVER_RENEW_PROHIBITED)
assert @domain.statuses.include?(DomainStatus::SERVER_TRANSFER_PROHIBITED)
@domain.cancel_force_delete
@domain.reload
assert_empty @domain.statuses & statuses
assert_not @domain.statuses.include?(DomainStatus::FORCE_DELETE)
assert_not @domain.statuses.include?(DomainStatus::SERVER_RENEW_PROHIBITED)
assert_not @domain.statuses.include?(DomainStatus::SERVER_TRANSFER_PROHIBITED)
end
def test_cancelling_force_delete_keeps_previous_statuses
statuses = [
DomainStatus::SERVER_RENEW_PROHIBITED,
DomainStatus::SERVER_TRANSFER_PROHIBITED,
]
@domain.statuses = statuses
@domain.save!
@domain.reload
@domain.schedule_force_delete(type: :fast_track)
@domain.cancel_force_delete
@domain.reload
assert_equal @domain.statuses, statuses
end
def test_hard_force_delete_should_have_outzone_and_purge_date_with_time
@ -252,4 +282,16 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
assert @domain.force_delete_scheduled?
assert @domain.pending_update?
end
def test_force_delete_does_not_affect_registrant_update_confirmable
@domain.schedule_force_delete(type: :soft)
@domain.registrant_verification_asked!('test', User.last.id)
@domain.save!
@domain.reload
@domain.statuses << DomainStatus::PENDING_UPDATE
assert @domain.force_delete_scheduled?
assert @domain.registrant_update_confirmable?(@domain.registrant_verification_token)
end
end

View file

@ -39,6 +39,21 @@ class DomainCronTest < ActiveSupport::TestCase
assert_emails 1
end
def does_not_deliver_forced_email_if_template_empty
Setting.redemption_grace_period = 30
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
assert_not @domain.force_delete_scheduled?
travel_to Time.zone.parse('2010-07-05')
@domain.schedule_force_delete(type: :soft)
@domain.reload
@domain.update(template_name: nil)
travel_to Time.zone.parse('2010-08-06')
DomainCron.start_client_hold
assert_emails 0
end
def test_does_not_sets_hold_if_already_set
Setting.redemption_grace_period = 30

View file

@ -444,6 +444,20 @@ class DomainTest < ActiveSupport::TestCase
assert_not @domain.renewable?
end
def test_renewable_if_pending_delete
assert @domain.renewable?
@domain.statuses << DomainStatus::PENDING_DELETE
assert @domain.renewable?
end
def test_not_renewable_if_pending_delete_unconfirmed
assert @domain.renewable?
@domain.statuses << DomainStatus::PENDING_DELETE_CONFIRMATION
assert_not @domain.renewable?
end
private
def valid_domain

View file

@ -51,6 +51,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
data_management_policy_violation: 2308,
command_failed: 2400,
authentication_error_server_closing_connection: 2501,
session_limit_exceeded_server_closing_connection: 2502,
}
assert_equal codes, Epp::Response::Result::Code.codes
end
@ -82,6 +83,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
2308 => 'Data management policy violation',
2400 => 'Command failed',
2501 => 'Authentication error; server closing connection',
2502 => 'Session limit exceeded; server closing connection',
}
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
end

View file

@ -49,15 +49,11 @@ class EppSessionTest < ActiveSupport::TestCase
end
end
def test_limit_per_registrar
assert_equal 4, EppSession.limit_per_registrar
end
def test_limit_is_per_registrar
travel_to Time.zone.parse('2010-07-05')
EppSession.delete_all
EppSession.limit_per_registrar.times do
EppSession.sessions_per_registrar.times do
EppSession.create!(session_id: SecureRandom.hex,
user: users(:api_goodnames),
updated_at: Time.zone.parse('2010-07-05'))

View file

@ -14,7 +14,7 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase
assert_equal('JOHN SMITH', user.username)
end
def test_find_or_create_by_api_data_creates_a_user_after_upcasing_input
def test_find_or_create_by_api_data_creates_a_user_with_original_name
user_data = {
ident: '37710100070',
first_name: 'John',
@ -24,6 +24,25 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase
RegistrantUser.find_or_create_by_api_data(user_data)
user = User.find_by(registrant_ident: 'EE-37710100070')
assert_equal('JOHN SMITH', user.username)
assert_equal('John Smith', user.username)
end
def test_updates_related_contacts_name_if_differs_from_e_identity
contact = contacts(:john)
contact.update(ident: '39708290276', ident_country_code: 'EE')
user_data = {
ident: '39708290276',
first_name: 'John',
last_name: 'Doe'
}
RegistrantUser.find_or_create_by_api_data(user_data)
user = User.find_by(registrant_ident: 'EE-39708290276')
assert_equal('John Doe', user.username)
contact.reload
assert_equal user.username, contact.name
end
end

View file

@ -8,7 +8,7 @@ class Whois::RecordTest < ActiveSupport::TestCase
@auction = auctions(:one)
@original_disclaimer = Setting.registry_whois_disclaimer
Setting.registry_whois_disclaimer = 'disclaimer'
Setting.registry_whois_disclaimer = JSON.generate({en: 'disclaimer'})
end
teardown do
@ -16,8 +16,8 @@ class Whois::RecordTest < ActiveSupport::TestCase
end
def test_reads_disclaimer_setting
Setting.registry_whois_disclaimer = 'test disclaimer'
assert_equal 'test disclaimer', Whois::Record.disclaimer
Setting.registry_whois_disclaimer = JSON.generate({en: 'test_disclaimer'})
assert_equal Setting.registry_whois_disclaimer, Whois::Record.disclaimer
end
def test_updates_whois_record_from_auction_when_started
@ -28,7 +28,7 @@ class Whois::RecordTest < ActiveSupport::TestCase
assert_equal ({ 'name' => 'domain.test',
'status' => ['AtAuction'],
'disclaimer' => 'disclaimer' }), @whois_record.json
'disclaimer' => { 'en' => 'disclaimer' }}), @whois_record.json
end
def test_updates_whois_record_from_auction_when_no_bids
@ -49,7 +49,7 @@ class Whois::RecordTest < ActiveSupport::TestCase
assert_equal ({ 'name' => 'domain.test',
'status' => ['PendingRegistration'],
'disclaimer' => 'disclaimer',
'disclaimer' => { 'en' => 'disclaimer' },
'registration_deadline' => registration_deadline.try(:to_s, :iso8601) }),
@whois_record.json
end
@ -64,7 +64,7 @@ class Whois::RecordTest < ActiveSupport::TestCase
assert_equal ({ 'name' => 'domain.test',
'status' => ['PendingRegistration'],
'disclaimer' => 'disclaimer',
'disclaimer' => { 'en' => 'disclaimer' },
'registration_deadline' => registration_deadline.try(:to_s, :iso8601) }),
@whois_record.json
end

View file

@ -12,10 +12,7 @@ class WhoisRecordTest < ActiveSupport::TestCase
end
def test_generated_json_has_expected_values
expected_disclaimer_text = <<-TEXT.squish
Search results may not be used for commercial, advertising, recompilation,
repackaging, redistribution, reuse, obscuring or other similar activities.
TEXT
expected_disclaimer_text = SettingEntry.find_by(code: 'registry_whois_disclaimer').retrieve
expected_partial_hash = {
disclaimer: expected_disclaimer_text,

View file

@ -42,6 +42,38 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
find(:css, '#soft_delete').set(true)
click_link_or_button 'Force delete domain'
end
@domain.reload
assert_equal @domain.notification_template, @domain.template_name
end
def test_uses_legal_template_if_registrant_org
@domain.registrant.update(ident_type: 'org')
assert_emails 0 do
visit edit_admin_domain_url(@domain)
find(:css, '#soft_delete').set(true)
click_link_or_button 'Force delete domain'
end
@domain.reload
assert_equal @domain.notification_template, @domain.template_name
end
def test_uses_legal_template_if_invalid_email
verification = @domain.contacts.first.email_verification
verification.update(verified_at: Time.zone.now - 1.day, success: false)
assert_equal @domain.notification_template, 'invalid_email'
assert_emails 0 do
visit edit_admin_domain_url(@domain)
find(:css, '#soft_delete').set(true)
click_link_or_button 'Force delete domain'
end
@domain.reload
assert_equal @domain.notification_template, @domain.template_name
end
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email

View file

@ -8,6 +8,7 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
def test_replaces_current_registrar_nameservers
request_body = { data: { type: 'nameserver',
id: 'ns1.bestnames.test',
domains: [],
attributes: { hostname: 'new-ns.bestnames.test',
ipv4: %w[192.0.2.55 192.0.2.56],
ipv6: %w[2001:db8::55 2001:db8::56] } } }