mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Merge remote-tracking branch 'origin/master' into log-bounced-emails
This commit is contained in:
commit
fc34105c40
70 changed files with 791 additions and 4967 deletions
|
@ -52,17 +52,6 @@ class ApiUserTest < ActiveSupport::TestCase
|
|||
assert ApiUser.new.active?
|
||||
end
|
||||
|
||||
def test_finds_user_by_id_card
|
||||
id_card = IdCard.new
|
||||
id_card.personal_code = 'one'
|
||||
|
||||
@user.update!(identity_code: 'one')
|
||||
assert_equal @user, ApiUser.find_by_id_card(id_card)
|
||||
|
||||
@user.update!(identity_code: 'another')
|
||||
assert_nil ApiUser.find_by_id_card(id_card)
|
||||
end
|
||||
|
||||
def test_verifies_pki_status
|
||||
certificate = certificates(:api)
|
||||
|
||||
|
|
|
@ -242,4 +242,14 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
|
|||
|
||||
assert_not_includes(@domain.statuses, asserted_status)
|
||||
end
|
||||
|
||||
def test_force_delete_does_not_affect_pending_update_check
|
||||
@domain.schedule_force_delete(type: :soft)
|
||||
@domain.reload
|
||||
|
||||
@domain.statuses << DomainStatus::PENDING_UPDATE
|
||||
|
||||
assert @domain.force_delete_scheduled?
|
||||
assert @domain.pending_update?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -52,4 +67,26 @@ class DomainCronTest < ActiveSupport::TestCase
|
|||
|
||||
assert_emails 0
|
||||
end
|
||||
|
||||
def test_cleans_expired_pendings_when_force_delete_active
|
||||
Setting.expire_pending_confirmation = 0
|
||||
|
||||
# Set force delete
|
||||
@domain.schedule_force_delete(type: :soft)
|
||||
@domain.reload
|
||||
|
||||
@domain.statuses << DomainStatus::PENDING_UPDATE
|
||||
# Set domain registrant change that's expired
|
||||
@domain.update!(registrant_verification_asked_at: Time.zone.now,
|
||||
registrant_verification_token: 'test',
|
||||
statuses: @domain.statuses)
|
||||
|
||||
assert @domain.pending_update?
|
||||
@domain.reload
|
||||
|
||||
DomainCron.clean_expired_pendings
|
||||
@domain.reload
|
||||
|
||||
assert_not @domain.pending_update?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -431,6 +431,19 @@ class DomainTest < ActiveSupport::TestCase
|
|||
assert_equal created_at, domain.registered_at
|
||||
end
|
||||
|
||||
def test_not_renewable_if_renew_prohibited
|
||||
assert @domain.renewable?
|
||||
|
||||
@domain.statuses << DomainStatus::SERVER_RENEW_PROHIBITED
|
||||
assert_not @domain.renewable?
|
||||
|
||||
@domain.statuses.delete(DomainStatus::SERVER_RENEW_PROHIBITED)
|
||||
assert @domain.renewable?
|
||||
|
||||
@domain.statuses << DomainStatus::CLIENT_RENEW_PROHIBITED
|
||||
assert_not @domain.renewable?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_domain
|
||||
|
|
|
@ -26,13 +26,4 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase
|
|||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_mid_data_creates_a_user
|
||||
user_data = OpenStruct.new(user_country: 'EE', user_id_code: '37710100070',
|
||||
user_givenname: 'JOHN', user_surname: 'SMITH')
|
||||
|
||||
RegistrantUser.find_or_create_by_mid_data(user_data)
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,34 +30,6 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
assert_equal Country.new('US'), user.country
|
||||
end
|
||||
|
||||
def test_finding_by_id_card_creates_new_user_upon_first_sign_in
|
||||
assert_not_equal 'US-5555', @user.registrant_ident
|
||||
id_card = IdCard.new
|
||||
id_card.first_name = 'John'
|
||||
id_card.last_name = 'Doe'
|
||||
id_card.personal_code = '5555'
|
||||
id_card.country_code = 'US'
|
||||
|
||||
assert_difference 'RegistrantUser.count' do
|
||||
RegistrantUser.find_by_id_card(id_card)
|
||||
end
|
||||
|
||||
user = RegistrantUser.last
|
||||
assert_equal 'US-5555', user.registrant_ident
|
||||
assert_equal 'John Doe', user.username
|
||||
end
|
||||
|
||||
def test_finding_by_id_card_reuses_existing_user_upon_subsequent_id_card_sign_ins
|
||||
@user.update!(registrant_ident: 'US-5555')
|
||||
id_card = IdCard.new
|
||||
id_card.personal_code = '5555'
|
||||
id_card.country_code = 'US'
|
||||
|
||||
assert_no_difference 'RegistrantUser.count' do
|
||||
RegistrantUser.find_by_id_card(id_card)
|
||||
end
|
||||
end
|
||||
|
||||
def test_queries_company_register_for_associated_companies
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
|
@ -92,4 +64,4 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
assert_equal %w(shop airport), @user.administered_domains
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue